]>
Commit | Line | Data |
---|---|---|
63d0f853 MV |
1 | #!/bin/sh |
2 | set -e | |
3 | ||
4 | TESTDIR=$(readlink -f $(dirname $0)) | |
5 | . $TESTDIR/framework | |
6 | setupenvironment | |
7 | configarchitecture 'amd64' | |
8 | ||
ba6b79bd | 9 | insertpackage 'unstable' 'unrelated' 'all' '0.5~squeeze1' |
1dd20368 | 10 | insertpackage 'unstable' 'unrelated2' 'amd64' '0.5~squeeze1' |
ba6b79bd | 11 | insertsource 'unstable' 'unrelated' 'all' '0.5~squeeze1' |
63d0f853 | 12 | |
846bc058 | 13 | setupaptarchive --no-update |
63d0f853 MV |
14 | changetowebserver |
15 | ||
47450dea | 16 | runtest() { |
995a4bf6 | 17 | local APTOPT="" |
ba6b79bd | 18 | if [ -n "$1" ]; then |
995a4bf6 | 19 | APTOPT='--allow-insecure-repositories' |
ba6b79bd | 20 | else |
995a4bf6 | 21 | APTOPT='--no-allow-insecure-repositories' |
ba6b79bd | 22 | fi |
4fa34122 | 23 | |
ba6b79bd | 24 | rm -rf rootdir/var/lib/apt/lists/ |
63d0f853 | 25 | |
ba6b79bd | 26 | local TEST="test${1:-success}" |
995a4bf6 | 27 | $TEST aptget update $APTOPT |
ba6b79bd DK |
28 | if [ "$1" = 'failure' ]; then |
29 | # accept the outdated Release file so we can check Hit behaviour | |
995a4bf6 | 30 | "test${2:-success}" aptget update -o Acquire::Min-ValidTime=9999999 $APTOPT |
4fa34122 | 31 | fi |
ba6b79bd DK |
32 | listcurrentlistsdirectory > listsdir.lst |
33 | testsuccess grep '_Packages\(\.gz\)\?$' listsdir.lst | |
34 | testsuccess grep '_Sources\(\.gz\)\?$' listsdir.lst | |
35 | testsuccess grep '_Translation-en\(\.gz\)\?$' listsdir.lst | |
47450dea MV |
36 | |
37 | # ensure no leftovers in partial | |
ba6b79bd | 38 | testfailure ls 'rootdir/var/lib/apt/lists/partial/*' |
47450dea MV |
39 | |
40 | # check that I-M-S header is kept in redirections | |
ba6b79bd | 41 | echo "$EXPECT" | sed -e 's#(invalid since [^)]\+)#(invalid since)#' > expected.output |
87d6947d | 42 | $TEST aptget update -o Debug::pkgAcquire::Worker=0 -o Debug::Acquire::http=0 $APTOPT |
ba6b79bd DK |
43 | sed -i -e 's#(invalid since [^)]\+)#(invalid since)#' rootdir/tmp/${TEST}.output |
44 | testequal "$(cat expected.output)" cat rootdir/tmp/${TEST}.output | |
45 | testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)" | |
46 | ||
47 | # ensure that we still do a hash check for other files on ims hit of Release | |
1eb1836f | 48 | if grep -q '^Hit:[0-9]\+ .* InRelease$' expected.output || ! grep -q '^Ign:[0-9]\+ .* Release\(\.gpg\)\?$' expected.output; then |
995a4bf6 | 49 | $TEST aptget update -o Debug::Acquire::gpgv=1 $APTOPT |
ba6b79bd DK |
50 | cp rootdir/tmp/${TEST}.output goodsign.output |
51 | testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)" | |
52 | testsuccess grep '^Got GOODSIG, key ID:GOODSIG' goodsign.output | |
53 | fi | |
47450dea MV |
54 | |
55 | # ensure no leftovers in partial | |
ba6b79bd | 56 | testfailure ls 'rootdir/var/lib/apt/lists/partial/*' |
47450dea MV |
57 | } |
58 | ||
ba6b79bd | 59 | msgmsg 'InRelease' |
6c0765c0 DK |
60 | EXPECT="Hit:1 http://localhost:${APTHTTPPORT} unstable InRelease |
61 | Reading package lists..." | |
ba6b79bd | 62 | echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex |
1ce24318 | 63 | runtest |
ba6b79bd | 64 | echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex |
1ce24318 MV |
65 | runtest |
66 | ||
ba6b79bd | 67 | msgmsg 'Release/Release.gpg' |
6c0765c0 | 68 | EXPECT="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease |
4dbfe436 | 69 | 404 Not Found |
6c0765c0 DK |
70 | Hit:2 http://localhost:${APTHTTPPORT} unstable Release |
71 | Reading package lists..." | |
ab25bf1f | 72 | find aptarchive -name 'InRelease' -delete |
ba6b79bd | 73 | echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex |
47450dea | 74 | runtest |
ba6b79bd | 75 | echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex |
47450dea | 76 | runtest |
f3097647 | 77 | |
ba6b79bd | 78 | msgmsg 'Release only' |
6c0765c0 | 79 | EXPECT="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease |
4dbfe436 | 80 | 404 Not Found |
6c0765c0 DK |
81 | Hit:2 http://localhost:${APTHTTPPORT} unstable Release |
82 | Ign:3 http://localhost:${APTHTTPPORT} unstable Release.gpg | |
4dbfe436 | 83 | 404 Not Found |
9d653a6d | 84 | Reading package lists... |
f18f2338 | 85 | W: The repository 'http://localhost:${APTHTTPPORT} unstable Release' is not signed. |
d04e44ac | 86 | N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use. |
002b1bc4 | 87 | N: See apt-secure(8) manpage for repository creation and user configuration details." |
ba6b79bd DK |
88 | find aptarchive -name 'Release.gpg' -delete |
89 | echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex | |
90 | runtest 'warning' | |
91 | echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex | |
92 | runtest 'warning' | |
93 | ||
94 | ||
95 | # make the release file old | |
96 | find aptarchive -name '*Release' -exec sed -i \ | |
97 | -e "s#^Date: .*\$#Date: $(date -d '-2 weeks' '+%a, %d %b %Y %H:%M:%S %Z')#" \ | |
98 | -e '/^Valid-Until: / d' -e "/^Date: / a\ | |
99 | Valid-Until: $(date -d '-1 weeks' '+%a, %d %b %Y %H:%M:%S %Z')" '{}' \; | |
100 | signreleasefiles | |
101 | ||
102 | msgmsg 'expired InRelease' | |
6c0765c0 | 103 | EXPECT="Hit:1 http://localhost:${APTHTTPPORT} unstable InRelease |
95278287 | 104 | Reading package lists... |
6c0765c0 | 105 | E: Release file for http://localhost:${APTHTTPPORT}/dists/unstable/InRelease is expired (invalid since). Updates for this repository will not be applied." |
ba6b79bd DK |
106 | echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex |
107 | runtest 'failure' | |
108 | echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex | |
109 | runtest 'failure' | |
110 | ||
111 | msgmsg 'expired Release/Release.gpg' | |
6c0765c0 | 112 | EXPECT="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease |
ba6b79bd | 113 | 404 Not Found |
6c0765c0 | 114 | Hit:2 http://localhost:${APTHTTPPORT} unstable Release |
95278287 | 115 | Reading package lists... |
6c0765c0 | 116 | E: Release file for http://localhost:${APTHTTPPORT}/dists/unstable/Release is expired (invalid since). Updates for this repository will not be applied." |
ba6b79bd DK |
117 | find aptarchive -name 'InRelease' -delete |
118 | echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex | |
119 | runtest 'failure' | |
120 | echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex | |
121 | runtest 'failure' | |
f3097647 | 122 | |
ba6b79bd | 123 | msgmsg 'expired Release only' |
6c0765c0 | 124 | EXPECT="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease |
ba6b79bd | 125 | 404 Not Found |
6c0765c0 DK |
126 | Hit:2 http://localhost:${APTHTTPPORT} unstable Release |
127 | Ign:3 http://localhost:${APTHTTPPORT} unstable Release.gpg | |
ba6b79bd | 128 | 404 Not Found |
95278287 | 129 | Reading package lists... |
f18f2338 | 130 | W: The repository 'http://localhost:${APTHTTPPORT} unstable Release' is not signed. |
d04e44ac | 131 | N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use. |
002b1bc4 | 132 | N: See apt-secure(8) manpage for repository creation and user configuration details. |
6c0765c0 | 133 | E: Release file for http://localhost:${APTHTTPPORT}/dists/unstable/Release is expired (invalid since). Updates for this repository will not be applied." |
ab25bf1f | 134 | find aptarchive -name 'Release.gpg' -delete |
ba6b79bd DK |
135 | echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex |
136 | runtest 'failure' 'warning' | |
137 | echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex | |
138 | runtest 'failure' 'warning' | |
f3097647 | 139 | |
f3097647 | 140 | |
ba6b79bd | 141 | msgmsg 'no Release at all' |
6c0765c0 | 142 | EXPECT="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease |
ba6b79bd | 143 | 404 Not Found |
6c0765c0 | 144 | Ign:2 http://localhost:${APTHTTPPORT} unstable Release |
ba6b79bd | 145 | 404 Not Found |
6c0765c0 | 146 | Ign:3 http://localhost:${APTHTTPPORT} unstable/main Sources |
9d2a8a73 | 147 | 404 Not Found |
6c0765c0 | 148 | Ign:4 http://localhost:${APTHTTPPORT} unstable/main amd64 Packages |
9d2a8a73 | 149 | 404 Not Found |
1dd20368 DK |
150 | Ign:5 http://localhost:${APTHTTPPORT} unstable/main all Packages |
151 | 404 Not Found | |
152 | Ign:6 http://localhost:${APTHTTPPORT} unstable/main Translation-en | |
9d2a8a73 | 153 | 404 Not Found |
6c0765c0 | 154 | Ign:3 http://localhost:${APTHTTPPORT} unstable/main Sources |
9d2a8a73 | 155 | 404 Not Found |
6c0765c0 | 156 | Ign:4 http://localhost:${APTHTTPPORT} unstable/main amd64 Packages |
9d2a8a73 | 157 | 404 Not Found |
1dd20368 DK |
158 | Ign:5 http://localhost:${APTHTTPPORT} unstable/main all Packages |
159 | 404 Not Found | |
160 | Ign:6 http://localhost:${APTHTTPPORT} unstable/main Translation-en | |
9d2a8a73 | 161 | 404 Not Found |
6c0765c0 | 162 | Ign:3 http://localhost:${APTHTTPPORT} unstable/main Sources |
9d2a8a73 | 163 | 404 Not Found |
6c0765c0 | 164 | Ign:4 http://localhost:${APTHTTPPORT} unstable/main amd64 Packages |
9d2a8a73 | 165 | 404 Not Found |
1dd20368 DK |
166 | Ign:5 http://localhost:${APTHTTPPORT} unstable/main all Packages |
167 | 404 Not Found | |
168 | Ign:6 http://localhost:${APTHTTPPORT} unstable/main Translation-en | |
9d2a8a73 | 169 | 404 Not Found |
6c0765c0 DK |
170 | Hit:3 http://localhost:${APTHTTPPORT} unstable/main Sources |
171 | Hit:4 http://localhost:${APTHTTPPORT} unstable/main amd64 Packages | |
1dd20368 DK |
172 | Hit:5 http://localhost:${APTHTTPPORT} unstable/main all Packages |
173 | Hit:6 http://localhost:${APTHTTPPORT} unstable/main Translation-en | |
ba6b79bd | 174 | Reading package lists... |
f18f2338 | 175 | W: The repository 'http://localhost:${APTHTTPPORT} unstable Release' does not have a Release file. |
d04e44ac | 176 | N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use. |
002b1bc4 | 177 | N: See apt-secure(8) manpage for repository creation and user configuration details." |
ba6b79bd DK |
178 | find aptarchive -name '*Release*' -delete |
179 | echo 'Acquire::GzipIndexes "0"; | |
180 | Acquire::PDiffs "0";' > rootdir/etc/apt/apt.conf.d/02compressindex | |
181 | runtest 'warning' | |
182 | echo 'Acquire::GzipIndexes "1"; | |
183 | Acquire::PDiffs "0";' > rootdir/etc/apt/apt.conf.d/02compressindex | |
184 | runtest 'warning' |