4 TESTDIR
="$(readlink -f "$(dirname "$0")")"
8 configcompression 'ALL'
9 configarchitecture 'i386'
12 buildsimplenativepackage 'testpkg' 'i386' '1.0'
16 # fake a pdiff setup as apt wouldn't try pdiffs otherwise
17 find aptarchive -name 'Packages' -o -name 'Sources' | while read file; do
19 PATCHINDEX="${file}.diff
/Index
"
20 echo 'SHA1-Current: adc83b19e793491b1c6ea0fd8b46cd9f32e592fc 0
22 adc83b19e793491b1c6ea0fd8b46cd9f32e592fc 33053002 2010-08-18-2013.28
23 ecfd1b19e793491b1c6ea123eabdcd9f32e592fc 33053001 2010-08-18-2013.29
25 abc1fc0ac57cd83d41c63195a9342e2db5650257 19722 2010-08-18-0814.28
26 dfe3444ac57cd83d41c63195a9342e2db5650257 19722 2010-08-18-0814.29' > $PATCHINDEX
33 msgtest 'Check if all index files are' "${1:-uncompressed}"
34 if [ "$1" = 'compressed' ]; then
35 ! test -e rootdir/var/lib/apt/lists/*i386_Packages || F=1
36 ! test -e rootdir/var/lib/apt/lists/*_Sources || F=1
37 ! test -e rootdir/var/lib/apt/lists/*_Translation-en || F=1
38 test -e rootdir/var/lib/apt/lists/*i386_Packages.$LOWCOSTEXT || F=1
39 test -e rootdir/var/lib/apt/lists/*_Sources.$LOWCOSTEXT || F=1
40 test -e rootdir/var/lib/apt/lists/*_Translation-en.$LOWCOSTEXT || F=1
41 # there is no point in trying pdiff if we have compressed indexes
42 # as we can't patch compressed files (well, we can, but what is the point?)
43 ! test -e rootdir/var/lib/apt/lists/*diff_Index || F=1
45 # clear the faked pdiff indexes so the glob below works
46 rm -f rootdir/var/lib/apt/lists/*diff_Index
47 test -e rootdir/var/lib/apt/lists/*i386_Packages || F=1
48 test -e rootdir/var/lib/apt/lists/*_Sources || F=1
49 test -e rootdir/var/lib/apt/lists/*_Translation-en || F=1
50 ! test -e rootdir/var/lib/apt/lists/*i386_Packages.* || F=1
51 ! test -e rootdir/var/lib/apt/lists/*_Sources.* || F=1
52 ! test -e rootdir/var/lib/apt/lists/*_Translation-en.* || F=1
55 cat rootdir/tmp/testsuccess.output
56 ls -laR rootdir/var/lib/apt/lists/
61 msgtest 'Check if package is downloadable'
63 testsuccess --nomsg aptget download testpkg
64 msgtest 'deb file is present'; testsuccess --nomsg test -f testpkg_1.0_i386.deb
65 rm -f testpkg_1.0_i386.deb
67 testsuccessequal 'Reading package lists...
68 Building dependency tree...
69 The following NEW packages will be installed:
71 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
72 Inst testpkg (1.0 unstable [i386])
73 Conf testpkg (1.0 unstable [i386])' aptget install testpkg -s -o Debug::pkgAcquire::Auth=0 -o Debug::pkgAcquire::Worker=0
74 rm -f rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin
75 testsuccessequal "$GOODSHOW" aptcache show testpkg
76 testsuccessequal "$GOODSHOW" aptcache show testpkg
77 rm -f rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin
78 testsuccessequal "$GOODPOLICY" aptcache policy testpkg
79 testsuccessequal "$GOODPOLICY" aptcache policy testpkg
80 rm -f rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin
81 testsuccessequal "$GOODSHOWSRC" aptcache showsrc testpkg
82 testsuccessequal "$GOODSHOWSRC" aptcache showsrc testpkg
84 msgtest 'Check if the source is aptgetable'
86 testsuccess --nomsg aptget source testpkg
87 testsuccess test -s testpkg_1.0.dsc
88 testsuccess test -d testpkg-1.0
91 testsuccessequal "$(aptcache show testpkg -o Acquire::Languages=none)
95 echo 'Dir::Log::Planner "/dev
/null
";
96 Debug::pkgAcquire::worker "true
";
97 debug::pkgAcquire::Auth "true
";
98 Debug::pkgAcquire::Diffs "true
";
99 Debug::Acquire::http "true
";' > rootdir/etc/apt/apt.conf.d/99debugconf
104 for INDEX in 'false' 'true'; do
105 rm -rf rootdir/var/lib/apt/lists
106 echo "Acquire
::GzipIndexes
\"${INDEX}\";" > rootdir/etc/apt/apt.conf.d/02compressindex
108 if [ "$INDEX" = 'false' -o "$1" = 'cdrom' ]; then
109 INDCOMP='uncompressed'
112 echo 'APT::Compressor::lz4::Name "lz4
";' >> rootdir/etc/apt/apt.conf.d/02compressindex
115 msgmsg "${1}: ${COMPRESSOR}: Test with
$INDCOMP indexes
gzip=$INDEX"
116 if [ "${1}" = 'cdrom' ]; then
117 testsuccess aptcdrom add </dev/null
119 testsuccess aptget update
122 if [ "${1}" != 'cdrom' ]; then
123 testsuccess aptget update -o Acquire::Pdiffs=1
124 msgmsg "${1}: ${COMPRESSOR}: Test with
$INDCOMP indexes
gzip=$INDEX (update unchanged with pdiffs
)"
127 testsuccess aptget update -o Acquire::Pdiffs=0
128 msgmsg "${1}: ${COMPRESSOR}: Test with
$INDCOMP indexes
gzip=$INDEX (update unchanged without pdiffs
)"
132 rm rootdir/etc/apt/apt.conf.d/02compressindex
136 testsuccess aptget update
137 GOODSHOW="$(aptcache show testpkg)
139 test $(echo "$GOODSHOW" | grep -e '^Package: testpkg' -e '^Version: 1.0' -e '^Architecture: i386' | wc -l) -eq 3 || msgdie 'show is broken'
140 testsuccessequal "$GOODSHOW" aptcache show testpkg
141 GOODSHOWSRC="$(aptcache showsrc testpkg)
143 test $(echo "$GOODSHOWSRC" | grep -e '^Package: testpkg' -e '^Format: 3.0 (native)' -e '^Files:' -e '^Checksums-Sha256:' | wc -l) -eq 4 || msgdie 'showsrc is broken'
144 testsuccessequal "$GOODSHOWSRC" aptcache showsrc testpkg
145 GOODPOLICY="$(aptcache policy testpkg)"
146 test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 file:/' | wc -l) -eq 4 || msgdie 'file policy is broken'
147 testsuccessequal "$GOODPOLICY" aptcache policy testpkg
148 forallsupportedcompressors testovermethod 'file'
150 rewritesourceslist "copy
://${TMPWORKINGDIRECTORY}/aptarchive
"
151 rm -rf rootdir/var/lib/apt/lists
152 testsuccess aptget update
153 GOODPOLICY="$(aptcache policy testpkg)"
154 test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 copy:/' | wc -l) -eq 4 || msgdie 'copy policy is broken'
155 testsuccessequal "$GOODPOLICY" aptcache policy testpkg
156 forallsupportedcompressors testovermethod 'copy'
159 rm -rf rootdir/var/lib/apt/lists
160 testsuccess aptget update
161 GOODPOLICY="$(aptcache policy testpkg)"
162 test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 http://' | wc -l) -eq 4 || msgdie 'http policy is broken'
163 testsuccessequal "$GOODPOLICY" aptcache policy testpkg
164 forallsupportedcompressors testovermethod 'http'
166 changetohttpswebserver
167 rm -rf rootdir/var/lib/apt/lists
168 testsuccess aptget update
169 GOODPOLICY="$(aptcache policy testpkg)"
170 test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 https://' | wc -l) -eq 4 || msgdie 'https policy is broken'
171 testsuccessequal "$GOODPOLICY" aptcache policy testpkg
172 forallsupportedcompressors testovermethod 'https'
174 changetocdrom 'Debian APT Testdisk 0.8.15'
175 rm -rf rootdir/var/lib/apt/lists
176 testsuccess aptcdrom add </dev/null
177 GOODPOLICY="$(aptcache policy testpkg)"
178 test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 cdrom://' | wc -l) -eq 4 || msgdie 'cdrom policy is broken'
179 testsuccessequal "$GOODPOLICY" aptcache policy testpkg
180 forallsupportedcompressors testovermethod 'cdrom'