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