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