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 export APT_DONT_SIGN=""
14 setupaptarchive --no-update
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 ' 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 echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
76 echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex
80 EXPECT="Ign
:1 http
://localhost
:${APTHTTPPORT} unstable InRelease
82 Hit
:2 http
://localhost
:${APTHTTPPORT} unstable Release
83 Ign
:3 http
://localhost
:${APTHTTPPORT} unstable Release.gpg
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
92 echo 'Acquire
::GzipIndexes
"1";' > rootdir/etc/apt/apt.conf.d/02compressindex
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')" '{}' \;
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
109 echo 'Acquire
::GzipIndexes
"1";' > rootdir/etc/apt/apt.conf.d/02compressindex
112 msgmsg 'expired Release
/Release.gpg
'
113 EXPECT="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease
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
121 echo 'Acquire
::GzipIndexes
"1";' > rootdir/etc/apt/apt.conf.d/02compressindex
124 msgmsg 'expired Release only
'
125 EXPECT="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease
127 Hit:2 http://localhost:${APTHTTPPORT} unstable Release
128 Ign:3 http://localhost:${APTHTTPPORT} unstable Release.gpg
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'
142 msgmsg 'no Release at all'
143 EXPECT="Ign
:1 http
://localhost
:${APTHTTPPORT} unstable InRelease
145 Ign
:2 http
://localhost
:${APTHTTPPORT} unstable Release
147 Ign
:3 http
://localhost
:${APTHTTPPORT} unstable
/main Sources
149 Ign
:4 http
://localhost
:${APTHTTPPORT} unstable
/main amd64 Packages
151 Ign
:5 http
://localhost
:${APTHTTPPORT} unstable
/main all Packages
153 Ign
:6 http
://localhost
:${APTHTTPPORT} unstable
/main Translation
-en
155 Ign
:3 http
://localhost
:${APTHTTPPORT} unstable
/main Sources
157 Ign
:4 http
://localhost
:${APTHTTPPORT} unstable
/main amd64 Packages
159 Ign
:5 http
://localhost
:${APTHTTPPORT} unstable
/main all Packages
161 Ign
:6 http
://localhost
:${APTHTTPPORT} unstable
/main Translation
-en
163 Ign
:3 http
://localhost
:${APTHTTPPORT} unstable
/main Sources
165 Ign
:4 http
://localhost
:${APTHTTPPORT} unstable
/main amd64 Packages
167 Ign
:5 http
://localhost
:${APTHTTPPORT} unstable
/main all Packages
169 Ign
:6 http
://localhost
:${APTHTTPPORT} unstable
/main Translation
-en
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
183 echo 'Acquire
::GzipIndexes
"1";
184 Acquire
::PDiffs
"0";' > rootdir/etc/apt/apt.conf.d/02compressindex