]> git.saurik.com Git - apt.git/blame - test/integration/test-pdiff-usage
fix testcase expecting incorrect remove log from dpkg
[apt.git] / test / integration / test-pdiff-usage
CommitLineData
f213b6ea
DK
1#!/bin/sh
2set -e
3
3abb6a6a
DK
4TESTDIR="$(readlink -f "$(dirname "$0")")"
5. "$TESTDIR/framework"
f213b6ea
DK
6
7setupenvironment
47d2bc78 8configarchitecture 'i386'
0179cfa8 9LOWCOSTEXT='lz4'
f213b6ea
DK
10
11buildaptarchive
12setupflataptarchive
38f8704e
DK
13changetowebserver
14
15cat >rootdir/etc/apt/apt.conf.d/contents.conf <<EOF
16Acquire::IndexTargets::deb::Contents {
17 MetaKey "\$(COMPONENT)/Contents-\$(ARCHITECTURE)";
18 ShortDescription "Contents";
19 Description "\$(RELEASE)/\$(COMPONENT) \$(ARCHITECTURE) Contents";
20 MetaKey "\$(COMPONENT)/Contents-\$(ARCHITECTURE)";
21 flatMetaKey "Contents-\$(ARCHITECTURE)";
22 flatDescription "\$(RELEASE) \$(ARCHITECTURE) Contents";
23};
24EOF
f213b6ea 25
f213b6ea 26PKGFILE="${TESTDIR}/$(echo "$(basename $0)" | sed 's#^test-#Packages-#')"
38f8704e
DK
27echo 'contents for stuff' > aptarchive/Contents-i386
28compressfile aptarchive/Contents-i386
29echo 'hacked' > aptarchive/hacked-i386
30compressfile aptarchive/hacked-i386
47d2bc78 31
47d2bc78 32wasmergeused() {
0e071dfe
DK
33 if echo "$*" | grep -q -- '-o test::cannot-use-pdiff=1'; then
34 find rootdir/var/lib/apt/lists/partial -name '*-patched*' -delete
35 fi
36
742f67ea 37 testsuccess apt update "$@"
77e274f5 38 #apt update "$@" 2>&1 | tee rootdir/tmp/testsuccess.output
50bd6fd3 39
34d6ece7
DK
40 msgtest 'No intermediate patch files' 'still exist'
41 local EDS="$(find rootdir/var/lib/apt/lists -name '*.ed' -o -name '*.ed.*')"
42 if [ -z "$EDS" ]; then
43 msgpass
44 else
45 echo
46 echo "$EDS"
47 msgfail
48 fi
49
8d0d9255
DK
50 if echo "$*" | grep -q -- '-o test::cannot-use-pdiff=1'; then
51 msgtest 'Check if pdiff was' 'not used'
52 cp -a rootdir/tmp/testsuccess.output rootdir/tmp/aptupdate.output
4a808dea 53 testsuccess --nomsg grep "diff/Index with Message: Couldn't parse pdiff index" rootdir/tmp/aptupdate.output
8d0d9255
DK
54 return;
55 fi
56
47d2bc78 57 msgtest 'Check if the right pdiff merger was used'
ba6b79bd 58 if grep -q '^pkgAcqIndexMergeDiffs::Done(): rred' rootdir/tmp/testsuccess.output; then
8d0d9255 59 if echo "$*" | grep -q -- '-o Acquire::PDiffs::Merge=1'; then
47d2bc78
DK
60 msgpass
61 else
62 msgfail "Merge shouldn't have been used, but was"
63 fi
8d0d9255 64 elif echo "$*" | grep -q -- '-o Acquire::PDiffs::Merge=1'; then
47d2bc78
DK
65 msgfail "Merge should have been used, but wasn't"
66 else
67 msgpass
68 fi
4aa6ebf6
DK
69
70 testequal '1' grep -c rred:601 rootdir/tmp/testsuccess.output
47d2bc78
DK
71}
72
73testrun() {
4e3c5633 74 configcompression '.' 'xz'
34d6ece7 75 msgmsg "Testcase: setup the base with: $*"
47d2bc78 76 find aptarchive -name 'Packages*' -type f -delete
3abb6a6a 77 cp "${PKGFILE}" aptarchive/Packages
47d2bc78
DK
78 compressfile 'aptarchive/Packages'
79 generatereleasefiles
80 signreleasefiles
146f7715 81 rm -rf aptarchive/Packages.diff rootdir/var/lib/apt/lists rootdir/var/lib/apt/lists-bak
47d2bc78
DK
82 testsuccess aptget update "$@"
83 cp -a rootdir/var/lib/apt/lists rootdir/var/lib/apt/lists-bak
84 testnopackage newstuff
3abb6a6a 85 testsuccessequal "$(cat "${PKGFILE}")
f213b6ea 86" aptcache show apt oldstuff
4e3c5633 87 configcompression '.' 'gz'
f213b6ea 88
ef3c549e 89 # see if the code deals properly with leftover partial files
b7a1076f 90 partialleftovers
ef3c549e 91
34d6ece7 92 msgmsg "Testcase: apply with one patch: $*"
4e3c5633 93 find aptarchive -name 'Packages*' -type f -delete
3abb6a6a 94 cp "${PKGFILE}-new" aptarchive/Packages
47d2bc78
DK
95 compressfile 'aptarchive/Packages'
96 mkdir -p aptarchive/Packages.diff
97 PATCHFILE="aptarchive/Packages.diff/$(date +%Y-%m-%d-%H%M.%S)"
3abb6a6a
DK
98 diff -e "${PKGFILE}" "${PKGFILE}-new" > "${PATCHFILE}" || true
99 cat "$PATCHFILE" | gzip > "${PATCHFILE}.gz"
47d2bc78 100 PATCHINDEX='aptarchive/Packages.diff/Index'
8d0d9255 101 echo "SHA256-Current: $(sha256sum "${PKGFILE}-new" | cut -d' ' -f 1) $(stat -c%s "${PKGFILE}-new")
f6d4ab9a
DK
102SHA256-History:
103 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b 33053002 2010-08-18-2013.28
3abb6a6a 104 $(sha256sum "$PKGFILE" | cut -d' ' -f 1) $(stat -c%s "$PKGFILE") $(basename "$PATCHFILE")
f6d4ab9a
DK
105SHA256-Patches:
106 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 19722 2010-08-18-2013.28
4a808dea
DK
107 $(sha256sum "$PATCHFILE" | cut -d' ' -f 1) $(stat -c%s "$PATCHFILE") $(basename "$PATCHFILE")
108SHA256-Download:
4f51fd86 109 d2a1b33187ed2d248eeae3b1223ea71791ea35f2138a713ed371332a6421f467 197 2010-08-18-2013.28.gz
4a808dea 110 $(sha256sum "${PATCHFILE}.gz" | cut -d' ' -f 1) $(stat -c%s "${PATCHFILE}.gz") $(basename "${PATCHFILE}.gz")" > "$PATCHINDEX"
4f51fd86 111
47d2bc78
DK
112 generatereleasefiles '+1hour'
113 signreleasefiles
114 find aptarchive -name 'Packages*' -type f -delete
115 wasmergeused "$@"
116 testnopackage oldstuff
3abb6a6a 117 testsuccessequal "$(cat "${PKGFILE}-new")
47d2bc78 118" aptcache show apt newstuff
f213b6ea 119
77e274f5
DK
120 msgmsg "Testcase: apply with compressed Index and one patch: $*"
121 cp "${PKGFILE}-new" aptarchive/Packages
122 compressfile 'aptarchive/Packages'
123 cat "$PATCHINDEX" | gzip > "${PATCHINDEX}.gz"
124 generatereleasefiles '+1hour'
125 signreleasefiles
126 find aptarchive -name 'Packages*' -type f -delete
127 rm "$PATCHINDEX"
128 rm -rf rootdir/var/lib/apt/lists
129 cp -a rootdir/var/lib/apt/lists-bak rootdir/var/lib/apt/lists
130 wasmergeused "$@"
131 testnopackage oldstuff
132 testsuccessequal "$(cat "${PKGFILE}-new")
133" aptcache show apt newstuff
134
135 msgmsg "Testcase: apply with by-hash compressed Index and one patch: $*"
136 local NORMAL="$(readlink -f "./aptarchive/Packages.diff")"
137 local BYHASH="${NORMAL}/by-hash/SHA256"
138 mkdir -p "${BYHASH}"
139 find "${NORMAL}/" -maxdepth 1 -name "Index*" -exec mv '{}' "$BYHASH" \;
140 ln -s "${BYHASH}/Index.gz" "${BYHASH}/$(sha256sum "${BYHASH}/Index.gz" | cut -f1 -d' ')"
141 rm -rf rootdir/var/lib/apt/lists
142 cp -a rootdir/var/lib/apt/lists-bak rootdir/var/lib/apt/lists
143 wasmergeused "$@" -o Acquire::By-Hash=force
144 testnopackage oldstuff
145 testsuccessequal "$(cat "${PKGFILE}-new")
146" aptcache show apt newstuff
147
4a808dea 148 msgmsg "Testcase: SHA1-only patches are not used: $*"
f345d057
JAK
149 find aptarchive -name 'Packages*' -type f -delete
150 cp "${PKGFILE}-new" aptarchive/Packages
151 compressfile 'aptarchive/Packages'
152 mkdir -p aptarchive/Packages.diff
153 PATCHFILE="aptarchive/Packages.diff/$(date +%Y-%m-%d-%H%M.%S)"
154 diff -e "${PKGFILE}" "${PKGFILE}-new" > "${PATCHFILE}" || true
155 cat "$PATCHFILE" | gzip > "${PATCHFILE}.gz"
156 PATCHINDEX='aptarchive/Packages.diff/Index'
157 echo "SHA1-Current: $(sha1sum "${PKGFILE}-new" | cut -d' ' -f 1) $(stat -c%s "${PKGFILE}-new")
158SHA1-History:
159 9f4148e06d7faa37062994ff10d0c842d7017513 33053002 2010-08-18-2013.28
160 $(sha1sum "$PKGFILE" | cut -d' ' -f 1) $(stat -c%s "$PKGFILE") $(basename "$PATCHFILE")
161SHA1-Patches:
162 7651fc0ac57cd83d41c63195a9342e2db5650257 19722 2010-08-18-2013.28
4a808dea
DK
163 $(sha1sum "$PATCHFILE" | cut -d' ' -f 1) $(stat -c%s "$PATCHFILE") $(basename "$PATCHFILE")
164SHA1-Download:
f345d057 165 2365ac0ac57cde3d43c63145e8251a3bd5410213 197 2010-08-18-2013.28.gz
4a808dea
DK
166 $(sha1sum "${PATCHFILE}.gz" | cut -d' ' -f 1) $(stat -c%s "${PATCHFILE}.gz") $(basename "${PATCHFILE}.gz")" > "$PATCHINDEX"
167 generatereleasefiles '+1hour'
168 signreleasefiles
169 rm -rf rootdir/var/lib/apt/lists
170 cp -a rootdir/var/lib/apt/lists-bak rootdir/var/lib/apt/lists
171 wasmergeused "$@" -o test::cannot-use-pdiff=1
172 testnopackage oldstuff
173 testsuccessequal "$(cat "${PKGFILE}-new")
174" aptcache show apt newstuff
f345d057 175
4a808dea
DK
176 msgmsg "Testcase: no download-hashes patches are not used: $*"
177 find aptarchive -name 'Packages*' -type f -delete
178 cp "${PKGFILE}-new" aptarchive/Packages
179 compressfile 'aptarchive/Packages'
180 mkdir -p aptarchive/Packages.diff
181 PATCHFILE="aptarchive/Packages.diff/$(date +%Y-%m-%d-%H%M.%S)"
182 diff -e "${PKGFILE}" "${PKGFILE}-new" > "${PATCHFILE}" || true
183 cat "$PATCHFILE" | gzip > "${PATCHFILE}.gz"
184 PATCHINDEX='aptarchive/Packages.diff/Index'
185 echo "SHA256-Current: $(sha256sum "${PKGFILE}-new" | cut -d' ' -f 1) $(stat -c%s "${PKGFILE}-new")
186SHA256-History:
187 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b 33053002 2010-08-18-2013.28
188 $(sha256sum "$PKGFILE" | cut -d' ' -f 1) $(stat -c%s "$PKGFILE") $(basename "$PATCHFILE")
189SHA256-Patches:
190 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 19722 2010-08-18-2013.28
191 $(sha256sum "$PATCHFILE" | cut -d' ' -f 1) $(stat -c%s "$PATCHFILE") $(basename "$PATCHFILE")" > "$PATCHINDEX"
f345d057
JAK
192 generatereleasefiles '+1hour'
193 signreleasefiles
8d0d9255
DK
194 rm -rf rootdir/var/lib/apt/lists
195 cp -a rootdir/var/lib/apt/lists-bak rootdir/var/lib/apt/lists
f345d057
JAK
196 wasmergeused "$@" -o test::cannot-use-pdiff=1
197 testnopackage oldstuff
198 testsuccessequal "$(cat "${PKGFILE}-new")
199" aptcache show apt newstuff
200
34d6ece7 201 msgmsg "Testcase: apply with two patches: $*"
3abb6a6a 202 cp "${PKGFILE}-new" aptarchive/Packages
47d2bc78
DK
203 echo '
204Package: futurestuff
205Version: 1.0
206Architecture: i386
207Maintainer: Joe Sixpack <joe@example.org>
208Installed-Size: 202
209Filename: pool/futurestuff_1.0_i386.deb
210Size: 202200
47d2bc78
DK
211SHA256: b46fd154615edaae5ba33c56a5cc0e7deaef23e2da3e4f129727fd660f28f050
212Description: some cool and shiny future stuff
213 This package will appear in the next next mirror update
214Description-md5: d5f89fbbc2ce34c455dfee9b67d82b6b' >> aptarchive/Packages
215
216 compressfile 'aptarchive/Packages'
217 PATCHFILE2="aptarchive/Packages.diff/$(date -d 'now + 1hour' '+%Y-%m-%d-%H%M.%S')"
3abb6a6a
DK
218 diff -e "${PKGFILE}-new" aptarchive/Packages > "${PATCHFILE2}" || true
219 cat "$PATCHFILE2" | gzip > "${PATCHFILE2}.gz"
8d0d9255 220 echo "SHA256-Current: $(sha256sum aptarchive/Packages | cut -d' ' -f 1) $(stat -c%s aptarchive/Packages)
f6d4ab9a
DK
221SHA256-History:
222 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b 33053002 2010-08-18-2013.28
3abb6a6a
DK
223 $(sha256sum "$PKGFILE" | cut -d' ' -f 1) $(stat -c%s "$PKGFILE") $(basename "$PATCHFILE")
224 $(sha256sum "${PKGFILE}-new" | cut -d' ' -f 1) $(stat -c%s "${PKGFILE}-new") $(basename "${PATCHFILE2}")
f6d4ab9a
DK
225SHA256-Patches:
226 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 19722 2010-08-18-2013.28
3abb6a6a 227 $(sha256sum "$PATCHFILE" | cut -d' ' -f 1) $(stat -c%s "$PATCHFILE") $(basename "$PATCHFILE")
4a808dea
DK
228 $(sha256sum "${PATCHFILE2}" | cut -d' ' -f 1) $(stat -c%s "${PATCHFILE2}") $(basename "${PATCHFILE2}")
229SHA256-Download:
4f51fd86 230 d2a1b33187ed2d248eeae3b1223ea71791ea35f2138a713ed371332a6421f467 197 2010-08-18-2013.28.gz
3abb6a6a 231 $(sha256sum "${PATCHFILE}.gz" | cut -d' ' -f 1) $(stat -c%s "${PATCHFILE}.gz") $(basename "${PATCHFILE}.gz")
4a808dea 232 $(sha256sum "${PATCHFILE2}.gz" | cut -d' ' -f 1) $(stat -c%s "${PATCHFILE2}.gz") $(basename "${PATCHFILE2}.gz")" > "$PATCHINDEX"
4f51fd86 233
47d2bc78
DK
234 generatereleasefiles '+2hour'
235 signreleasefiles
236 cp -a aptarchive/Packages Packages-future
237 find aptarchive -name 'Packages*' -type f -delete
238 rm -rf rootdir/var/lib/apt/lists
239 cp -a rootdir/var/lib/apt/lists-bak rootdir/var/lib/apt/lists
240 wasmergeused "$@"
241 testnopackage oldstuff
25b86db1 242 testsuccessequal "$(cat Packages-future)
47d2bc78
DK
243" aptcache show apt newstuff futurestuff
244
38f8704e
DK
245 # we reuse the archive state of the previous test here
246 msgmsg "Testcase: pdiff handling is stopped if transaction fails $*"
247 rm -rf rootdir/var/lib/apt/lists
248 cp -a rootdir/var/lib/apt/lists-bak rootdir/var/lib/apt/lists
249 cp Packages-future aptarchive/Packages
250 rm -f rootdir/var/lib/apt/lists/*_Contents-*
251 webserverconfig 'aptwebserver::overwrite::.*Contents-.*::filename' '/hacked-i386.gz'
4aa6ebf6 252 testfailure apt update "$@"
38f8704e
DK
253 webserverconfig 'aptwebserver::overwrite::.*Contents-.*::filename' '/Contents-i386.gz'
254 cp rootdir/tmp/testfailure.output patchdownload.output
255 testfailure grep 'rred:600' patchdownload.output
256 testnopackage newstuff futurestuff
257 testsuccessequal "$(cat "${PKGFILE}")
258" aptcache show apt oldstuff
259
742f67ea
DK
260 # we reuse the entire state of the previous test here
261 msgmsg "Testcase: good files from previous fails are picked up from partial: $*"
262 wasmergeused "$@"
263 testfailure grep '^GET /Packages.diff/Index HTTP/1.1' rootdir/tmp/testsuccess.output
264 testnopackage oldstuff
265 testsuccessequal "$(cat Packages-future)
266" aptcache show apt newstuff futurestuff
267
dfcf7f35
DK
268 # we reuse the archive state of the previous test here
269 msgmsg "Testcase: downloading a patch fails, but successful fallback: $*"
270 rm -rf rootdir/var/lib/apt/lists
271 cp -a rootdir/var/lib/apt/lists-bak rootdir/var/lib/apt/lists
272 cp Packages-future aptarchive/Packages
273 rm "${PATCHFILE}.gz"
274 testsuccess apt update "$@"
275 cp rootdir/tmp/testsuccess.output patchdownload.output
276 testsuccess grep '^Falling back to normal index file acquire' patchdownload.output
277 testnopackage oldstuff
278 testsuccessequal "$(cat Packages-future)
279" aptcache show apt newstuff futurestuff
280
34d6ece7 281 msgmsg "Testcase: patch applying fails, but successful fallback: $*"
47d2bc78
DK
282 rm -rf rootdir/var/lib/apt/lists
283 cp -a rootdir/var/lib/apt/lists-bak rootdir/var/lib/apt/lists
3abb6a6a 284 cp "${PKGFILE}-new" aptarchive/Packages
47d2bc78
DK
285 compressfile 'aptarchive/Packages'
286 mkdir -p aptarchive/Packages.diff
287 PATCHFILE="aptarchive/Packages.diff/$(date +%Y-%m-%d-%H%M.%S)"
3abb6a6a
DK
288 diff -e "${PKGFILE}" "${PKGFILE}-new" > "${PATCHFILE}" || true
289 cat "$PATCHFILE" | gzip > "${PATCHFILE}.gz"
47d2bc78 290 PATCHINDEX='aptarchive/Packages.diff/Index'
8d0d9255 291 echo "SHA256-Current: $(sha256sum "${PKGFILE}-new" | cut -d' ' -f 1) $(stat -c%s "${PKGFILE}-new")
f6d4ab9a
DK
292SHA256-History:
293 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b 33053002 2010-08-18-2013.28
3abb6a6a 294 $(sha256sum "$PKGFILE" | cut -d' ' -f 1) $(stat -c%s "$PKGFILE") $(basename "$PATCHFILE")
f6d4ab9a
DK
295SHA256-Patches:
296 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 19722 2010-08-18-2013.28
4a808dea
DK
297 $(sha256sum "$PATCHFILE" | cut -d' ' -f 1) $(stat -c%s "$PATCHFILE") $(basename "$PATCHFILE")
298SHA256-Download:
4f51fd86 299 d2a1b33187ed2d248eeae3b1223ea71791ea35f2138a713ed371332a6421f467 197 2010-08-18-2013.28.gz
4a808dea 300 $(sha256sum "${PATCHFILE}.gz" | cut -d' ' -f 1) $(stat -c%s "${PATCHFILE}.gz") $(basename "${PATCHFILE}.gz")" > "$PATCHINDEX"
6d3e5bd8 301 # needs to look like a valid command, otherwise the parser will fail before hashes are checked
3abb6a6a
DK
302 echo '1d' > "$PATCHFILE"
303 cat "$PATCHFILE" | gzip > "${PATCHFILE}.gz"
47d2bc78
DK
304 generatereleasefiles '+1hour'
305 signreleasefiles
4e3c5633
DK
306 testsuccess apt update "$@"
307 cp -f rootdir/tmp/testsuccess.output rootdir/tmp/aptupdate.output
308 testsuccess grep 'Hash Sum mismatch' rootdir/tmp/aptupdate.output
47d2bc78 309 testnopackage oldstuff
3abb6a6a 310 testsuccessequal "$(cat "${PKGFILE}-new")
47d2bc78 311" aptcache show apt newstuff
c355ea30
DK
312
313 msgmsg "Testcase: pdiff patch bigger than index itself: $*"
314 rm -rf rootdir/var/lib/apt/lists
315 cp -a rootdir/var/lib/apt/lists-bak rootdir/var/lib/apt/lists
ef3c549e
DK
316 # the general testcode checks for leftovers in partial, but as this file
317 # is never touched in this test as it exits earlier its not a leftover…
318 rm -f rootdir/var/lib/apt/lists/partial/localhost:${APTHTTPPORT}_Packages
3abb6a6a 319 cp "${PKGFILE}-new" aptarchive/Packages
c355ea30
DK
320 compressfile 'aptarchive/Packages'
321 mkdir -p aptarchive/Packages.diff
322 PATCHFILE="aptarchive/Packages.diff/$(date +%Y-%m-%d-%H%M.%S)"
3abb6a6a
DK
323 diff -e "${PKGFILE}" "${PKGFILE}-new" > "${PATCHFILE}" || true
324 cat "$PATCHFILE" | gzip > "${PATCHFILE}.gz"
c355ea30 325 PATCHINDEX='aptarchive/Packages.diff/Index'
8d0d9255 326 echo "SHA256-Current: $(sha256sum "${PKGFILE}-new" | cut -d' ' -f 1) $(stat -c%s "${PKGFILE}-new")
c355ea30
DK
327SHA256-History:
328 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b 33053002 2010-08-18-2013.28
3abb6a6a 329 $(sha256sum "$PKGFILE" | cut -d' ' -f 1) $(stat -c%s "$PKGFILE") $(basename "$PATCHFILE")
c355ea30
DK
330SHA256-Patches:
331 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 19722 2010-08-18-2013.28
4a808dea
DK
332 $(sha256sum "$PATCHFILE" | cut -d' ' -f 1) $(stat -c%s "$PATCHFILE") $(basename "$PATCHFILE")
333SHA256-Download:
4f51fd86 334 d2a1b33187ed2d248eeae3b1223ea71791ea35f2138a713ed371332a6421f467 197 2010-08-18-2013.28.gz
4a808dea 335 $(sha256sum "${PATCHFILE}.gz" | cut -d' ' -f 1) $(stat -c%s "${PATCHFILE}.gz")000 $(basename "${PATCHFILE}.gz")" > "$PATCHINDEX"
c355ea30
DK
336 generatereleasefiles '+1hour'
337 signreleasefiles
0e071dfe 338 wasmergeused "$@" -o test::cannot-use-pdiff=1
4e3c5633 339 testsuccess grep 'bytes (Limit is' rootdir/tmp/aptupdate.output
c355ea30 340 testnopackage oldstuff
3abb6a6a 341 testsuccessequal "$(cat "${PKGFILE}-new")
c355ea30 342" aptcache show apt newstuff
47d2bc78 343}
34d6ece7 344echo 'Debug::pkgAcquire::Diffs "true";
03bfbc96 345Debug::Acquire::Transaction "true";
742f67ea
DK
346Debug::pkgAcquire::Worker "true";
347Debug::Acquire::http "true";
348Debug::pkgAcquire "true";
30060442 349Debug::Acquire::rred "true";' > rootdir/etc/apt/apt.conf.d/rreddebug.conf
47d2bc78 350
d7a51997 351testcase() {
d7a51997
DK
352 testrun -o Acquire::PDiffs::Merge=0 -o APT::Get::List-Cleanup=1 "$@"
353 testrun -o Acquire::PDiffs::Merge=1 -o APT::Get::List-Cleanup=1 "$@"
354 testrun -o Acquire::PDiffs::Merge=0 -o APT::Get::List-Cleanup=0 "$@"
355 testrun -o Acquire::PDiffs::Merge=1 -o APT::Get::List-Cleanup=0 "$@"
f6d4ab9a 356}
0e071dfe
DK
357generatepartialleftovers() {
358 for f in "$@"; do
359 cat "${PKGFILE}" "${PKGFILE}" > "rootdir/var/lib/apt/lists-bak/partial/localhost:${APTHTTPPORT}_${f}"
360 printf '\n\nInvalid\nStanza: yes\n\n' >> "rootdir/var/lib/apt/lists-bak/partial/localhost:${APTHTTPPORT}_${f}"
361 done
362}
363
364partialleftovers() { generatepartialleftovers 'Packages' 'Packages-patched'; }
4e3c5633
DK
365aptautotest_apt_update() { aptautotest_aptget_update "$@"; testsuccess test -e "rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_Packages"; }
366testcase -o Acquire::IndexTargets::deb::Packages::KeepCompressed=false
0e071dfe 367partialleftovers() { generatepartialleftovers "Packages.${LOWCOSTEXT}" "Packages-patched.${LOWCOSTEXT}"; }
0179cfa8 368aptautotest_apt_update() { aptautotest_aptget_update "$@"; testsuccess test -e "rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_Packages.$LOWCOSTEXT"; }
4e3c5633 369testcase -o Acquire::IndexTargets::deb::Packages::KeepCompressed=true
b7a1076f
DK
370
371
0e071dfe 372partialleftovers() { generatepartialleftovers "redirectme_Packages.${LOWCOSTEXT}" "redirectme_Packages-patched.${LOWCOSTEXT}"; }
b7a1076f
DK
373webserverconfig 'aptwebserver::redirect::replace::/redirectme/' "http://0.0.0.0:${APTHTTPPORT}/"
374rewritesourceslist "http://localhost:${APTHTTPPORT}/redirectme"
375aptautotest_apt_update() {
376 aptautotest_aptget_update "$@"
377 testsuccess test -e "rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_redirectme_Packages.$LOWCOSTEXT"
378 testempty find rootdir/var/lib/apt/lists -type f \! \( -name lock -o -name '*_redirectme_*' \)
379}
380testcase -o Acquire::IndexTargets::deb::Packages::KeepCompressed=true