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