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 
  15 logcurrentarchivedirectory 
  21         APTOPT='--allow-insecure-repositories' 
  23         APTOPT='--no-allow-insecure-repositories' 
  26     rm -rf rootdir/var/lib/apt/lists/ 
  28     local TEST="test${1:-success}" 
  29     $TEST aptget update $APTOPT -o Debug::pkgAcquire::Worker=1 
  30     if [ "$1" = 'failure' ]; then 
  31         # accept the outdated Release file so we can check Hit behaviour 
  32         "test${2:-success}" aptget update -o Acquire::Min-ValidTime=9999999 $APTOPT 
  34     listcurrentlistsdirectory > listsdir.lst 
  35     testsuccess grep '_Packages\(\.[0-9a-z]\+\)\?$' listsdir.lst 
  36     testsuccess grep '_Sources\(\.[0-9a-z]\+\)\?$' listsdir.lst 
  37     testsuccess grep '_Translation-en\(\.[0-9a-z]\+\)\?$' listsdir.lst 
  39     # ensure no leftovers in partial 
  40     testfailure ls 'rootdir/var/lib/apt/lists/partial/*' 
  42     # check that I-M-S header is kept in redirections 
  43     echo "$EXPECT" | sed -e 's#(invalid since [^)]\+)#(invalid since)#' > expected.output 
  44     $TEST aptget update  -o Debug::pkgAcquire::Worker=0 -o Debug::Acquire::http=0 $APTOPT 
  45     sed -i -e 's#(invalid since [^)]\+)#(invalid since)#' rootdir/tmp/${TEST}.output 
  46     testequal "$(cat expected.output)" cat rootdir/tmp/${TEST}.output 
  47     testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)" 
  49     # ensure that we still do a hash check for other files on ims hit of Release 
  50     if grep -q '^Hit:[0-9]\+ .* InRelease$' expected.output || ! grep -q '^Ign:[0-9]\+ .* Release\(\.gpg\)\?$' expected.output; then 
  51             $TEST aptget update -o Debug::Acquire::gpgv=1 $APTOPT 
  52             cp rootdir/tmp/${TEST}.output goodsign.output 
  53             testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)" 
  54             testsuccess grep '^Got GOODSIG ' goodsign.output 
  57     # ensure no leftovers in partial 
  58     testfailure ls 'rootdir/var/lib/apt/lists/partial/*' 
  62 EXPECT="Hit
:1 http
://localhost
:${APTHTTPPORT} unstable InRelease
 
  63 Reading package lists...
" 
  64 echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex 
  66 echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex 
  69 msgmsg 'Release/Release.gpg' 
  70 EXPECT="Ign
:1 http
://localhost
:${APTHTTPPORT} unstable InRelease
 
  72 Hit
:2 http
://localhost
:${APTHTTPPORT} unstable Release
 
  73 Reading package lists...
" 
  74 find aptarchive -name 'InRelease' -delete 
  75 logcurrentarchivedirectory 
  76 echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex 
  78 echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex 
  82 EXPECT="Ign
:1 http
://localhost
:${APTHTTPPORT} unstable InRelease
 
  84 Hit
:2 http
://localhost
:${APTHTTPPORT} unstable Release
 
  85 Ign
:3 http
://localhost
:${APTHTTPPORT} unstable Release.gpg
 
  87 Reading package lists...
 
  88 W
: The repository 
'http://localhost:${APTHTTPPORT} unstable Release' is not signed.
 
  89 N
: Data from such a repository can
't be authenticated and is therefore potentially dangerous to use. 
  90 N: See apt-secure(8) manpage for repository creation and user configuration details." 
  91 find aptarchive -name 'Release.gpg
' -delete 
  92 logcurrentarchivedirectory 
  93 echo 'Acquire
::GzipIndexes 
"0";' > rootdir/etc/apt/apt.conf.d/02compressindex 
  95 echo 'Acquire
::GzipIndexes 
"1";' > rootdir/etc/apt/apt.conf.d/02compressindex 
  99 # make the release file old 
 100 find aptarchive -name '*Release
' -exec sed -i \ 
 101         -e "s#^Date: .*\$#Date: $(date -ud '-2 weeks' '+%a, %d %b %Y %H:%M:%S %Z')#" \ 
 102         -e '/^Valid
-Until: / d
' -e "/^Date: / a\ 
 103 Valid-Until: $(date -ud '-1 weeks' '+%a, %d %b %Y %H:%M:%S %Z')" '{}' \; 
 105 logcurrentarchivedirectory 
 107 msgmsg 'expired InRelease
' 
 108 EXPECT="Hit:1 http://localhost:${APTHTTPPORT} unstable InRelease 
 109 Reading package lists... 
 110 E: Release file for http://localhost:${APTHTTPPORT}/dists/unstable/InRelease is expired (invalid since). Updates for this repository will not be applied." 
 111 echo 'Acquire
