4 TESTDIR
="$(readlink -f "$(dirname "$0")")"
7 configarchitecture 'amd64'
9 buildsimplenativepackage 'foo-1' 'all' '2' 'unstable'
10 buildsimplenativepackage 'foo-2' 'amd64' '2' 'unstable'
11 setupaptarchive --no-update
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
";
21 cp -a rootdir/etc/apt/sources.list.d rootdir/etc/apt/sources.list.d.bak
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
29 foo-2' aptcache pkgnames foo-
31 listcurrentlistsdirectory > lists.before
32 testsuccess grep '_binary-all_Packages' lists.before
33 testsuccess grep '_Contents-all\.' lists.before
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)"
40 foo
-2' aptcache pkgnames foo-
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
-
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')
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')
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
-
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)"; }
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
-
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
-
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
102 foo-2' aptcache pkgnames foo
-
104 rm -rf rootdir
/var
/lib
/apt
/lists
105 msgmsg
'Releasefile without Architectures field'
106 getarchitecturesfromreleasefile
() { echo -n ''; }
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
115 foo-2' aptcache pkgnames foo
-
117 # apt doesn't know supported archs, so missing a configured arch is a failure
118 configarchitecture
'amd64' 'i386'
119 testfailure apt update
121 foo-2' aptcache pkgnames foo
-
123 rm -rf rootdir
/var
/lib
/apt
/lists
124 msgmsg
'Releasefile no Architectures all, but forbids its usage'
125 configarchitecture
'amd64'
127 No-Support-for-Architecture-all: Packages' $(find ./aptarchive -name 'Release')
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')
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
142 foo-2' aptcache pkgnames foo
-