]> git.saurik.com Git - apt.git/blob - test/integration/test-acquire-binary-all
Merge pull request julian-klode/apt#3 from adrian17/master
[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
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
26 testsuccess grep '^Get.* all Contents ' aptupdate.output
27 testequal 'foo-1
28 foo-2' aptcache pkgnames foo-
29
30 listcurrentlistsdirectory > lists.before
31 testsuccess grep '_binary-all_Packages' lists.before
32 testsuccess grep '_Contents-all\.' lists.before
33
34 configarchitecture 'amd64' 'i386'
35 testsuccessequal "All packages are up to date.
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
37 testfileequal lists.before "$(listcurrentlistsdirectory)"
38 testequal 'foo-1
39 foo-2' aptcache pkgnames foo-
40
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
53 rm -rf rootdir/var/lib/apt/lists
54 msgmsg 'Releasefile with Architectures field but without all'
55 configarchitecture 'amd64' 'i386'
56 getarchitecturesfromreleasefile() { echo "$(getarchitectures)"; }
57 generatereleasefiles
58 signreleasefiles
59 testsuccessequal 'All packages are up to date.' apt update -o quiet::NoProgress=1
60 cp rootdir/tmp/testsuccess.output aptupdate.output
61 testfailure grep '^Get.* all Packages ' aptupdate.output
62 testfailure grep '^Get.* all Contents ' aptupdate.output
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
69 testfailure grep '^Get.* all Contents ' aptupdate.output
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
77 testfailure grep '^Architectures: ' $(find ./aptarchive -name 'Release')
78 testsuccess apt update
79 cp rootdir/tmp/testsuccess.output aptupdate.output
80 testsuccess grep '^Get.* all Packages ' aptupdate.output
81 testsuccess grep '^Get.* all Contents ' aptupdate.output
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'
87 testfailure apt update
88 testequal 'foo-1
89 foo-2' aptcache pkgnames foo-
90
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
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-