::GzipIndexes 
"0";' > rootdir/etc/apt/apt.conf.d/02compressindex 
 113 echo 'Acquire
::GzipIndexes 
"1";' > rootdir/etc/apt/apt.conf.d/02compressindex 
 116 msgmsg 'expired Release
/Release.gpg
' 
 117 EXPECT="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease 
 119 Hit:2 http://localhost:${APTHTTPPORT} unstable Release 
 120 Reading package lists... 
 121 E: Release file for http://localhost:${APTHTTPPORT}/dists/unstable/Release is expired (invalid since). Updates for this repository will not be applied." 
 122 find aptarchive -name 'InRelease
' -delete 
 123 logcurrentarchivedirectory 
 124 echo 'Acquire
::GzipIndexes 
"0";' > rootdir/etc/apt/apt.conf.d/02compressindex 
 126 echo 'Acquire
::GzipIndexes 
"1";' > rootdir/etc/apt/apt.conf.d/02compressindex 
 129 msgmsg 'expired Release only
' 
 130 EXPECT="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease 
 132 Hit:2 http://localhost:${APTHTTPPORT} unstable Release 
 133 Ign:3 http://localhost:${APTHTTPPORT} unstable Release.gpg 
 135 Reading package lists... 
 136 W: The repository 'http
://localhost
:${APTHTTPPORT} unstable Release
' is not signed. 
 137 N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
 
 138 N
: See apt
-secure(8) manpage 
for repository creation and user configuration details.
 
 139 E
: Release 
file for http
://localhost
:${APTHTTPPORT}/dists
/unstable
/Release is expired 
(invalid since
). Updates 
for this repository will not be applied.
" 
 140 find aptarchive -name 'Release.gpg' -delete 
 141 logcurrentarchivedirectory 
 142 echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex 
 143 runtest 'failure' 'warning' 
 144 echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex 
 145 runtest 'failure' 'warning' 
 148 msgmsg 'no Release at all' 
 149 EXPECT="Ign
:1 http
://localhost
:${APTHTTPPORT} unstable InRelease
 
 151 Ign
:2 http
://localhost
:${APTHTTPPORT} unstable Release
 
 153 Ign
:3 http
://localhost
:${APTHTTPPORT} unstable
/main Sources
 
 155 Ign
:4 http
://localhost
:${APTHTTPPORT} unstable
/main amd64 Packages
 
 157 Ign
:5 http
://localhost
:${APTHTTPPORT} unstable
/main all Packages
 
 159 Ign
:6 http
://localhost
:${APTHTTPPORT} unstable
/main Translation
-en 
 161 Ign
:3 http
://localhost
:${APTHTTPPORT} unstable
/main Sources
 
 163 Ign
:4 http
://localhost
:${APTHTTPPORT} unstable
/main amd64 Packages
 
 165 Ign
:5 http
://localhost
:${APTHTTPPORT} unstable
/main all Packages
 
 167 Ign
:6 http
://localhost
:${APTHTTPPORT} unstable
/main Translation
-en 
 169 Ign
:3 http
://localhost
:${APTHTTPPORT} unstable
/main Sources
 
 171 Ign
:4 http
://localhost
:${APTHTTPPORT} unstable
/main amd64 Packages
 
 173 Ign
:5 http
://localhost
:${APTHTTPPORT} unstable
/main all Packages
 
 175 Ign
:6 http
://localhost
:${APTHTTPPORT} unstable
/main Translation
-en 
 177 Hit
:3 http
://localhost
:${APTHTTPPORT} unstable
/main Sources
 
 178 Hit
:4 http
://localhost
:${APTHTTPPORT} unstable
/main amd64 Packages
 
 179 Hit
:5 http
://localhost
:${APTHTTPPORT} unstable
/main all Packages
 
 180 Hit
:6 http
://localhost
:${APTHTTPPORT} unstable
/main Translation
-en 
 181 Reading package lists...
 
 182 W
: The repository 
'http://localhost:${APTHTTPPORT} unstable Release' does not have a Release 
file.
 
 183 N
: Data from such a repository can
't be authenticated and is therefore potentially dangerous to use. 
 184 N: See apt-secure(8) manpage for repository creation and user configuration details." 
 185 find aptarchive -name '*Release
*' -delete 
 186 logcurrentarchivedirectory 
 187 echo 'Acquire
::GzipIndexes 
"0"; 
 188 Acquire
::PDiffs 
"0";' > rootdir/etc/apt/apt.conf.d/02compressindex 
 190 echo 'Acquire
::GzipIndexes 
"1"; 
 191 Acquire
::PDiffs 
"0";' > rootdir/etc/apt/apt.conf.d/02compressindex