4 TESTDIR
=$(readlink -f $(dirname $0))
8 configarchitecture
'i386'
14 PKGFILE
="${TESTDIR}/$(echo "$(basename $0)" | sed 's#^test-#Packages-#')"
18 /usr/bin/diffindex-rred "$@
"' > extrred
20 echo 'Dir::Bin::rred ".
/extrred
";' > rootdir/etc/apt/apt.conf.d/99rred
23 testsuccess aptget update "$@
"
24 msgtest 'Check if the right pdiff merger was used'
25 if [ -e ./merge-was-used ]; then
26 rm -f ./merge-was-used
27 if echo "$
*" | grep -q -- '-o Acquire::PDiffs::Merge=1'; then
30 msgfail "Merge shouldn
't have been used, but was"
32 elif echo "$*" | grep -q -- '-o Acquire
::PDiffs
::Merge
=1'; then
33 msgfail "Merge should have been used, but wasn't
"
41 find aptarchive -name 'Packages*' -type f -delete
42 cp ${PKGFILE} aptarchive/Packages
43 compressfile 'aptarchive/Packages'
46 rm -rf aptarchive/Packages.diff rootdir/var/lib/apt/lists
47 testsuccess aptget update "$@
"
48 cp -a rootdir/var/lib/apt/lists rootdir/var/lib/apt/lists-bak
49 testnopackage newstuff
50 testequal "$(cat ${PKGFILE})
51 " aptcache show apt oldstuff
53 # apply with one patch
54 cp ${PKGFILE}-new aptarchive/Packages
55 compressfile 'aptarchive/Packages'
56 mkdir -p aptarchive/Packages.diff
57 PATCHFILE="aptarchive
/Packages.diff
/$(date +%Y-%m-%d-%H%M.%S)"
58 diff -e ${PKGFILE} ${PKGFILE}-new > ${PATCHFILE} || true
59 cat $PATCHFILE | gzip > ${PATCHFILE}.gz
60 PATCHINDEX='aptarchive/Packages.diff/Index'
61 echo "SHA1
-Current: $(sha1sum ${PKGFILE}-new | cut -d' ' -f 1) $(stat -c%s ${PKGFILE}-new)
63 9f4148e06d7faa37062994ff10d0c842d7017513
33053002 2010-08-18-2013.28
64 $(sha1sum $PKGFILE | cut -d' ' -f 1) $(stat -c%s $PKGFILE) $(basename $PATCHFILE)
66 7651fc0ac57cd83d41c63195a9342e2db5650257
19722 2010-08-18-0814.28
67 $(sha1sum $PATCHFILE | cut -d' ' -f 1) $(stat -c%s $PATCHFILE) $(basename $PATCHFILE)" > $PATCHINDEX
68 generatereleasefiles '+1hour'
70 find aptarchive -name 'Packages*' -type f -delete
72 testnopackage oldstuff
73 testequal "$(cat ${PKGFILE}-new)
74 " aptcache show apt newstuff
76 # index is already up-to-date
77 find rootdir/var/lib/apt/lists -name '*.IndexDiff' -type f -delete
78 testsuccess aptget update "$@
"
79 testequal "$(cat ${PKGFILE}-new)
80 " aptcache show apt newstuff
82 # apply with two patches
83 cp ${PKGFILE}-new aptarchive/Packages
88 Maintainer: Joe Sixpack <joe@example.org>
90 Filename: pool/futurestuff_1.0_i386.deb
92 MD5sum: 311aeeaaae5ba33aff1ceaf3e1f76671
93 SHA1: 3c695e028f7a1ae324deeaae5ba332desa81088c
94 SHA256: b46fd154615edaae5ba33c56a5cc0e7deaef23e2da3e4f129727fd660f28f050
95 Description: some cool and shiny future stuff
96 This package will appear in the next next mirror update
97 Description-md5: d5f89fbbc2ce34c455dfee9b67d82b6b' >> aptarchive/Packages
99 compressfile 'aptarchive/Packages'
100 PATCHFILE2="aptarchive
/Packages.diff
/$(date -d 'now + 1hour' '+%Y-%m-%d-%H%M.%S')"
101 diff -e ${PKGFILE}-new aptarchive/Packages > ${PATCHFILE2} || true
102 cat $PATCHFILE2 | gzip > ${PATCHFILE2}.gz
103 echo "SHA1
-Current: $(sha1sum aptarchive/Packages | cut -d' ' -f 1) $(stat -c%s aptarchive/Packages)
105 9f4148e06d7faa37062994ff10d0c842d7017513
33053002 2010-08-18-2013.28
106 $(sha1sum ${PKGFILE} | cut -d' ' -f 1) $(stat -c%s ${PKGFILE}) $(basename ${PATCHFILE})
107 $(sha1sum ${PKGFILE}-new | cut -d' ' -f 1) $(stat -c%s ${PKGFILE}-new) $(basename ${PATCHFILE2})
109 7651fc0ac57cd83d41c63195a9342e2db5650257
19722 2010-08-18-0814.28
110 $(sha1sum $PATCHFILE | cut -d' ' -f 1) $(stat -c%s $PATCHFILE) $(basename $PATCHFILE)
111 $(sha1sum ${PATCHFILE2} | cut -d' ' -f 1) $(stat -c%s ${PATCHFILE2}) $(basename ${PATCHFILE2})" > $PATCHINDEX
112 generatereleasefiles '+2hour'
114 cp -a aptarchive/Packages Packages-future
115 find aptarchive -name 'Packages*' -type f -delete
116 rm -rf rootdir/var/lib/apt/lists
117 cp -a rootdir/var/lib/apt/lists-bak rootdir/var/lib/apt/lists
119 testnopackage oldstuff
120 testequal "$(cat Packages-future)
121 " aptcache show apt newstuff futurestuff
123 # patch applying fails, but successful fallback
124 rm -rf rootdir/var/lib/apt/lists
125 cp -a rootdir/var/lib/apt/lists-bak rootdir/var/lib/apt/lists
126 cp ${PKGFILE}-new aptarchive/Packages
127 compressfile 'aptarchive/Packages'
128 mkdir -p aptarchive/Packages.diff
129 PATCHFILE="aptarchive
/Packages.diff
/$(date +%Y-%m-%d-%H%M.%S)"
130 diff -e ${PKGFILE} ${PKGFILE}-new > ${PATCHFILE} || true
131 PATCHINDEX='aptarchive/Packages.diff/Index'
132 echo "SHA1
-Current: $(sha1sum ${PKGFILE}-new | cut -d' ' -f 1) $(stat -c%s ${PKGFILE}-new)
134 9f4148e06d7faa37062994ff10d0c842d7017513
33053002 2010-08-18-2013.28
135 $(sha1sum $PKGFILE | cut -d' ' -f 1) $(stat -c%s $PKGFILE) $(basename $PATCHFILE)
137 7651fc0ac57cd83d41c63195a9342e2db5650257
19722 2010-08-18-0814.28
138 $(sha1sum $PATCHFILE | cut -d' ' -f 1) $(stat -c%s $PATCHFILE) $(basename $PATCHFILE)" > $PATCHINDEX
139 echo 'I am Mallory and I change files' >> $PATCHFILE
140 cat $PATCHFILE | gzip > ${PATCHFILE}.gz
141 generatereleasefiles '+1hour'
143 testsuccess aptget update "$@
"
144 testnopackage oldstuff
145 testequal "$(cat ${PKGFILE}-new)
146 " aptcache show apt newstuff
149 testrun -o Debug::pkgAcquire::Diffs=1 -o Debug::pkgAcquire::rred=1 -o Acquire::PDiffs::Merge=0
150 testrun -o Debug::pkgAcquire::Diffs=1 -o Debug::pkgAcquire::rred=1 -o Acquire::PDiffs::Merge=1