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
17 configallowinsecurerepositories
'true'
19 configallowinsecurerepositories
'false'
22 rm -rf rootdir
/var
/lib
/apt
/lists
/
24 local TEST
="test${1:-success}"
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=9999999
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
35 # ensure no leftovers in partial
36 testfailure
ls 'rootdir/var/lib/apt/lists/partial/*'
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 -q=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)"
45 # ensure that we still do a hash check for other files on ims hit of Release
46 if grep -q '^Hit:[0-9]\+ .* InRelease$' expected.output
|| ! grep -q '^Ign:[0-9]\+ .* 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
53 # ensure no leftovers in partial
54 testfailure
ls 'rootdir/var/lib/apt/lists/partial/*'
58 EXPECT
="Hit:1 http://localhost:${APTHTTPPORT} unstable InRelease
59 Reading package lists..."
60 echo 'Acquire::GzipIndexes "0";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
62 echo 'Acquire::GzipIndexes "1";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
65 msgmsg
'Release/Release.gpg'
66 EXPECT
="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease
68 Hit:2 http://localhost:${APTHTTPPORT} unstable Release
69 Reading package lists..."
70 find aptarchive
-name 'InRelease' -delete
71 echo 'Acquire::GzipIndexes "0";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
73 echo 'Acquire::GzipIndexes "1";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
77 EXPECT
="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease
79 Hit:2 http://localhost:${APTHTTPPORT} unstable Release
80 Ign:3 http://localhost:${APTHTTPPORT} unstable Release.gpg
82 Reading package lists...
83 W: The repository 'http://localhost:${APTHTTPPORT} unstable Release' is not signed.
84 N: Data from such a repository can not be authenticated and is therefore potentially dangerous to use.
85 N: See apt-secure(8) manpage for repository creation and user configuration details."
86 find aptarchive
-name 'Release.gpg' -delete
87 echo 'Acquire::GzipIndexes "0";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
89 echo 'Acquire::GzipIndexes "1";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
93 # make the release file old
94 find aptarchive
-name '*Release' -exec sed -i \
95 -e "s#^Date: .*\$#Date: $(date -d '-2 weeks' '+%a, %d %b %Y %H:%M:%S %Z')#" \
96 -e '/^Valid-Until: / d' -e "/^Date: / a\
97 Valid-Until: $(date -d '-1 weeks' '+%a, %d %b %Y %H:%M:%S %Z')" '{}' \
;
100 msgmsg
'expired InRelease'
101 EXPECT
="Hit:1 http://localhost:${APTHTTPPORT} unstable InRelease
102 Reading package lists...
103 E: Release file for http://localhost:${APTHTTPPORT}/dists/unstable/InRelease is expired (invalid since). Updates for this repository will not be applied."
104 echo 'Acquire::GzipIndexes "0";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
106 echo 'Acquire::GzipIndexes "1";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
109 msgmsg
'expired Release/Release.gpg'
110 EXPECT
="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease
112 Hit:2 http://localhost:${APTHTTPPORT} unstable Release
113 Reading package lists...
114 E: Release file for http://localhost:${APTHTTPPORT}/dists/unstable/Release is expired (invalid since). Updates for this repository will not be applied."
115 find aptarchive
-name 'InRelease' -delete
116 echo 'Acquire::GzipIndexes "0";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
118 echo 'Acquire::GzipIndexes "1";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
121 msgmsg
'expired Release only'
122 EXPECT
="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease
124 Hit:2 http://localhost:${APTHTTPPORT} unstable Release
125 Ign:3 http://localhost:${APTHTTPPORT} unstable Release.gpg
127 Reading package lists...
128 W: The repository 'http://localhost:${APTHTTPPORT} unstable Release' is not signed.
129 N: Data from such a repository can not be authenticated and is therefore potentially dangerous to use.
130 N: See apt-secure(8) manpage for repository creation and user configuration details.
131 E: Release file for http://localhost:${APTHTTPPORT}/dists/unstable/Release is expired (invalid since). Updates for this repository will not be applied."
132 find aptarchive
-name 'Release.gpg' -delete
133 echo 'Acquire::GzipIndexes "0";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
134 runtest
'failure' 'warning'
135 echo 'Acquire::GzipIndexes "1";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
136 runtest
'failure' 'warning'
139 msgmsg
'no Release at all'
140 EXPECT
="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease
142 Ign:2 http://localhost:${APTHTTPPORT} unstable Release
144 Ign:3 http://localhost:${APTHTTPPORT} unstable/main Sources
146 Ign:4 http://localhost:${APTHTTPPORT} unstable/main amd64 Packages
148 Ign:5 http://localhost:${APTHTTPPORT} unstable/main Translation-en
150 Ign:3 http://localhost:${APTHTTPPORT} unstable/main Sources
152 Ign:4 http://localhost:${APTHTTPPORT} unstable/main amd64 Packages
154 Ign:5 http://localhost:${APTHTTPPORT} unstable/main Translation-en
156 Ign:3 http://localhost:${APTHTTPPORT} unstable/main Sources
158 Ign:4 http://localhost:${APTHTTPPORT} unstable/main amd64 Packages
160 Ign:5 http://localhost:${APTHTTPPORT} unstable/main Translation-en
162 Hit:3 http://localhost:${APTHTTPPORT} unstable/main Sources
163 Hit:4 http://localhost:${APTHTTPPORT} unstable/main amd64 Packages
164 Hit:5 http://localhost:${APTHTTPPORT} unstable/main Translation-en
165 Reading package lists...
166 W: The repository 'http://localhost:${APTHTTPPORT} unstable Release' does not have a Release file.
167 N: Data from such a repository can not be authenticated and is therefore potentially dangerous to use.
168 N: See apt-secure(8) manpage for repository creation and user configuration details."
169 find aptarchive
-name '*Release*' -delete
170 echo 'Acquire::GzipIndexes "0";
171 Acquire::PDiffs "0";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
173 echo 'Acquire::GzipIndexes "1";
174 Acquire::PDiffs "0";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex