local SP="$1"
local AP="$2"
shift 2
- testequal "Package files:
+ testsuccessequal "Package files:
$(echo "$SP" | awk '{ printf("%3s\n",$0) }') ${STATUS}
release a=now
$(echo "$AP" | awk '{ printf("%3s\n",$0) }') file:${APTARCHIVE}/ Packages
Pinned packages:" aptcache policy $*
}
-aptget update -qq
-testequalpolicy 100 500
-testequalpolicy 990 500 -t now
+testglobalpolicy() {
+ aptgetupdate
-sed -i aptarchive/Release -e 1i"NotAutomatic: yes"
-aptget update -qq
+ testequalpolicy 100 500
+ testequalpolicy 990 500 -t now
-testequalpolicy 100 1 -o Test=NotAutomatic
-testequalpolicy 990 1 -o Test=NotAutomatic -t now
+ sed -i aptarchive/Release -e 1i"NotAutomatic: yes"
+ aptgetupdate
-sed -i aptarchive/Release -e 1i"ButAutomaticUpgrades: yes"
-aptget update -qq
+ testequalpolicy 100 1 -o Test=NotAutomatic
+ testequalpolicy 990 1 -o Test=NotAutomatic -t now
-testequalpolicy 100 100 -o Test=ButAutomaticUpgrades
-testequalpolicy 990 100 -o Test=ButAutomaticUpgrades -t now
+ sed -i aptarchive/Release -e 1i"ButAutomaticUpgrades: yes"
+ aptgetupdate
-sed -i aptarchive/Release -e 's#NotAutomatic: yes#NotAutomatic: no#' -e '/ButAutomaticUpgrades: / d'
-aptget update -qq
+ testequalpolicy 100 100 -o Test=ButAutomaticUpgrades
+ testequalpolicy 990 100 -o Test=ButAutomaticUpgrades -t now
-testequalpolicy 100 500 -o Test=Automatic
-testequalpolicy 990 500 -o Test=Automatic -t now
+ sed -i aptarchive/Release -e 's#NotAutomatic: yes#NotAutomatic: no#' -e '/ButAutomaticUpgrades: / d'
+ aptgetupdate
+
+ testequalpolicy 100 500 -o Test=Automatic
+ testequalpolicy 990 500 -o Test=Automatic -t now
+
+ sed -i aptarchive/Release -e '/NotAutomatic: / d' -e '/ButAutomaticUpgrades: / d'
+}
+
+msgmsg 'Test with not signed archive'
+aptgetupdate() {
+ rm -rf rootdir/var/lib/apt
+ testwarning aptget update --allow-insecure-repositories
+}
+testglobalpolicy
+
+msgmsg 'Test with signed but no key in trusted'
+aptgetupdate() {
+ rm -rf rootdir/var/lib/apt
+ signreleasefiles 'Marvin Paranoid'
+ testwarning aptget update --allow-insecure-repositories
+}
+testglobalpolicy
+
+# much the same tests will be executed below in more detail again for this one
+msgmsg 'Test with signed and valid key'
+aptgetupdate() {
+ rm -rf rootdir/var/lib/apt
+ signreleasefiles 'Joe Sixpack'
+ testsuccess aptget update
+}
+testglobalpolicy
+
+msgmsg 'Test with specific packages'
buildsimplenativepackage "coolstuff" "all" "1.0" "stable"
buildsimplenativepackage "coolstuff" "all" "2.0~bpo1" "backports"
shift
fi
shift 6
- testequal "coolstuff:
+ testsuccessequal "coolstuff:
Installed: $INSTALLED
Candidate: $CANDIDATE
${PINVERSION}Version table:${BPO2ARCHIVE}
rm rootdir/etc/apt/preferences
sed -i aptarchive/dists/backports/Release -e 1i"NotAutomatic: yes"
signreleasefiles
-aptget update -qq
+aptgetupdate
testequalpolicycoolstuff "" "1.0" 1 500 0 "" -o Test=NotAutomatic
testequalpolicycoolstuff "" "1.0" 1 990 0 "" -o Test=NotAutomatic -t stable
rm rootdir/etc/apt/preferences
sed -i aptarchive/dists/backports/Release -e 1i"ButAutomaticUpgrades: yes"
signreleasefiles
-aptget update -qq
+aptgetupdate
testequalpolicycoolstuff "" "1.0" 100 500 0 "" -o Test=ButAutomaticUpgrades
testequalpolicycoolstuff "" "1.0" 100 990 0 "" -o Test=ButAutomaticUpgrades -t stable
testequalpolicycoolstuff "" "1.0" 100 990 600 "2.0~bpo1" -o Test=ButAutomaticUpgrades -t stable
rm rootdir/etc/apt/preferences
-aptget install coolstuff -qq > /dev/null 2> /dev/null
+testsuccess aptget install coolstuff -y
testequalpolicycoolstuff "1.0" "1.0" 100 500 0 "" -o Test=ButAutomaticUpgrades
-aptget dist-upgrade -qq > /dev/null 2> /dev/null
+testsuccess aptget dist-upgrade -y
testequalpolicycoolstuff "1.0" "1.0" 100 500 0 "" -o Test=ButAutomaticUpgrades
testequalpolicycoolstuff "1.0" "1.0" 100 990 0 "" -o Test=ButAutomaticUpgrades -t stable
testequalpolicycoolstuff "1.0" "2.0~bpo1" 990 500 0 "" -o Test=ButAutomaticUpgrades -t backports
-aptget install coolstuff -t backports -qq > /dev/null 2> /dev/null
+testsuccess aptget install coolstuff -t backports -y
testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 100 500 0 "" -o Test=ButAutomaticUpgrades
-aptget dist-upgrade -qq > /dev/null 2> /dev/null
+testsuccess aptget dist-upgrade -y
testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 100 500 0 "" -o Test=ButAutomaticUpgrades
testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 100 990 0 "" -o Test=ButAutomaticUpgrades -t stable
testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 990 500 0 "" -o Test=ButAutomaticUpgrades -t backports
sed -i aptarchive/dists/backports/Release -e 1i"NotAutomatic: yes"
signreleasefiles
-aptget update -qq
+aptgetupdate
testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 1 500 0 "" "2.0~bpo2" -o Test=NotAutomatic
testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 1 990 0 "" "2.0~bpo2" -o Test=NotAutomatic -t stable
sed -i aptarchive/dists/backports/Release -e 1i"ButAutomaticUpgrades: yes"
signreleasefiles
-aptget update -qq
+aptgetupdate
testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo2" 100 500 0 "" "2.0~bpo2" -o Test=ButAutomaticUpgrades
testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo2" 100 990 0 "" "2.0~bpo2" -o Test=ButAutomaticUpgrades -t stable