4 TESTDIR
="$(readlink -f "$(dirname "$0")")"
7 configarchitecture 'amd64'
9 insertpackage 'unstable' 'unrelated' 'all' '0.5~squeeze1'
10 insertpackage 'unstable' 'unrelated2' 'amd64' '0.5~squeeze1'
11 insertsource 'unstable' 'unrelated' 'all' '0.5~squeeze1'
13 setupaptarchive --no-update
14 logcurrentarchivedirectory
20 APTOPT='--allow-insecure-repositories'
22 APTOPT='--no-allow-insecure-repositories'
25 rm -rf rootdir/var/lib/apt/lists/
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
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
38 # ensure no leftovers in partial
39 testfailure ls 'rootdir/var/lib/apt/lists/partial/*'
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)"
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, key ID:' goodsign.output
56 # ensure no leftovers in partial
57 testfailure ls 'rootdir/var/lib/apt/lists/partial/*'
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
65 echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex
68 msgmsg 'Release/Release.gpg'
69 EXPECT="Ign
:1 http
://localhost
:${APTHTTPPORT} unstable InRelease
71 Hit
:2 http
://localhost
:${APTHTTPPORT} unstable Release
72 Reading package lists...
"
73 find aptarchive -name 'InRelease' -delete
74 logcurrentarchivedirectory
75 echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
77 echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex
81 EXPECT="Ign
:1 http
://localhost
:${APTHTTPPORT} unstable InRelease
83 Hit
:2 http
://localhost
:${APTHTTPPORT} unstable Release
84 Ign
:3 http
://localhost
:${APTHTTPPORT} unstable Release.gpg
86 Reading package lists...
87 W
: The repository
'http://localhost:${APTHTTPPORT} unstable Release' is not signed.
88 N
: Data from such a repository can
't be authenticated and is therefore potentially dangerous to use.
89 N: See apt-secure(8) manpage for repository creation and user configuration details."
90 find aptarchive -name 'Release.gpg
' -delete
91 logcurrentarchivedirectory
92 echo 'Acquire
::GzipIndexes
"0";' > rootdir/etc/apt/apt.conf.d/02compressindex
94 echo 'Acquire
::GzipIndexes
"1";' > rootdir/etc/apt/apt.conf.d/02compressindex
98 # make the release file old
99 find aptarchive -name '*Release
' -exec sed -i \
100 -e "s#^Date: .*\$#Date: $(date -d '-2 weeks' '+%a, %d %b %Y %H:%M:%S %Z')#" \
101 -e '/^Valid
-Until: / d
' -e "/^Date: / a\
102 Valid-Until: $(date -d '-1 weeks' '+%a, %d %b %Y %H:%M:%S %Z')" '{}' \;
104 logcurrentarchivedirectory
106 msgmsg 'expired InRelease
'
107 EXPECT="Hit:1 http://localhost:${APTHTTPPORT} unstable InRelease
108 Reading package lists...
109 E: Release file for http://localhost:${APTHTTPPORT}/dists/unstable/InRelease is expired (invalid since). Updates for this repository will not be applied."
110 echo 'Acquire
::GzipIndexes
"0";' > rootdir/etc/apt/apt.conf.d/02compressindex
112 echo 'Acquire
::GzipIndexes
"1";' > rootdir/etc/apt/apt.conf.d/02compressindex
115 msgmsg 'expired Release
/Release.gpg
'
116 EXPECT="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease
118 Hit:2 http://localhost:${APTHTTPPORT} unstable Release
119 Reading package lists...
120 E: Release file for http://localhost:${APTHTTPPORT}/dists/unstable/Release is expired (invalid since). Updates for this repository will not be applied."
121 find aptarchive -name 'InRelease
' -delete
122 logcurrentarchivedirectory
123 echo 'Acquire
::GzipIndexes
"0";' > rootdir/etc/apt/apt.conf.d/02compressindex
125 echo 'Acquire
::GzipIndexes
"1";' > rootdir/etc/apt/apt.conf.d/02compressindex
128 msgmsg 'expired Release only
'
129 EXPECT="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease
131 Hit:2 http://localhost:${APTHTTPPORT} unstable Release
132 Ign:3 http://localhost:${APTHTTPPORT} unstable Release.gpg
134 Reading package lists...
135 W: The repository 'http
://localhost
:${APTHTTPPORT} unstable Release
' is not signed.
136 N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
137 N
: See apt
-secure(8) manpage
for repository creation and user configuration details.
138 E
: Release
file for http
://localhost
:${APTHTTPPORT}/dists
/unstable
/Release is expired
(invalid since
). Updates
for this repository will not be applied.
"
139 find aptarchive -name 'Release.gpg' -delete
140 logcurrentarchivedirectory
141 echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
142 runtest 'failure' 'warning'
143 echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex
144 runtest 'failure' 'warning'
147 msgmsg 'no Release at all'
148 EXPECT="Ign
:1 http
://localhost
:${APTHTTPPORT} unstable InRelease
150 Ign
:2 http
://localhost
:${APTHTTPPORT} unstable Release
152 Ign
:3 http
://localhost
:${APTHTTPPORT} unstable
/main Sources
154 Ign
:4 http
://localhost
:${APTHTTPPORT} unstable
/main amd64 Packages
156 Ign
:5 http
://localhost
:${APTHTTPPORT} unstable
/main all Packages
158 Ign
:6 http
://localhost
:${APTHTTPPORT} unstable
/main Translation
-en
160 Ign
:3 http
://localhost
:${APTHTTPPORT} unstable
/main Sources
162 Ign
:4 http
://localhost
:${APTHTTPPORT} unstable
/main amd64 Packages
164 Ign
:5 http
://localhost
:${APTHTTPPORT} unstable
/main all Packages
166 Ign
:6 http
://localhost
:${APTHTTPPORT} unstable
/main Translation
-en
168 Ign
:3 http
://localhost
:${APTHTTPPORT} unstable
/main Sources
170 Ign
:4 http
://localhost
:${APTHTTPPORT} unstable
/main amd64 Packages
172 Ign
:5 http
://localhost
:${APTHTTPPORT} unstable
/main all Packages
174 Ign
:6 http
://localhost
:${APTHTTPPORT} unstable
/main Translation
-en
176 Hit
:3 http
://localhost
:${APTHTTPPORT} unstable
/main Sources
177 Hit
:4 http
://localhost
:${APTHTTPPORT} unstable
/main amd64 Packages
178 Hit
:5 http
://localhost
:${APTHTTPPORT} unstable
/main all Packages
179 Hit
:6 http
://localhost
:${APTHTTPPORT} unstable
/main Translation
-en
180 Reading package lists...
181 W
: The repository
'http://localhost:${APTHTTPPORT} unstable Release' does not have a Release
file.
182 N
: Data from such a repository can
't be authenticated and is therefore potentially dangerous to use.
183 N: See apt-secure(8) manpage for repository creation and user configuration details."
184 find aptarchive -name '*Release
*' -delete
185 logcurrentarchivedirectory
186 echo 'Acquire
::GzipIndexes
"0";
187 Acquire
::PDiffs
"0";' > rootdir/etc/apt/apt.conf.d/02compressindex
189 echo 'Acquire
::GzipIndexes
"1";
190 Acquire
::PDiffs
"0";' > rootdir/etc/apt/apt.conf.d/02compressindex