1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
|
set -u
. "$TESTSDIR"/test.inc
# test some corner cases in updating:
# IgnoreInRelease, force, errors, resuming...
mkdir -p conf test/dists/a/c/source test/test lists
echo "test" > test/test/test.dsc
echo "fake-gz-file" > test/test/test.tar.gz
cat >test/dists/a/c/source/Sources <<EOF
Package: test
Version: 7777
Priority: extra
Section: somewhere
Maintainer: noone
Directory: test
Files:
$(mdandsize test/test/test.dsc) test.dsc
$(mdandsize test/test/test.tar.gz) test.tar.gz
EOF
sourcesmd=$(md5 test/dists/a/c/source/Sources)
sourcessize=$(stat -c "%s" test/dists/a/c/source/Sources)
cat > test/dists/a/InRelease <<EOF
Codename: a
MD5Sum:
$sourcesmd $sourcessize c/source/Sources
EOF
lzma test/dists/a/c/source/Sources
cat >conf/distributions <<EOF
Codename: t
Architectures: source
Components: c
Update: u
EOF
cat >conf/updates <<EOF
Name: u
Method: copy:$WORKDIR/test
VerifyRelease: blindtrust
Suite: a
EOF
testrun - -b . update 3<<EOF
stderr
-v6*=aptmethod start 'copy:$WORKDIR/test/dists/a/InRelease'
-v1*=aptmethod got 'copy:$WORKDIR/test/dists/a/InRelease'
*=WARNING: No signature found in ./lists/u_a_InRelease, assuming it is unsigned!
*=aptmethod error receiving 'copy:$WORKDIR/test/dists/a/c/source/Sources':
='Failed to stat - stat (2 No such file or directory)'
='Failed to stat - stat (2: No such file or directory)'
-v0*=There have been errors!
stdout
$(odb)
returns 255
EOF
cat >>conf/updates <<EOF
DownloadListsAs: .lzma
EOF
testrun - -b . update 3<<EOF
stderr
-v6*=aptmethod start 'copy:$WORKDIR/test/dists/a/InRelease'
-v1*=aptmethod got 'copy:$WORKDIR/test/dists/a/InRelease'
*=WARNING: No signature found in ./lists/u_a_InRelease, assuming it is unsigned!
*=Error: './lists/u_a_InRelease' only lists unrequested compressions of 'c/source/Sources'.
*=Try changing your DownloadListsAs to request e.g. '.'.
-v0*=There have been errors!
returns 255
EOF
ed -s conf/updates <<EOF
g/^DownloadListsAs:/s/.lzma/force.gz force.lzma/
w
q
EOF
testrun - -b . update 3<<EOF
stderr
-v6*=aptmethod start 'copy:$WORKDIR/test/dists/a/InRelease'
-v1*=aptmethod got 'copy:$WORKDIR/test/dists/a/InRelease'
*=WARNING: No signature found in ./lists/u_a_InRelease, assuming it is unsigned!
*=aptmethod error receiving 'copy:$WORKDIR/test/dists/a/c/source/Sources.gz':
='Failed to stat - stat (2 No such file or directory)'
='Failed to stat - stat (2: No such file or directory)'
-v6*=aptmethod start 'copy:${WORKDIR}/test/dists/a/c/source/Sources.lzma'
-v1*=aptmethod got 'copy:${WORKDIR}/test/dists/a/c/source/Sources.lzma'
-v2*=Uncompress './lists/u_a_c_Sources.lzma' into './lists/u_a_c_Sources' using '/usr/bin/unlzma'...
stdout
-v0*=Calculating packages to get...
-v3*= processing updates for 't|c|source'
-v5*= reading './lists/u_a_c_Sources'
-v2*=Created directory "./pool"
-v2*=Created directory "./pool/c"
-v2*=Created directory "./pool/c/t"
-v2*=Created directory "./pool/c/t/test"
stderr
-v6*=aptmethod start 'copy:${WORKDIR}/test/test/test.dsc'
-v1*=aptmethod got 'copy:${WORKDIR}/test/test/test.dsc'
-v6*=aptmethod start 'copy:${WORKDIR}/test/test/test.tar.gz'
-v1*=aptmethod got 'copy:${WORKDIR}/test/test/test.tar.gz'
stdout
-v0*=Getting packages...
$(ofa 'pool/c/t/test/test.dsc')
$(ofa 'pool/c/t/test/test.tar.gz')
-v1*=Shutting down aptmethods...
-v0*=Installing (and possibly deleting) packages...
$(opa 'test' x 't' 'c' 'source' 'dsc')
-v0*=Exporting indices...
-v2*=Created directory "./dists"
-v2*=Created directory "./dists/t"
-v2*=Created directory "./dists/t/c"
-v2*=Created directory "./dists/t/c/source"
-v6*= looking for changes in 't|c|source'...
-v6*= creating './dists/t/c/source/Sources' (gzipped)
EOF
# test what happens if some compression is forces (i.e. not listed
# in the InRelease file), but the downloaded file is not correct:
ed -s test/dists/a/InRelease <<EOF
,s/^ [^ ]*/ 00000000000000000000000000000000/
w
q
EOF
testrun - -b . update 3<<EOF
stderr
-v6*=aptmethod start 'copy:$WORKDIR/test/dists/a/InRelease'
-v1*=aptmethod got 'copy:$WORKDIR/test/dists/a/InRelease'
*=WARNING: No signature found in ./lists/u_a_InRelease, assuming it is unsigned!
*=aptmethod error receiving 'copy:$WORKDIR/test/dists/a/c/source/Sources.gz':
='Failed to stat - stat (2 No such file or directory)'
='Failed to stat - stat (2: No such file or directory)'
-v6*=aptmethod start 'copy:${WORKDIR}/test/dists/a/c/source/Sources.lzma'
-v1*=aptmethod got 'copy:${WORKDIR}/test/dists/a/c/source/Sources.lzma'
-v2*=Uncompress './lists/u_a_c_Sources.lzma' into './lists/u_a_c_Sources' using '/usr/bin/unlzma'...
*=Wrong checksum of uncompressed content of './lists/u_a_c_Sources.lzma':
*=md5 expected: 00000000000000000000000000000000, got: $sourcesmd
-v0*=There have been errors!
returns 254
EOF
rm test/dists/a/InRelease
testrun - -b . update 3<<EOF
stderr
*=aptmethod error receiving 'copy:$WORKDIR/test/dists/a/InRelease':
*=aptmethod error receiving 'copy:$WORKDIR/test/dists/a/Release':
='Failed to stat - stat (2 No such file or directory)'
='Failed to stat - stat (2: No such file or directory)'
-v0*=There have been errors!
returns 255
EOF
echo "IgnoreRelease: Yes" >> conf/updates
testrun - -b . update 3<<EOF
stderr
*=aptmethod error receiving 'copy:$WORKDIR/test/dists/a/c/source/Sources.gz':
='Failed to stat - stat (2 No such file or directory)'
='Failed to stat - stat (2: No such file or directory)'
-v6*=aptmethod start 'copy:${WORKDIR}/test/dists/a/c/source/Sources.lzma'
-v1*=aptmethod got 'copy:${WORKDIR}/test/dists/a/c/source/Sources.lzma'
-v2*=Uncompress './lists/u_a_c_Sources.lzma' into './lists/u_a_c_Sources' using '/usr/bin/unlzma'...
stdout
-v0*=Calculating packages to get...
-v3*= processing updates for 't|c|source'
-v5*= reading './lists/u_a_c_Sources'
EOF
rm -r conf db test lists pool dists
testsuccess
|