]> git.saurik.com Git - apt.git/blame_incremental - test/integration/test-acquire-binary-all
pass --force-remove-essential to dpkg only if needed
[apt.git] / test / integration / test-acquire-binary-all
... / ...
CommitLineData
1#!/bin/sh
2set -e
3
4TESTDIR="$(readlink -f "$(dirname "$0")")"
5. "$TESTDIR/framework"
6setupenvironment
7configarchitecture 'amd64'
8
9buildsimplenativepackage 'foo-1' 'all' '2' 'unstable'
10buildsimplenativepackage 'foo-2' 'amd64' '2' 'unstable'
11setupaptarchive --no-update
12
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
21cp -a rootdir/etc/apt/sources.list.d rootdir/etc/apt/sources.list.d.bak
22
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
27testsuccess grep '^Get.* all Contents ' aptupdate.output
28testequal 'foo-1
29foo-2' aptcache pkgnames foo-
30
31listcurrentlistsdirectory > lists.before
32testsuccess grep '_binary-all_Packages' lists.before
33testsuccess grep '_Contents-all\.' lists.before
34
35configarchitecture 'amd64' 'i386'
36testsuccessequal "All packages are up to date.
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
38testfileequal lists.before "$(listcurrentlistsdirectory)"
39testequal 'foo-1
40foo-2' aptcache pkgnames foo-
41
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
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
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
74rm -rf rootdir/var/lib/apt/lists
75msgmsg 'Releasefile with Architectures field but without all'
76configarchitecture 'amd64' 'i386'
77getarchitecturesfromreleasefile() { echo "$(getarchitectures)"; }
78generatereleasefiles
79signreleasefiles
80testsuccessequal 'All packages are up to date.' apt update -o quiet::NoProgress=1
81cp rootdir/tmp/testsuccess.output aptupdate.output
82testfailure grep '^Get.* all Packages ' aptupdate.output
83testfailure grep '^Get.* all Contents ' aptupdate.output
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
90testfailure grep '^Get.* all Contents ' aptupdate.output
91testequal 'foo-2' aptcache pkgnames foo-
92
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
104rm -rf rootdir/var/lib/apt/lists
105msgmsg 'Releasefile without Architectures field'
106getarchitecturesfromreleasefile() { echo -n ''; }
107generatereleasefiles
108signreleasefiles
109testfailure grep '^Architectures: ' $(find ./aptarchive -name 'Release')
110testsuccess apt update
111cp rootdir/tmp/testsuccess.output aptupdate.output
112testsuccess grep '^Get.* all Packages ' aptupdate.output
113testsuccess grep '^Get.* all Contents ' aptupdate.output
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'
119testfailure apt update
120testequal 'foo-1
121foo-2' aptcache pkgnames foo-
122
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
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-