]> git.saurik.com Git - apt.git/blob - test/integration/test-apt-update-ims
ignore std::locale exeception on non-existent "" locale
[apt.git] / test / integration / test-apt-update-ims
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 insertpackage 'unstable' 'unrelated2' 'amd64' '0.5~squeeze1'
11 insertsource 'unstable' 'unrelated' 'all' '0.5~squeeze1'
12
13 export APT_DONT_SIGN=""
14 setupaptarchive --no-update
15 changetowebserver
16
17 runtest() {
18 local APTOPT=""
19 if [ -n "$1" ]; then
20 APTOPT='--allow-insecure-repositories'
21 else
22 APTOPT='--no-allow-insecure-repositories'
23 fi
24
25 rm -rf rootdir/var/lib/apt/lists/
26
27 local TEST="test${1:-success}"
28 $TEST aptget update $APTOPT -o Debug::pkgAcquire::Worker=1
29 if [ "$1" = 'failure' ]; then
30 # accept the outdated Release file so we can check Hit behaviour
31 "test${2:-success}" aptget update -o Acquire::Min-ValidTime=9999999 $APTOPT
32 fi
33 listcurrentlistsdirectory > listsdir.lst
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
37
38 # ensure no leftovers in partial
39 testfailure ls 'rootdir/var/lib/apt/lists/partial/*'
40
41 # check that I-M-S header is kept in redirections
42 echo "$EXPECT" | sed -e 's#(invalid since [^)]\+)#(invalid since)#' > expected.output
43 $TEST aptget update -o Debug::pkgAcquire::Worker=0 -o Debug::Acquire::http=0 $APTOPT
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
49 if grep -q '^Hit:[0-9]\+ .* InRelease$' expected.output || ! grep -q '^Ign:[0-9]\+ .* Release\(\.gpg\)\?$' expected.output; then
50 $TEST aptget update -o Debug::Acquire::gpgv=1 $APTOPT
51 cp rootdir/tmp/${TEST}.output goodsign.output
52 testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
53 testsuccess grep '^Got GOODSIG ' goodsign.output
54 fi
55
56 # ensure no leftovers in partial
57 testfailure ls 'rootdir/var/lib/apt/lists/partial/*'
58 }
59
60 msgmsg 'InRelease'
61 EXPECT="Hit:1 http://localhost:${APTHTTPPORT} unstable InRelease
62 Reading package lists..."
63 echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
64 runtest
65 echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex
66 runtest
67
68 msgmsg 'Release/Release.gpg'
69 EXPECT="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease
70 404 Not Found
71 Hit:2 http://localhost:${APTHTTPPORT} unstable Release
72 Reading package lists..."
73 find aptarchive -name 'InRelease' -delete
74 echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
75 runtest
76 echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex
77 runtest
78
79 msgmsg 'Release only'
80 EXPECT="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease
81 404 Not Found
82 Hit:2 http://localhost:${APTHTTPPORT} unstable Release
83 Ign:3 http://localhost:${APTHTTPPORT} unstable Release.gpg
84 404 Not Found
85 Reading package lists...
86 W: The repository 'http://localhost:${APTHTTPPORT} unstable Release' is not signed.
87 N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
88 N: See apt-secure(8) manpage for repository creation and user configuration details."
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 \
98 -e "s#^Date: .*\$#Date: $(date -ud '-2 weeks' '+%a, %d %b %Y %H:%M:%S %Z')#" \
99 -e '/^Valid-Until: / d' -e "/^Date: / a\
100 Valid-Until: $(date -ud '-1 weeks' '+%a, %d %b %Y %H:%M:%S %Z')" '{}' \;
101 signreleasefiles
102
103 msgmsg 'expired InRelease'
104 EXPECT="Hit:1 http://localhost:${APTHTTPPORT} unstable InRelease
105 Reading package lists...
106 E: Release file for http://localhost:${APTHTTPPORT}/dists/unstable/InRelease is expired (invalid since). Updates for this repository will not be applied."
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'
113 EXPECT="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease
114 404 Not Found
115 Hit:2 http://localhost:${APTHTTPPORT} unstable Release
116 Reading package lists...
117 E: Release file for http://localhost:${APTHTTPPORT}/dists/unstable/Release is expired (invalid since). Updates for this repository will not be applied."
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'
123
124 msgmsg 'expired Release only'
125 EXPECT="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease
126 404 Not Found
127 Hit:2 http://localhost:${APTHTTPPORT} unstable Release
128 Ign:3 http://localhost:${APTHTTPPORT} unstable Release.gpg
129 404 Not Found
130 Reading package lists...
131 W: The repository 'http://localhost:${APTHTTPPORT} unstable Release' is not signed.
132 N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
133 N: See apt-secure(8) manpage for repository creation and user configuration details.
134 E: Release file for http://localhost:${APTHTTPPORT}/dists/unstable/Release is expired (invalid since). Updates for this repository will not be applied."
135 find aptarchive -name 'Release.gpg' -delete
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'
140
141
142 msgmsg 'no Release at all'
143 EXPECT="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease
144 404 Not Found
145 Ign:2 http://localhost:${APTHTTPPORT} unstable Release
146 404 Not Found
147 Ign:3 http://localhost:${APTHTTPPORT} unstable/main Sources
148 404 Not Found
149 Ign:4 http://localhost:${APTHTTPPORT} unstable/main amd64 Packages
150 404 Not Found
151 Ign:5 http://localhost:${APTHTTPPORT} unstable/main all Packages
152 404 Not Found
153 Ign:6 http://localhost:${APTHTTPPORT} unstable/main Translation-en
154 404 Not Found
155 Ign:3 http://localhost:${APTHTTPPORT} unstable/main Sources
156 404 Not Found
157 Ign:4 http://localhost:${APTHTTPPORT} unstable/main amd64 Packages
158 404 Not Found
159 Ign:5 http://localhost:${APTHTTPPORT} unstable/main all Packages
160 404 Not Found
161 Ign:6 http://localhost:${APTHTTPPORT} unstable/main Translation-en
162 404 Not Found
163 Ign:3 http://localhost:${APTHTTPPORT} unstable/main Sources
164 404 Not Found
165 Ign:4 http://localhost:${APTHTTPPORT} unstable/main amd64 Packages
166 404 Not Found
167 Ign:5 http://localhost:${APTHTTPPORT} unstable/main all Packages
168 404 Not Found
169 Ign:6 http://localhost:${APTHTTPPORT} unstable/main Translation-en
170 404 Not Found
171 Hit:3 http://localhost:${APTHTTPPORT} unstable/main Sources
172 Hit:4 http://localhost:${APTHTTPPORT} unstable/main amd64 Packages
173 Hit:5 http://localhost:${APTHTTPPORT} unstable/main all Packages
174 Hit:6 http://localhost:${APTHTTPPORT} unstable/main Translation-en
175 Reading package lists...
176 W: The repository 'http://localhost:${APTHTTPPORT} unstable Release' does not have a Release file.
177 N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
178 N: See apt-secure(8) manpage for repository creation and user configuration details."
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'