]> git.saurik.com Git - apt.git/blame - test/integration/test-compressed-indexes
handle gpgv's weak-digests ERRSIG
[apt.git] / test / integration / test-compressed-indexes
CommitLineData
f213b6ea
DK
1#!/bin/sh
2set -e
3
3abb6a6a
DK
4TESTDIR="$(readlink -f "$(dirname "$0")")"
5. "$TESTDIR/framework"
f213b6ea
DK
6
7setupenvironment
912a6131 8configcompression '.' $(aptconfig dump APT::Compressor --format '%t %v%n' | sed -n 's#^Extension \.\(.*\)$#\1#p')
5f982b9d 9configarchitecture 'i386'
0179cfa8 10LOWCOSTEXT='lz4'
5f982b9d
DK
11
12buildsimplenativepackage 'testpkg' 'i386' '1.0'
13
14buildaptarchive
15setupdistsaptarchive
16# fake a pdiff setup as apt wouldn't try pdiffs otherwise
17find aptarchive -name 'Packages' -o -name 'Sources' | while read file; do
18 mkdir "${file}.diff"
19 PATCHINDEX="${file}.diff/Index"
20 echo 'SHA1-Current: adc83b19e793491b1c6ea0fd8b46cd9f32e592fc 0
21SHA1-History:
22 adc83b19e793491b1c6ea0fd8b46cd9f32e592fc 33053002 2010-08-18-2013.28
23 ecfd1b19e793491b1c6ea123eabdcd9f32e592fc 33053001 2010-08-18-2013.29
24SHA1-Patches:
25 abc1fc0ac57cd83d41c63195a9342e2db5650257 19722 2010-08-18-0814.28
26 dfe3444ac57cd83d41c63195a9342e2db5650257 19722 2010-08-18-0814.29' > $PATCHINDEX
27done
28generatereleasefiles
29signreleasefiles
f213b6ea
DK
30
31testrun() {
32 local F
5f982b9d
DK
33 msgtest 'Check if all index files are' "${1:-uncompressed}"
34 if [ "$1" = 'compressed' ]; then
1dd20368
DK
35 ! test -e rootdir/var/lib/apt/lists/*i386_Packages || F=1
36 ! test -e rootdir/var/lib/apt/lists/*all_Packages || F=1
5f982b9d
DK
37 ! test -e rootdir/var/lib/apt/lists/*_Sources || F=1
38 ! test -e rootdir/var/lib/apt/lists/*_Translation-en || F=1
0179cfa8
DK
39 test -e rootdir/var/lib/apt/lists/*i386_Packages.$LOWCOSTEXT || F=1
40 test -e rootdir/var/lib/apt/lists/*all_Packages.$LOWCOSTEXT || F=1
41 test -e rootdir/var/lib/apt/lists/*_Sources.$LOWCOSTEXT || F=1
42 test -e rootdir/var/lib/apt/lists/*_Translation-en.$LOWCOSTEXT || F=1
5f982b9d
DK
43 # there is no point in trying pdiff if we have compressed indexes
44 # as we can't patch compressed files (well, we can, but what is the point?)
4d0818cc 45 ! test -e rootdir/var/lib/apt/lists/*diff_Index || F=1
5f982b9d
DK
46 else
47 # clear the faked pdiff indexes so the glob below works
4d0818cc 48 rm -f rootdir/var/lib/apt/lists/*diff_Index
1dd20368
DK
49 test -e rootdir/var/lib/apt/lists/*i386_Packages || F=1
50 test -e rootdir/var/lib/apt/lists/*all_Packages || F=1
5f982b9d
DK
51 test -e rootdir/var/lib/apt/lists/*_Sources || F=1
52 test -e rootdir/var/lib/apt/lists/*_Translation-en || F=1
1dd20368
DK
53 ! test -e rootdir/var/lib/apt/lists/*i386_Packages.* || F=1
54 ! test -e rootdir/var/lib/apt/lists/*all_Packages.* || F=1
5f982b9d
DK
55 ! test -e rootdir/var/lib/apt/lists/*_Sources.* || F=1
56 ! test -e rootdir/var/lib/apt/lists/*_Translation-en.* || F=1
f213b6ea 57 fi
5f982b9d 58 if [ -n "$F" ]; then
78bc8d6b 59 cat rootdir/tmp/testsuccess.output
5f982b9d
DK
60 ls -laR rootdir/var/lib/apt/lists/
61 msgfail
62 else
63 msgpass
64 fi
65 msgtest 'Check if package is downloadable'
03aa0847 66 cd downloaded
5f982b9d 67 testsuccess --nomsg aptget download testpkg
653ef26c 68 msgtest 'deb file is present'; testsuccess --nomsg test -f testpkg_1.0_i386.deb
a09f6eb8 69 rm -f testpkg_1.0_i386.deb
03aa0847 70 cd - >/dev/null
25b86db1 71 testsuccessequal 'Reading package lists...
5f982b9d
DK
72Building dependency tree...
73The following NEW packages will be installed:
74 testpkg
750 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
76Inst testpkg (1.0 unstable [i386])
77Conf testpkg (1.0 unstable [i386])' aptget install testpkg -s
8de79b68 78 rm -f rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin
25b86db1
DK
79 testsuccessequal "$GOODSHOW" aptcache show testpkg
80 testsuccessequal "$GOODSHOW" aptcache show testpkg
8de79b68 81 rm -f rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin
25b86db1
DK
82 testsuccessequal "$GOODPOLICY" aptcache policy testpkg
83 testsuccessequal "$GOODPOLICY" aptcache policy testpkg
8de79b68 84 rm -f rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin
25b86db1
DK
85 testsuccessequal "$GOODSHOWSRC" aptcache showsrc testpkg
86 testsuccessequal "$GOODSHOWSRC" aptcache showsrc testpkg
8de79b68 87 aptget clean
5f982b9d 88 msgtest 'Check if the source is aptgetable'
03aa0847 89 cd downloaded
0440d936 90 testsuccess --nomsg aptget source testpkg
03aa0847
DK
91 testsuccess test -s testpkg_1.0.dsc
92 testsuccess test -d testpkg-1.0
5f982b9d 93 rm -rf testpkg-1.0*
03aa0847 94 cd - >/dev/null
25b86db1 95 testsuccessequal "$(aptcache show testpkg -o Acquire::Languages=none)
4dde2b42 96" aptcache dumpavail
f213b6ea
DK
97}
98
5f982b9d
DK
99echo 'Debug::pkgAcquire::worker "true";
100debug::pkgAcquire::Auth "true";
70b63c57
DK
101Debug::pkgAcquire::Diffs "true";
102Debug::Acquire::http "true";' > rootdir/etc/apt/apt.conf.d/99debugconf
f213b6ea 103
5f982b9d
DK
104testovermethod() {
105 forcecompressor $2
f213b6ea 106
5f982b9d
DK
107 for INDEX in 'false' 'true'; do
108 rm -rf rootdir/var/lib/apt/lists
109 echo "Acquire::GzipIndexes \"${INDEX}\";" > rootdir/etc/apt/apt.conf.d/02compressindex
110 local INDCOMP
70b63c57 111 if [ "$INDEX" = 'false' -o "$1" = 'cdrom' ]; then
5f982b9d
DK
112 INDCOMP='uncompressed'
113 else
114 INDCOMP='compressed'
115 fi
f213b6ea 116
70b63c57
DK
117 msgmsg "${1}: ${COMPRESSOR}: Test with $INDCOMP indexes gzip=$INDEX"
118 if [ "${1}" = 'cdrom' ]; then
119 testsuccess aptcdrom add </dev/null
120 fi
121 testsuccess aptget update
5f982b9d 122 testrun "$INDCOMP"
f213b6ea 123
70b63c57
DK
124 if [ "${1}" != 'cdrom' ]; then
125 testsuccess aptget update -o Acquire::Pdiffs=1
126 msgmsg "${1}: ${COMPRESSOR}: Test with $INDCOMP indexes gzip=$INDEX (update unchanged with pdiffs)"
127 testrun "$INDCOMP"
f213b6ea 128
70b63c57
DK
129 testsuccess aptget update -o Acquire::Pdiffs=0
130 msgmsg "${1}: ${COMPRESSOR}: Test with $INDCOMP indexes gzip=$INDEX (update unchanged without pdiffs)"
131 testrun "$INDCOMP"
132 fi
f213b6ea 133
5f982b9d
DK
134 rm rootdir/etc/apt/apt.conf.d/02compressindex
135 done
136}
f213b6ea 137
0440d936 138testsuccess aptget update
5f982b9d
DK
139GOODSHOW="$(aptcache show testpkg)
140"
141test $(echo "$GOODSHOW" | grep -e '^Package: testpkg' -e '^Version: 1.0' -e '^Architecture: i386' | wc -l) -eq 3 || msgdie 'show is broken'
25b86db1 142testsuccessequal "$GOODSHOW" aptcache show testpkg
5f982b9d
DK
143GOODSHOWSRC="$(aptcache showsrc testpkg)
144"
145test $(echo "$GOODSHOWSRC" | grep -e '^Package: testpkg' -e '^Format: 3.0 (native)' -e '^Files:' -e '^Checksums-Sha256:' | wc -l) -eq 4 || msgdie 'showsrc is broken'
25b86db1 146testsuccessequal "$GOODSHOWSRC" aptcache showsrc testpkg
718f797c 147GOODPOLICY="$(aptcache policy testpkg)"
af9e40c9 148test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 file:/' | wc -l) -eq 4 || msgdie 'file policy is broken'
25b86db1 149testsuccessequal "$GOODPOLICY" aptcache policy testpkg
912a6131 150forallsupportedcompressors testovermethod 'file'
f213b6ea 151
af9e40c9 152rewritesourceslist "copy://${TMPWORKINGDIRECTORY}/aptarchive"
f213b6ea 153rm -rf rootdir/var/lib/apt/lists
0440d936 154testsuccess aptget update
5f982b9d 155GOODPOLICY="$(aptcache policy testpkg)"
af9e40c9 156test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 copy:/' | wc -l) -eq 4 || msgdie 'copy policy is broken'
25b86db1 157testsuccessequal "$GOODPOLICY" aptcache policy testpkg
912a6131 158forallsupportedcompressors testovermethod 'copy'
f213b6ea 159
af9e40c9
DK
160changetowebserver
161rm -rf rootdir/var/lib/apt/lists
162testsuccess aptget update
163GOODPOLICY="$(aptcache policy testpkg)"
164test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 http://' | wc -l) -eq 4 || msgdie 'http policy is broken'
165testsuccessequal "$GOODPOLICY" aptcache policy testpkg
912a6131 166forallsupportedcompressors testovermethod 'http'
70b63c57 167
af9e40c9
DK
168changetohttpswebserver
169rm -rf rootdir/var/lib/apt/lists
170testsuccess aptget update
171GOODPOLICY="$(aptcache policy testpkg)"
172test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 https://' | wc -l) -eq 4 || msgdie 'https policy is broken'
173testsuccessequal "$GOODPOLICY" aptcache policy testpkg
912a6131 174forallsupportedcompressors testovermethod 'https'
af9e40c9 175
70b63c57
DK
176changetocdrom 'Debian APT Testdisk 0.8.15'
177rm -rf rootdir/var/lib/apt/lists
178testsuccess aptcdrom add </dev/null
179GOODPOLICY="$(aptcache policy testpkg)"
af9e40c9 180test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 cdrom://' | wc -l) -eq 4 || msgdie 'cdrom policy is broken'
25b86db1 181testsuccessequal "$GOODPOLICY" aptcache policy testpkg
912a6131 182forallsupportedcompressors testovermethod 'cdrom'