4 TESTDIR
="$(readlink -f "$(dirname "$0")")"
8 configarchitecture 'i386'
9 confighashes 'SHA1' 'SHA256'
13 changetowebserver -o aptwebserver::support::modified-since=false
15 PKGFILE="${TESTDIR}/$(echo "$(basename $0)" | sed 's#^test-#Packages-#')"
18 testsuccess aptget update
"$@"
20 msgtest
'No intermediate patch files' 'still exist'
21 local EDS
="$(find rootdir/var/lib/apt/lists -name '*.ed' -o -name '*.ed.*')"
22 if [ -z "$EDS" ]; then
30 msgtest
'Check if the right pdiff merger was used'
31 if grep -q '^pkgAcqIndexMergeDiffs::Done(): rred' rootdir
/tmp
/testsuccess.output
; then
32 if echo "$*" | grep -q -- '-o Acquire::PDiffs::Merge=1'; then
35 msgfail
"Merge shouldn't have been used, but was"
37 elif echo "$*" | grep -q -- '-o Acquire::PDiffs::Merge=1'; then
38 msgfail
"Merge should have been used, but wasn't"
45 msgmsg
"Testcase: setup the base with: $*"
46 local DOWNLOADHASH
=true
47 if [ "$1" = 'nohash' ]; then DOWNLOADHASH
=false
; shift; fi
48 find aptarchive
-name 'Packages*' -type f
-delete
49 cp "${PKGFILE}" aptarchive
/Packages
50 compressfile
'aptarchive/Packages'
53 rm -rf aptarchive
/Packages.
diff rootdir
/var
/lib
/apt
/lists rootdir
/var
/lib
/apt
/lists
-bak
54 testsuccess aptget update
"$@"
55 cp -a rootdir
/var
/lib
/apt
/lists rootdir
/var
/lib
/apt
/lists
-bak
56 testnopackage newstuff
57 testsuccessequal
"$(cat "${PKGFILE}")
58 " aptcache show apt oldstuff
60 msgmsg
"Testcase: apply with one patch: $*"
61 cp "${PKGFILE}-new" aptarchive
/Packages
62 compressfile
'aptarchive/Packages'
63 mkdir -p aptarchive
/Packages.
diff
64 PATCHFILE
="aptarchive/Packages.diff/$(date +%Y-%m-%d-%H%M.%S)"
65 diff -e "${PKGFILE}" "${PKGFILE}-new" > "${PATCHFILE}" || true
66 cat "$PATCHFILE" | gzip > "${PATCHFILE}.gz"
67 PATCHINDEX
='aptarchive/Packages.diff/Index'
68 echo "SHA1-Current: $(sha1sum "${PKGFILE}-new" | cut -d' ' -f 1) $(stat -c%s "${PKGFILE}-new")
70 9f4148e06d7faa37062994ff10d0c842d7017513 33053002 2010-08-18-2013.28
71 $(sha1sum "$PKGFILE" | cut -d' ' -f 1) $(stat -c%s "$PKGFILE") $(basename "$PATCHFILE")
73 7651fc0ac57cd83d41c63195a9342e2db5650257 19722 2010-08-18-2013.28
74 $(sha1sum "$PATCHFILE" | cut -d' ' -f 1) $(stat -c%s "$PATCHFILE") $(basename "$PATCHFILE")
75 SHA256-Current: $(sha256sum "${PKGFILE}-new" | cut -d' ' -f 1) $(stat -c%s "${PKGFILE}-new")
77 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b 33053002 2010-08-18-2013.28
78 $(sha256sum "$PKGFILE" | cut -d' ' -f 1) $(stat -c%s "$PKGFILE") $(basename "$PATCHFILE")
80 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 19722 2010-08-18-2013.28
81 $(sha256sum "$PATCHFILE" | cut -d' ' -f 1) $(stat -c%s "$PATCHFILE") $(basename "$PATCHFILE")" > "$PATCHINDEX"
82 if $DOWNLOADHASH; then
84 2365ac0ac57cde3d43c63145e8251a3bd5410213 197 2010-08-18-2013.28.gz
85 $(sha1sum "${PATCHFILE}.gz" | cut -d' ' -f 1) $(stat -c%s "${PATCHFILE}.gz") $(basename "${PATCHFILE}.gz")
87 d2a1b33187ed2d248eeae3b1223ea71791ea35f2138a713ed371332a6421f467 197 2010-08-18-2013.28.gz
88 $(sha256sum "${PATCHFILE}.gz" | cut -d' ' -f 1) $(stat -c%s "${PATCHFILE}.gz") $(basename "${PATCHFILE}.gz")" >> "$PATCHINDEX"
91 generatereleasefiles
'+1hour'
93 find aptarchive
-name 'Packages*' -type f
-delete
95 testnopackage oldstuff
96 testsuccessequal
"$(cat "${PKGFILE}-new")
97 " aptcache show apt newstuff
99 msgmsg
"Testcase: apply with two patches: $*"
100 cp "${PKGFILE}-new" aptarchive
/Packages
105 Maintainer: Joe Sixpack <joe@example.org>
107 Filename: pool/futurestuff_1.0_i386.deb
109 MD5sum: 311aeeaaae5ba33aff1ceaf3e1f76671
110 SHA1: 3c695e028f7a1ae324deeaae5ba332desa81088c
111 SHA256: b46fd154615edaae5ba33c56a5cc0e7deaef23e2da3e4f129727fd660f28f050
112 Description: some cool and shiny future stuff
113 This package will appear in the next next mirror update
114 Description-md5: d5f89fbbc2ce34c455dfee9b67d82b6b' >> aptarchive
/Packages
116 compressfile
'aptarchive/Packages'
117 PATCHFILE2
="aptarchive/Packages.diff/$(date -d 'now + 1hour' '+%Y-%m-%d-%H%M.%S')"
118 diff -e "${PKGFILE}-new" aptarchive
/Packages
> "${PATCHFILE2}" || true
119 cat "$PATCHFILE2" | gzip > "${PATCHFILE2}.gz"
120 echo "SHA1-Current: $(sha1sum aptarchive/Packages | cut -d' ' -f 1) $(stat -c%s aptarchive/Packages)
122 9f4148e06d7faa37062994ff10d0c842d7017513 33053002 2010-08-18-2013.28
123 $(sha1sum "${PKGFILE}" | cut -d' ' -f 1) $(stat -c%s "${PKGFILE}") $(basename "${PATCHFILE}")
124 $(sha1sum "${PKGFILE}-new" | cut -d' ' -f 1) $(stat -c%s "${PKGFILE}-new") $(basename "${PATCHFILE2}")
126 7651fc0ac57cd83d41c63195a9342e2db5650257 19722 2010-08-18-2013.28
127 $(sha1sum "$PATCHFILE" | cut -d' ' -f 1) $(stat -c%s "$PATCHFILE") $(basename "$PATCHFILE")
128 $(sha1sum "${PATCHFILE2}" | cut -d' ' -f 1) $(stat -c%s "${PATCHFILE2}") $(basename "${PATCHFILE2}")
129 SHA256-Current: $(sha256sum aptarchive/Packages | cut -d' ' -f 1) $(stat -c%s aptarchive/Packages)
131 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b 33053002 2010-08-18-2013.28
132 $(sha256sum "$PKGFILE" | cut -d' ' -f 1) $(stat -c%s "$PKGFILE") $(basename "$PATCHFILE")
133 $(sha256sum "${PKGFILE}-new" | cut -d' ' -f 1) $(stat -c%s "${PKGFILE}-new") $(basename "${PATCHFILE2}")
135 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 19722 2010-08-18-2013.28
136 $(sha256sum "$PATCHFILE" | cut -d' ' -f 1) $(stat -c%s "$PATCHFILE") $(basename "$PATCHFILE")
137 $(sha256sum "${PATCHFILE2}" | cut -d' ' -f 1) $(stat -c%s "${PATCHFILE2}") $(basename "${PATCHFILE2}")" > "$PATCHINDEX"
138 if $DOWNLOADHASH; then
140 2365ac0ac57cde3d43c63145e8251a3bd5410213 197 2010-08-18-2013.28.gz
141 $(sha1sum "${PATCHFILE}.gz" | cut -d' ' -f 1) $(stat -c%s "${PATCHFILE}.gz") $(basename "${PATCHFILE}.gz")
142 $(sha1sum "${PATCHFILE2}.gz" | cut -d' ' -f 1) $(stat -c%s "${PATCHFILE2}.gz") $(basename "${PATCHFILE2}.gz")
144 d2a1b33187ed2d248eeae3b1223ea71791ea35f2138a713ed371332a6421f467 197 2010-08-18-2013.28.gz
145 $(sha256sum "${PATCHFILE}.gz" | cut -d' ' -f 1) $(stat -c%s "${PATCHFILE}.gz") $(basename "${PATCHFILE}.gz")
146 $(sha256sum "${PATCHFILE2}.gz" | cut -d' ' -f 1) $(stat -c%s "${PATCHFILE2}.gz") $(basename "${PATCHFILE2}.gz")" >> "$PATCHINDEX"
149 generatereleasefiles
'+2hour'
151 cp -a aptarchive
/Packages Packages
-future
152 find aptarchive
-name 'Packages*' -type f
-delete
153 rm -rf rootdir
/var
/lib
/apt
/lists
154 cp -a rootdir
/var
/lib
/apt
/lists
-bak rootdir
/var
/lib
/apt
/lists
156 testnopackage oldstuff
157 testsuccessequal
"$(cat Packages-future)
158 " aptcache show apt newstuff futurestuff
160 msgmsg
"Testcase: patch applying fails, but successful fallback: $*"
161 rm -rf rootdir
/var
/lib
/apt
/lists
162 cp -a rootdir
/var
/lib
/apt
/lists
-bak rootdir
/var
/lib
/apt
/lists
163 cp "${PKGFILE}-new" aptarchive
/Packages
164 compressfile
'aptarchive/Packages'
165 mkdir -p aptarchive
/Packages.
diff
166 PATCHFILE
="aptarchive/Packages.diff/$(date +%Y-%m-%d-%H%M.%S)"
167 diff -e "${PKGFILE}" "${PKGFILE}-new" > "${PATCHFILE}" || true
168 cat "$PATCHFILE" | gzip > "${PATCHFILE}.gz"
169 PATCHINDEX
='aptarchive/Packages.diff/Index'
170 echo "SHA1-Current: $(sha1sum "${PKGFILE}-new" | cut -d' ' -f 1) $(stat -c%s "${PKGFILE}-new")
172 9f4148e06d7faa37062994ff10d0c842d7017513 33053002 2010-08-18-2013.28
173 $(sha1sum "$PKGFILE" | cut -d' ' -f 1) $(stat -c%s "$PKGFILE") $(basename "$PATCHFILE")
175 7651fc0ac57cd83d41c63195a9342e2db5650257 19722 2010-08-18-2013.28
176 $(sha1sum "$PATCHFILE" | cut -d' ' -f 1) $(stat -c%s "$PATCHFILE") $(basename "$PATCHFILE")
177 SHA256-Current: $(sha256sum "${PKGFILE}-new" | cut -d' ' -f 1) $(stat -c%s "${PKGFILE}-new")
179 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b 33053002 2010-08-18-2013.28
180 $(sha256sum "$PKGFILE" | cut -d' ' -f 1) $(stat -c%s "$PKGFILE") $(basename "$PATCHFILE")
182 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 19722 2010-08-18-2013.28
183 $(sha256sum "$PATCHFILE" | cut -d' ' -f 1) $(stat -c%s "$PATCHFILE") $(basename "$PATCHFILE")" > $PATCHINDEX
184 if $DOWNLOADHASH; then
186 2365ac0ac57cde3d43c63145e8251a3bd5410213 197 2010-08-18-2013.28.gz
187 $(sha1sum "${PATCHFILE}.gz" | cut -d' ' -f 1) $(stat -c%s "${PATCHFILE}.gz") $(basename "${PATCHFILE}.gz")
189 d2a1b33187ed2d248eeae3b1223ea71791ea35f2138a713ed371332a6421f467 197 2010-08-18-2013.28.gz
190 $(sha256sum "${PATCHFILE}.gz" | cut -d' ' -f 1) $(stat -c%s "${PATCHFILE}.gz") $(basename "${PATCHFILE}.gz")" >> $PATCHINDEX
192 # needs to look like a valid command, otherwise the parser will fail before hashes are checked
193 echo '1d' > "$PATCHFILE"
194 cat "$PATCHFILE" | gzip > "${PATCHFILE}.gz"
195 generatereleasefiles
'+1hour'
197 testsuccess aptget update
"$@"
198 cp -f rootdir
/tmp
/testsuccess.output rootdir
/tmp
/aptgetupdate.output
199 testsuccess
grep 'Hash Sum mismatch' rootdir
/tmp
/aptgetupdate.output
200 testnopackage oldstuff
201 testsuccessequal
"$(cat "${PKGFILE}-new")
202 " aptcache show apt newstuff
204 msgmsg
"Testcase: pdiff patch bigger than index itself: $*"
205 rm -rf rootdir
/var
/lib
/apt
/lists
206 cp -a rootdir
/var
/lib
/apt
/lists
-bak rootdir
/var
/lib
/apt
/lists
207 cp "${PKGFILE}-new" aptarchive
/Packages
208 compressfile
'aptarchive/Packages'
209 mkdir -p aptarchive
/Packages.
diff
210 PATCHFILE
="aptarchive/Packages.diff/$(date +%Y-%m-%d-%H%M.%S)"
211 diff -e "${PKGFILE}" "${PKGFILE}-new" > "${PATCHFILE}" || true
212 cat "$PATCHFILE" | gzip > "${PATCHFILE}.gz"
213 PATCHINDEX
='aptarchive/Packages.diff/Index'
214 echo "SHA1-Current: $(sha1sum "${PKGFILE}-new" | cut -d' ' -f 1) $(stat -c%s "${PKGFILE}-new")
216 9f4148e06d7faa37062994ff10d0c842d7017513 33053002 2010-08-18-2013.28
217 $(sha1sum "$PKGFILE" | cut -d' ' -f 1) $(stat -c%s "$PKGFILE") $(basename "$PATCHFILE")
219 7651fc0ac57cd83d41c63195a9342e2db5650257 19722 2010-08-18-2013.28
220 $(sha1sum "$PATCHFILE" | cut -d' ' -f 1) $(stat -c%s "$PATCHFILE")000 $(basename "$PATCHFILE")
221 SHA256-Current: $(sha256sum "${PKGFILE}-new" | cut -d' ' -f 1) $(stat -c%s "${PKGFILE}-new")
223 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b 33053002 2010-08-18-2013.28
224 $(sha256sum "$PKGFILE" | cut -d' ' -f 1) $(stat -c%s "$PKGFILE") $(basename "$PATCHFILE")
226 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 19722 2010-08-18-2013.28
227 $(sha256sum "$PATCHFILE" | cut -d' ' -f 1) $(stat -c%s "$PATCHFILE")000 $(basename "$PATCHFILE")" > "$PATCHINDEX"
228 if $DOWNLOADHASH; then
230 2365ac0ac57cde3d43c63145e8251a3bd5410213 197 2010-08-18-2013.28.gz
231 $(sha1sum "${PATCHFILE}.gz" | cut -d' ' -f 1) $(stat -c%s "${PATCHFILE}.gz")000 $(basename "${PATCHFILE}.gz")
233 d2a1b33187ed2d248eeae3b1223ea71791ea35f2138a713ed371332a6421f467 197 2010-08-18-2013.28.gz
234 $(sha256sum "${PATCHFILE}.gz" | cut -d' ' -f 1) $(stat -c%s "${PATCHFILE}.gz")000 $(basename "${PATCHFILE}.gz")" >> "$PATCHINDEX"
236 generatereleasefiles
'+1hour'
238 #find aptarchive -name 'Packages*' -type f -delete
239 testsuccess aptget update
-o Debug
::pkgAcquire
::Diffs
=1 "$@"
240 cp -f rootdir
/tmp
/testsuccess.output rootdir
/tmp
/aptgetupdate.output
241 testsuccess
grep 'bytes (Limit is' rootdir
/tmp
/aptgetupdate.output
242 testnopackage oldstuff
243 testsuccessequal
"$(cat "${PKGFILE}-new")
244 " aptcache show apt newstuff
246 echo 'Debug::pkgAcquire::Diffs "true";
247 Debug::Acquire::Transaction "true";
248 Debug::pkgAcquire::rred "true";' > rootdir
/etc
/apt
/apt.conf.d
/rreddebug.conf
251 testrun nohash
-o Acquire
::PDiffs
::Merge
=0 -o APT
::Get
::List
-Cleanup=1 "$@"
252 testrun nohash
-o Acquire
::PDiffs
::Merge
=1 -o APT
::Get
::List
-Cleanup=1 "$@"
254 testrun
-o Acquire
::PDiffs
::Merge
=0 -o APT
::Get
::List
-Cleanup=1 "$@"
255 testrun
-o Acquire
::PDiffs
::Merge
=1 -o APT
::Get
::List
-Cleanup=1 "$@"
256 testrun
-o Acquire
::PDiffs
::Merge
=0 -o APT
::Get
::List
-Cleanup=0 "$@"
257 testrun
-o Acquire
::PDiffs
::Merge
=1 -o APT
::Get
::List
-Cleanup=0 "$@"
260 echo '01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b -'
262 testrun
-o Acquire
::PDiffs
::Merge
=0 -o Acquire
::ForceHash
=SHA1
"$@"
263 testrun
-o Acquire
::PDiffs
::Merge
=1 -o Acquire
::ForceHash
=SHA1
"$@"
267 echo 'adc83b19e793491b1c6ea0fd8b46cd9f32e592fc -'
269 testrun
-o Acquire
::PDiffs
::Merge
=0 -o Acquire
::ForceHash
=SHA256
"$@"
270 testrun
-o Acquire
::PDiffs
::Merge
=1 -o Acquire
::ForceHash
=SHA256
"$@"
273 testcase
-o Acquire
::GzipIndexes
=0
274 testcase
-o Acquire
::GzipIndexes
=1