test-pdiff-usage 17 KB

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