]>
Commit | Line | Data |
---|---|---|
1dd20368 DK |
1 | #!/bin/sh |
2 | set -e | |
3 | ||
3abb6a6a DK |
4 | TESTDIR="$(readlink -f "$(dirname "$0")")" |
5 | . "$TESTDIR/framework" | |
1dd20368 DK |
6 | setupenvironment |
7 | configarchitecture 'amd64' | |
8 | ||
9 | buildsimplenativepackage 'foo-1' 'all' '2' 'unstable' | |
10 | buildsimplenativepackage 'foo-2' 'amd64' '2' 'unstable' | |
11 | setupaptarchive --no-update | |
12 | ||
a628ca52 DK |
13 | cat >rootdir/etc/apt/apt.conf.d/get-contents <<EOF |
14 | Acquire::IndexTargets::deb::Contents { | |
15 | MetaKey "\$(COMPONENT)/Contents-\$(ARCHITECTURE)"; | |
16 | ShortDescription "Contents"; | |
17 | Description "\$(RELEASE)/\$(COMPONENT) \$(ARCHITECTURE) Contents"; | |
18 | KeepCompressed "true"; | |
19 | }; | |
20 | EOF | |
21 | ||
1dd20368 DK |
22 | msgmsg 'Releasefile with Architectures field and all included' |
23 | testsuccess apt update | |
24 | cp rootdir/tmp/testsuccess.output aptupdate.output | |
25 | testsuccess grep '^Get.* all Packages ' aptupdate.output | |
a628ca52 | 26 | testsuccess grep '^Get.* all Contents ' aptupdate.output |
1dd20368 DK |
27 | testequal 'foo-1 |
28 | foo-2' aptcache pkgnames foo- | |
29 | ||
30 | listcurrentlistsdirectory > lists.before | |
31 | testsuccess grep '_binary-all_Packages' lists.before | |
a628ca52 | 32 | testsuccess grep '_Contents-all\.' lists.before |
1dd20368 DK |
33 | |
34 | configarchitecture 'amd64' 'i386' | |
35 | testsuccessequal "All packages are up to date. | |
87d6947d | 36 | 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 |
1dd20368 DK |
37 | testfileequal lists.before "$(listcurrentlistsdirectory)" |
38 | testequal 'foo-1 | |
39 | foo-2' aptcache pkgnames foo- | |
40 | ||
a628ca52 DK |
41 | rm -rf rootdir/var/lib/apt/lists |
42 | msgmsg 'Releasefile has all, but forbids its usage' | |
43 | configarchitecture 'amd64' | |
44 | sed -i '/^Architectures: / a\ | |
45 | No-Support-for-Architecture-all: Packages' $(find ./aptarchive -name 'Release') | |
46 | signreleasefiles | |
47 | testsuccess apt update | |
48 | cp rootdir/tmp/testsuccess.output aptupdate.output | |
49 | testfailure grep '^Get.* all Packages ' aptupdate.output | |
50 | testsuccess grep '^Get.* all Contents ' aptupdate.output | |
51 | sed -i '/^No-Support-for-Architecture-all: / d' $(find ./aptarchive -name 'Release') | |
52 | ||
1dd20368 DK |
53 | rm -rf rootdir/var/lib/apt/lists |
54 | msgmsg 'Releasefile with Architectures field but without all' | |
a628ca52 | 55 | configarchitecture 'amd64' 'i386' |
1dd20368 DK |
56 | getarchitecturesfromreleasefile() { echo "$(getarchitectures)"; } |
57 | generatereleasefiles | |
58 | signreleasefiles | |
87d6947d | 59 | testsuccessequal 'All packages are up to date.' apt update -o quiet::NoProgress=1 |
1dd20368 DK |
60 | cp rootdir/tmp/testsuccess.output aptupdate.output |
61 | testfailure grep '^Get.* all Packages ' aptupdate.output | |
a628ca52 | 62 | testfailure grep '^Get.* all Contents ' aptupdate.output |
1dd20368 DK |
63 | testequal 'foo-2' aptcache pkgnames foo- |
64 | ||
65 | configarchitecture 'amd64' | |
66 | testsuccess apt update | |
67 | cp rootdir/tmp/testsuccess.output aptupdate.output | |
68 | testfailure grep '^Get.* all Packages ' aptupdate.output | |
a628ca52 | 69 | testfailure grep '^Get.* all Contents ' aptupdate.output |
1dd20368 DK |
70 | testequal 'foo-2' aptcache pkgnames foo- |
71 | ||
72 | rm -rf rootdir/var/lib/apt/lists | |
73 | msgmsg 'Releasefile without Architectures field' | |
74 | getarchitecturesfromreleasefile() { echo -n ''; } | |
75 | generatereleasefiles | |
76 | signreleasefiles | |
a628ca52 | 77 | testfailure grep '^Architectures: ' $(find ./aptarchive -name 'Release') |
1dd20368 DK |
78 | testsuccess apt update |
79 | cp rootdir/tmp/testsuccess.output aptupdate.output | |
80 | testsuccess grep '^Get.* all Packages ' aptupdate.output | |
a628ca52 | 81 | testsuccess grep '^Get.* all Contents ' aptupdate.output |
1dd20368 DK |
82 | testequal 'foo-1 |
83 | foo-2' aptcache pkgnames foo- | |
84 | ||
85 | # apt doesn't know supported archs, so missing a configured arch is a failure | |
86 | configarchitecture 'amd64' 'i386' | |
87d6947d | 87 | testfailure apt update |
1dd20368 DK |
88 | testequal 'foo-1 |
89 | foo-2' aptcache pkgnames foo- | |
90 | ||
a628ca52 DK |
91 | rm -rf rootdir/var/lib/apt/lists |
92 | msgmsg 'Releasefile no Architectures all, but forbids its usage' | |
93 | configarchitecture 'amd64' | |
94 | sed -i '/^Date: / a\ | |
95 | No-Support-for-Architecture-all: Packages' $(find ./aptarchive -name 'Release') | |
96 | signreleasefiles | |
97 | testsuccess apt update | |
98 | cp rootdir/tmp/testsuccess.output aptupdate.output | |
99 | testfailure grep '^Get.* all Packages ' aptupdate.output | |
100 | testsuccess grep '^Get.* all Contents ' aptupdate.output | |
101 | sed -i '/^No-Support-for-Architecture-all: / d' $(find ./aptarchive -name 'Release') | |
102 | ||
1dd20368 DK |
103 | msgmsg 'No Releasefile' |
104 | rm -rf rootdir/var/lib/apt/lists | |
105 | find aptarchive -name '*Release*' -delete | |
106 | configarchitecture 'amd64' | |
107 | testfailure apt update | |
108 | testwarning apt update --allow-insecure-repositories | |
109 | testequal 'foo-1 | |
110 | foo-2' aptcache pkgnames foo- |