]>
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 | |
e8e5d464 | 21 | cp -a rootdir/etc/apt/sources.list.d rootdir/etc/apt/sources.list.d.bak |
a628ca52 | 22 | |
1dd20368 DK |
23 | msgmsg 'Releasefile with Architectures field and all included' |
24 | testsuccess apt update | |
25 | cp rootdir/tmp/testsuccess.output aptupdate.output | |
26 | testsuccess grep '^Get.* all Packages ' aptupdate.output | |
a628ca52 | 27 | testsuccess grep '^Get.* all Contents ' aptupdate.output |
1dd20368 DK |
28 | testequal 'foo-1 |
29 | foo-2' aptcache pkgnames foo- | |
30 | ||
31 | listcurrentlistsdirectory > lists.before | |
32 | testsuccess grep '_binary-all_Packages' lists.before | |
a628ca52 | 33 | testsuccess grep '_Contents-all\.' lists.before |
1dd20368 DK |
34 | |
35 | configarchitecture 'amd64' 'i386' | |
36 | testsuccessequal "All packages are up to date. | |
87d6947d | 37 | 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 |
38 | testfileequal lists.before "$(listcurrentlistsdirectory)" |
39 | testequal 'foo-1 | |
40 | foo-2' aptcache pkgnames foo- | |
41 | ||
e8e5d464 DK |
42 | rm -rf rootdir/var/lib/apt/lists |
43 | msgmsg 'Releasefile with Architectures field and all included, but arch-=all' | |
44 | sed -i 's#^deb\(-src\)\? #deb\1 [arch-=all] #' rootdir/etc/apt/sources.list.d/* | |
45 | testsuccesswithnotice apt update | |
46 | cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/ | |
47 | cp rootdir/tmp/testsuccess.output aptupdate.output | |
48 | testfailure grep '^Get.* all Packages ' aptupdate.output | |
49 | testfailure grep '^Get.* all Contents ' aptupdate.output | |
50 | testequal 'foo-2' aptcache pkgnames foo- | |
51 | ||
a628ca52 DK |
52 | rm -rf rootdir/var/lib/apt/lists |
53 | msgmsg 'Releasefile has all, but forbids its usage' | |
54 | configarchitecture 'amd64' | |
55 | sed -i '/^Architectures: / a\ | |
56 | No-Support-for-Architecture-all: Packages' $(find ./aptarchive -name 'Release') | |
57 | signreleasefiles | |
58 | testsuccess apt update | |
59 | cp rootdir/tmp/testsuccess.output aptupdate.output | |
60 | testfailure grep '^Get.* all Packages ' aptupdate.output | |
61 | testsuccess grep '^Get.* all Contents ' aptupdate.output | |
62 | sed -i '/^No-Support-for-Architecture-all: / d' $(find ./aptarchive -name 'Release') | |
63 | ||
e8e5d464 DK |
64 | rm -rf rootdir/var/lib/apt/lists |
65 | msgmsg 'Releasefile has all, forbids its usage, but it is forced with arch=all' | |
66 | sed -i 's#^deb\(-src\)\? #deb\1 [arch=all] #' rootdir/etc/apt/sources.list.d/* | |
67 | testsuccess apt update | |
68 | cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/ | |
69 | cp rootdir/tmp/testsuccess.output aptupdate.output | |
70 | testsuccess grep '^Get.* all Packages ' aptupdate.output | |
71 | testsuccess grep '^Get.* all Contents ' aptupdate.output | |
72 | testequal 'foo-1' aptcache pkgnames foo- | |
73 | ||
1dd20368 DK |
74 | rm -rf rootdir/var/lib/apt/lists |
75 | msgmsg 'Releasefile with Architectures field but without all' | |
a628ca52 | 76 | configarchitecture 'amd64' 'i386' |
1dd20368 DK |
77 | getarchitecturesfromreleasefile() { echo "$(getarchitectures)"; } |
78 | generatereleasefiles | |
79 | signreleasefiles | |
87d6947d | 80 | testsuccessequal 'All packages are up to date.' apt update -o quiet::NoProgress=1 |
1dd20368 DK |
81 | cp rootdir/tmp/testsuccess.output aptupdate.output |
82 | testfailure grep '^Get.* all Packages ' aptupdate.output | |
a628ca52 | 83 | testfailure grep '^Get.* all Contents ' aptupdate.output |
1dd20368 DK |
84 | testequal 'foo-2' aptcache pkgnames foo- |
85 | ||
86 | configarchitecture 'amd64' | |
87 | testsuccess apt update | |
88 | cp rootdir/tmp/testsuccess.output aptupdate.output | |
89 | testfailure grep '^Get.* all Packages ' aptupdate.output | |
a628ca52 | 90 | testfailure grep '^Get.* all Contents ' aptupdate.output |
1dd20368 DK |
91 | testequal 'foo-2' aptcache pkgnames foo- |
92 | ||
e8e5d464 DK |
93 | rm -rf rootdir/var/lib/apt/lists |
94 | msgmsg 'Releasefile with Architectures field but without all forced with arch+=all' | |
95 | sed -i 's#^deb\(-src\)\? #deb\1 [arch+=all] #' rootdir/etc/apt/sources.list.d/* | |
96 | testsuccess apt update | |
97 | cp -a rootdir/etc/apt/sources.list.d.bak/* rootdir/etc/apt/sources.list.d/ | |
98 | cp rootdir/tmp/testsuccess.output aptupdate.output | |
99 | testsuccess grep '^Get.* all Packages ' aptupdate.output | |
100 | testsuccess grep '^Get.* all Contents ' aptupdate.output | |
101 | testequal 'foo-1 | |
102 | foo-2' aptcache pkgnames foo- | |
103 | ||
1dd20368 DK |
104 | rm -rf rootdir/var/lib/apt/lists |
105 | msgmsg 'Releasefile without Architectures field' | |
106 | getarchitecturesfromreleasefile() { echo -n ''; } | |
107 | generatereleasefiles | |
108 | signreleasefiles | |
a628ca52 | 109 | testfailure grep '^Architectures: ' $(find ./aptarchive -name 'Release') |
1dd20368 DK |
110 | testsuccess apt update |
111 | cp rootdir/tmp/testsuccess.output aptupdate.output | |
112 | testsuccess grep '^Get.* all Packages ' aptupdate.output | |
a628ca52 | 113 | testsuccess grep '^Get.* all Contents ' aptupdate.output |
1dd20368 DK |
114 | testequal 'foo-1 |
115 | foo-2' aptcache pkgnames foo- | |
116 | ||
117 | # apt doesn't know supported archs, so missing a configured arch is a failure | |
118 | configarchitecture 'amd64' 'i386' | |
87d6947d | 119 | testfailure apt update |
1dd20368 DK |
120 | testequal 'foo-1 |
121 | foo-2' aptcache pkgnames foo- | |
122 | ||
a628ca52 DK |
123 | rm -rf rootdir/var/lib/apt/lists |
124 | msgmsg 'Releasefile no Architectures all, but forbids its usage' | |
125 | configarchitecture 'amd64' | |
126 | sed -i '/^Date: / a\ | |
127 | No-Support-for-Architecture-all: Packages' $(find ./aptarchive -name 'Release') | |
128 | signreleasefiles | |
129 | testsuccess apt update | |
130 | cp rootdir/tmp/testsuccess.output aptupdate.output | |
131 | testfailure grep '^Get.* all Packages ' aptupdate.output | |
132 | testsuccess grep '^Get.* all Contents ' aptupdate.output | |
133 | sed -i '/^No-Support-for-Architecture-all: / d' $(find ./aptarchive -name 'Release') | |
134 | ||
1dd20368 DK |
135 | msgmsg 'No Releasefile' |
136 | rm -rf rootdir/var/lib/apt/lists | |
137 | find aptarchive -name '*Release*' -delete | |
138 | configarchitecture 'amd64' | |
139 | testfailure apt update | |
140 | testwarning apt update --allow-insecure-repositories | |
141 | testequal 'foo-1 | |
142 | foo-2' aptcache pkgnames foo- |