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