]>
Commit | Line | Data |
---|---|---|
1 | #!/bin/sh | |
2 | set -e | |
3 | ||
4 | TESTDIR=$(readlink -f $(dirname $0)) | |
5 | . $TESTDIR/framework | |
6 | setupenvironment | |
7 | configarchitecture 'amd64' | |
8 | ||
9 | insertpackage 'unstable' 'unrelated' 'all' '0.5~squeeze1' | |
10 | insertsource 'unstable' 'unrelated' 'all' '0.5~squeeze1' | |
11 | ||
12 | setupaptarchive --no-update | |
13 | changetowebserver | |
14 | ||
15 | runtest() { | |
16 | if [ -n "$1" ]; then | |
17 | configallowinsecurerepositories 'true' | |
18 | else | |
19 | configallowinsecurerepositories 'false' | |
20 | fi | |
21 | ||
22 | rm -rf rootdir/var/lib/apt/lists/ | |
23 | ||
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 | |
28 | "test${2:-success}" aptget update -o Acquire::Min-ValidTime=99999999999 | |
29 | fi | |
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 | |
34 | ||
35 | # ensure no leftovers in partial | |
36 | testfailure ls 'rootdir/var/lib/apt/lists/partial/*' | |
37 | ||
38 | # check that I-M-S header is kept in redirections | |
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 | |
46 | if grep -q '^Hit .* \(InRelease\|Release.gpg\)$' expected.output ; then | |
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 | |
52 | ||
53 | # ensure no leftovers in partial | |
54 | testfailure ls 'rootdir/var/lib/apt/lists/partial/*' | |
55 | } | |
56 | ||
57 | msgmsg 'InRelease' | |
58 | EXPECT='Hit http://localhost:8080 unstable InRelease | |
59 | Reading package lists...' | |
60 | echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex | |
61 | runtest | |
62 | echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex | |
63 | runtest | |
64 | ||
65 | msgmsg 'Release/Release.gpg' | |
66 | EXPECT='Ign http://localhost:8080 unstable InRelease | |
67 | 404 Not Found | |
68 | Hit http://localhost:8080 unstable Release | |
69 | Hit http://localhost:8080 unstable Release.gpg | |
70 | Reading package lists...' | |
71 | find aptarchive -name 'InRelease' -delete | |
72 | echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex | |
73 | runtest | |
74 | echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex | |
75 | runtest | |
76 | ||
77 | msgmsg 'Release only' | |
78 | EXPECT="Ign http://localhost:8080 unstable InRelease | |
79 | 404 Not Found | |
80 | Hit http://localhost:8080 unstable Release | |
81 | Ign http://localhost:8080 unstable Release.gpg | |
82 | 404 Not Found | |
83 | Reading package lists... | |
84 | W: The data from 'http://localhost:8080 unstable Release.gpg' is not signed. Packages from that repository can not be authenticated." | |
85 | find aptarchive -name 'Release.gpg' -delete | |
86 | echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex | |
87 | runtest 'warning' | |
88 | echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex | |
89 | runtest 'warning' | |
90 | ||
91 | ||
92 | # make the release file old | |
93 | find aptarchive -name '*Release' -exec sed -i \ | |
94 | -e "s#^Date: .*\$#Date: $(date -d '-2 weeks' '+%a, %d %b %Y %H:%M:%S %Z')#" \ | |
95 | -e '/^Valid-Until: / d' -e "/^Date: / a\ | |
96 | Valid-Until: $(date -d '-1 weeks' '+%a, %d %b %Y %H:%M:%S %Z')" '{}' \; | |
97 | signreleasefiles | |
98 | ||
99 | msgmsg 'expired InRelease' | |
100 | EXPECT='Hit http://localhost:8080 unstable InRelease | |
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' | |
108 | EXPECT='Ign http://localhost:8080 unstable InRelease | |
109 | 404 Not Found | |
110 | Hit http://localhost:8080 unstable Release | |
111 | Hit http://localhost:8080 unstable Release.gpg | |
112 | E: Release file for http://localhost:8080/dists/unstable/Release.gpg is expired (invalid since). Updates for this repository will not be applied.' | |
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' | |
118 | ||
119 | msgmsg 'expired Release only' | |
120 | EXPECT="Ign http://localhost:8080 unstable InRelease | |
121 | 404 Not Found | |
122 | Hit http://localhost:8080 unstable Release | |
123 | Ign http://localhost:8080 unstable Release.gpg | |
124 | 404 Not Found | |
125 | W: The data from 'http://localhost:8080 unstable Release.gpg' is not signed. Packages from that repository can not be authenticated. | |
126 | E: Release file for http://localhost:8080/dists/unstable/InRelease is expired (invalid since). Updates for this repository will not be applied." | |
127 | find aptarchive -name 'Release.gpg' -delete | |
128 | echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex | |
129 | runtest 'failure' 'warning' | |
130 | echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex | |
131 | runtest 'failure' 'warning' | |
132 | ||
133 | ||
134 | msgmsg 'no Release at all' | |
135 | EXPECT="Ign http://localhost:8080 unstable InRelease | |
136 | 404 Not Found | |
137 | Ign http://localhost:8080 unstable Release | |
138 | 404 Not Found | |
139 | Hit http://localhost:8080 unstable/main Sources | |
140 | Hit http://localhost:8080 unstable/main amd64 Packages | |
141 | Hit http://localhost:8080 unstable/main Translation-en | |
142 | Reading package lists... | |
143 | W: The repository 'http://localhost:8080 unstable Release' does not have a Release file. This is deprecated, please contact the owner of the repository." | |
144 | find aptarchive -name '*Release*' -delete | |
145 | echo 'Acquire::GzipIndexes "0"; | |
146 | Acquire::PDiffs "0";' > rootdir/etc/apt/apt.conf.d/02compressindex | |
147 | runtest 'warning' | |
148 | echo 'Acquire::GzipIndexes "1"; | |
149 | Acquire::PDiffs "0";' > rootdir/etc/apt/apt.conf.d/02compressindex | |
150 | runtest 'warning' |