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