1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
|
#!/bin/sh
set -e
TESTDIR="$(readlink -f "$(dirname "$0")")"
. "$TESTDIR/framework"
setupenvironment
configarchitecture 'amd64'
buildsimplenativepackage 'foo-1' 'all' '2' 'unstable'
buildsimplenativepackage 'foo-2' 'amd64' '2' 'unstable'
setupaptarchive --no-update
cat >rootdir/etc/apt/apt.conf.d/get-contents <<EOF
Acquire::IndexTargets::deb::Contents {
MetaKey "\$(COMPONENT)/Contents-\$(ARCHITECTURE)";
ShortDescription "Contents";
Description "\$(RELEASE)/\$(COMPONENT) \$(ARCHITECTURE) Contents";
KeepCompressed "true";
};
EOF
cp -a rootdir/etc/apt/sources.list.d rootdir/etc/apt/sources.list.d.bak
msgmsg 'Releasefile with Architectures field and all included'
testsuccess apt update
cp rootdir/tmp/testsuccess.output aptupdate.output
testsuccess grep '^Get.* all Packages ' aptupdate.output
testsuccess grep '^Get.* all Contents ' aptupdate.output
testequal 'foo-1
foo-2' aptcache pkgnames foo-
listcurrentlistsdirectory > lists.before
testsuccess grep '_binary-all_Packages' lists.before
testsuccess grep '_Contents-all\.' lists.before
configarchitecture 'amd64' 'i386'
testsuccessequal "All packages are up to date.
N: Skipping acquire of configured file 'main/binary-i386/Packages' as repository 'file:$(readlink -f ./aptarchive) unstable InRelease' doesn't support architecture 'i386'" apt update -o quiet::NoProgress=1
testfileequal lists.before "$(listcurrentlistsdirectory)"
testequal 'foo-1
foo-2' aptcache pkgnames foo-
rm -rf rootdir/var/lib/apt/lists
msgmsg 'Releasefile with Architectures field and all included, but arch-=all'
sed -i 's#^deb\(-src\)\? #deb\1 [arch-=all] #' rootdir/etc/apt/sources.list.d/*
testsuccesswithnotice apt update
cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/
cp rootdir/tmp/testsuccess.output aptupdate.output
testfailure grep '^Get.* all Packages ' aptupdate.output
testfailure grep '^Get.* all Contents ' aptupdate.output
testequal 'foo-2' aptcache pkgnames foo-
rm -rf rootdir/var/lib/apt/lists
msgmsg 'Releasefile has all, but forbids its usage'
configarchitecture 'amd64'
sed -i '/^Architectures: / a\
No-Support-for-Architecture-all: Packages' $(find ./aptarchive -name 'Release')
signreleasefiles
testsuccess apt update
cp rootdir/tmp/testsuccess.output aptupdate.output
testfailure grep '^Get.* all Packages ' aptupdate.output
testsuccess grep '^Get.* all Contents ' aptupdate.output
sed -i '/^No-Support-for-Architecture-all: / d' $(find ./aptarchive -name 'Release')
rm -rf rootdir/var/lib/apt/lists
msgmsg 'Releasefile has all, forbids its usage, but it is forced with arch=all'
sed -i 's#^deb\(-src\)\? #deb\1 [arch=all] #' rootdir/etc/apt/sources.list.d/*
testsuccess apt update
cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/
cp rootdir/tmp/testsuccess.output aptupdate.output
testsuccess grep '^Get.* all Packages ' aptupdate.output
testsuccess grep '^Get.* all Contents ' aptupdate.output
testequal 'foo-1' aptcache pkgnames foo-
rm -rf rootdir/var/lib/apt/lists
msgmsg 'Releasefile with Architectures field but without all'
configarchitecture 'amd64' 'i386'
getarchitecturesfromreleasefile() { echo "$(getarchitectures)"; }
generatereleasefiles
signreleasefiles
testsuccessequal 'All packages are up to date.' apt update -o quiet::NoProgress=1
cp rootdir/tmp/testsuccess.output aptupdate.output
testfailure grep '^Get.* all Packages ' aptupdate.output
testfailure grep '^Get.* all Contents ' aptupdate.output
testequal 'foo-2' aptcache pkgnames foo-
configarchitecture 'amd64'
testsuccess apt update
cp rootdir/tmp/testsuccess.output aptupdate.output
testfailure grep '^Get.* all Packages ' aptupdate.output
testfailure grep '^Get.* all Contents ' aptupdate.output
testequal 'foo-2' aptcache pkgnames foo-
rm -rf rootdir/var/lib/apt/lists
msgmsg 'Releasefile with Architectures field but without all forced with arch+=all'
sed -i 's#^deb\(-src\)\? #deb\1 [arch+=all] #' rootdir/etc/apt/sources.list.d/*
testsuccess apt update
cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/
cp rootdir/tmp/testsuccess.output aptupdate.output
testsuccess grep '^Get.* all Packages ' aptupdate.output
testsuccess grep '^Get.* all Contents ' aptupdate.output
testequal 'foo-1
foo-2' aptcache pkgnames foo-
rm -rf rootdir/var/lib/apt/lists
msgmsg 'Releasefile without Architectures field'
getarchitecturesfromreleasefile() { echo -n ''; }
generatereleasefiles
signreleasefiles
testfailure grep '^Architectures: ' $(find ./aptarchive -name 'Release')
testsuccess apt update
cp rootdir/tmp/testsuccess.output aptupdate.output
testsuccess grep '^Get.* all Packages ' aptupdate.output
testsuccess grep '^Get.* all Contents ' aptupdate.output
testequal 'foo-1
foo-2' aptcache pkgnames foo-
# apt doesn't know supported archs, so missing a configured arch is a problem
configarchitecture 'amd64' 'i386'
testwarningmsg "W: Skipping acquire of configured file 'main/binary-i386/Packages' as repository 'file:$(readlink -f ./aptarchive) unstable InRelease' does not seem to provide it (sources.list entry misspelt?)" apt update
testequal 'foo-1
foo-2' aptcache pkgnames foo-
rm -rf rootdir/var/lib/apt/lists
msgmsg 'Releasefile no Architectures all, but forbids its usage'
configarchitecture 'amd64'
sed -i '/^Date: / a\
No-Support-for-Architecture-all: Packages' $(find ./aptarchive -name 'Release')
signreleasefiles
testsuccess apt update
cp rootdir/tmp/testsuccess.output aptupdate.output
testfailure grep '^Get.* all Packages ' aptupdate.output
testsuccess grep '^Get.* all Contents ' aptupdate.output
sed -i '/^No-Support-for-Architecture-all: / d' $(find ./aptarchive -name 'Release')
msgmsg 'No Releasefile'
rm -rf rootdir/var/lib/apt/lists
find aptarchive -name '*Release*' -delete
configarchitecture 'amd64'
testfailure apt update
testwarning apt update --allow-insecure-repositories
testequal 'foo-1
foo-2' aptcache pkgnames foo-
|