4 TESTDIR
=$(readlink -f $(dirname $0))
7 configarchitecture
'amd64'
9 insertpackage
'unstable' 'unrelated' 'all' '0.5~squeeze1'
10 insertsource
'unstable' 'unrelated' 'all' '0.5~squeeze1'
12 setupaptarchive
--no-update
18 APTOPT
='--allow-insecure-repositories'
20 APTOPT
='--no-allow-insecure-repositories'
23 rm -rf rootdir
/var
/lib
/apt
/lists
/
25 local TEST
="test${1:-success}"
26 $TEST aptget update
$APTOPT
27 if [ "$1" = 'failure' ]; then
28 # accept the outdated Release file so we can check Hit behaviour
29 "test${2:-success}" aptget update
-o Acquire
::Min
-ValidTime=9999999 $APTOPT
31 listcurrentlistsdirectory
> listsdir.lst
32 testsuccess
grep '_Packages\(\.gz\)\?$' listsdir.lst
33 testsuccess
grep '_Sources\(\.gz\)\?$' listsdir.lst
34 testsuccess
grep '_Translation-en\(\.gz\)\?$' listsdir.lst
36 # ensure no leftovers in partial
37 testfailure
ls 'rootdir/var/lib/apt/lists/partial/*'
39 # check that I-M-S header is kept in redirections
40 echo "$EXPECT" | sed -e 's#(invalid since [^)]\+)#(invalid since)#' > expected.output
41 $TEST aptget update
-o Debug
::pkgAcquire
::Worker
=0 -o Debug
::Acquire
::http
=0 -q=0 $APTOPT
42 sed -i -e 's#(invalid since [^)]\+)#(invalid since)#' rootdir
/tmp
/${TEST}.output
43 testequal
"$(cat expected.output)" cat rootdir
/tmp
/${TEST}.output
44 testfileequal
'listsdir.lst' "$(listcurrentlistsdirectory)"
46 # ensure that we still do a hash check for other files on ims hit of Release
47 if grep -q '^Hit:[0-9]\+ .* InRelease$' expected.output
|| ! grep -q '^Ign:[0-9]\+ .* Release\(\.gpg\)\?$' expected.output
; then
48 $TEST aptget update
-o Debug
::Acquire
::gpgv
=1 $APTOPT
49 cp rootdir
/tmp
/${TEST}.output goodsign.output
50 testfileequal
'listsdir.lst' "$(listcurrentlistsdirectory)"
51 testsuccess
grep '^Got GOODSIG, key ID:GOODSIG' goodsign.output
54 # ensure no leftovers in partial
55 testfailure
ls 'rootdir/var/lib/apt/lists/partial/*'
59 EXPECT
="Hit:1 http://localhost:${APTHTTPPORT} unstable InRelease
60 Reading package lists..."
61 echo 'Acquire::GzipIndexes "0";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
63 echo 'Acquire::GzipIndexes "1";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
66 msgmsg
'Release/Release.gpg'
67 EXPECT
="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease
69 Hit:2 http://localhost:${APTHTTPPORT} unstable Release
70 Reading package lists..."
71 find aptarchive
-name 'InRelease' -delete
72 echo 'Acquire::GzipIndexes "0";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
74 echo 'Acquire::GzipIndexes "1";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
78 EXPECT
="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease
80 Hit:2 http://localhost:${APTHTTPPORT} unstable Release
81 Ign:3 http://localhost:${APTHTTPPORT} unstable Release.gpg
83 Reading package lists...
84 W: The repository 'http://localhost:${APTHTTPPORT} unstable Release' is not signed.
85 N: Data from such a repository can not be authenticated and is therefore potentially dangerous to use.
86 N: See apt-secure(8) manpage for repository creation and user configuration details."
87 find aptarchive
-name 'Release.gpg' -delete
88 echo 'Acquire::GzipIndexes "0";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
90 echo 'Acquire::GzipIndexes "1";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
94 # make the release file old
95 find aptarchive
-name '*Release' -exec sed -i \
96 -e "s#^Date: .*\$#Date: $(date -d '-2 weeks' '+%a, %d %b %Y %H:%M:%S %Z')#" \
97 -e '/^Valid-Until: / d' -e "/^Date: / a\
98 Valid-Until: $(date -d '-1 weeks' '+%a, %d %b %Y %H:%M:%S %Z')" '{}' \
;
101 msgmsg
'expired InRelease'
102 EXPECT
="Hit:1 http://localhost:${APTHTTPPORT} unstable InRelease
103 Reading package lists...
104 E: Release file for http://localhost:${APTHTTPPORT}/dists/unstable/InRelease is expired (invalid since). Updates for this repository will not be applied."
105 echo 'Acquire::GzipIndexes "0";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
107 echo 'Acquire::GzipIndexes "1";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
110 msgmsg
'expired Release/Release.gpg'
111 EXPECT
="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease
113 Hit:2 http://localhost:${APTHTTPPORT} unstable Release
114 Reading package lists...
115 E: Release file for http://localhost:${APTHTTPPORT}/dists/unstable/Release is expired (invalid since). Updates for this repository will not be applied."
116 find aptarchive
-name 'InRelease' -delete
117 echo 'Acquire::GzipIndexes "0";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
119 echo 'Acquire::GzipIndexes "1";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
122 msgmsg
'expired Release only'
123 EXPECT
="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease
125 Hit:2 http://localhost:${APTHTTPPORT} unstable Release
126 Ign:3 http://localhost:${APTHTTPPORT} unstable Release.gpg
128 Reading package lists...
129 W: The repository 'http://localhost:${APTHTTPPORT} unstable Release' is not signed.
130 N: Data from such a repository can not be authenticated and is therefore potentially dangerous to use.
131 N: See apt-secure(8) manpage for repository creation and user configuration details.
132 E: Release file for http://localhost:${APTHTTPPORT}/dists/unstable/Release is expired (invalid since). Updates for this repository will not be applied."
133 find aptarchive
-name 'Release.gpg' -delete
134 echo 'Acquire::GzipIndexes "0";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
135 runtest
'failure' 'warning'
136 echo 'Acquire::GzipIndexes "1";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
137 runtest
'failure' 'warning'
140 msgmsg
'no Release at all'
141 EXPECT
="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease
143 Ign:2 http://localhost:${APTHTTPPORT} unstable Release
145 Ign:3 http://localhost:${APTHTTPPORT} unstable/main Sources
147 Ign:4 http://localhost:${APTHTTPPORT} unstable/main amd64 Packages
149 Ign:5 http://localhost:${APTHTTPPORT} unstable/main Translation-en
151 Ign:3 http://localhost:${APTHTTPPORT} unstable/main Sources
153 Ign:4 http://localhost:${APTHTTPPORT} unstable/main amd64 Packages
155 Ign:5 http://localhost:${APTHTTPPORT} unstable/main Translation-en
157 Ign:3 http://localhost:${APTHTTPPORT} unstable/main Sources
159 Ign:4 http://localhost:${APTHTTPPORT} unstable/main amd64 Packages
161 Ign:5 http://localhost:${APTHTTPPORT} unstable/main Translation-en
163 Hit:3 http://localhost:${APTHTTPPORT} unstable/main Sources
164 Hit:4 http://localhost:${APTHTTPPORT} unstable/main amd64 Packages
165 Hit:5 http://localhost:${APTHTTPPORT} unstable/main Translation-en
166 Reading package lists...
167 W: The repository 'http://localhost:${APTHTTPPORT} unstable Release' does not have a Release file.
168 N: Data from such a repository can not be authenticated and is therefore potentially dangerous to use.
169 N: See apt-secure(8) manpage for repository creation and user configuration details."
170 find aptarchive
-name '*Release*' -delete
171 echo 'Acquire::GzipIndexes "0";
172 Acquire::PDiffs "0";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
174 echo 'Acquire::GzipIndexes "1";
175 Acquire::PDiffs "0";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex