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 
  19         APTOPT
='--allow-insecure-repositories' 
  21         APTOPT
='--no-allow-insecure-repositories' 
  24     rm -rf rootdir
/var
/lib
/apt
/lists
/ 
  26     local TEST
="test${1:-success}" 
  27     $TEST aptget update 
$APTOPT 
  28     if [ "$1" = 'failure' ]; then 
  29         # accept the outdated Release file so we can check Hit behaviour 
  30         "test${2:-success}" aptget update 
-o Acquire
::Min
-ValidTime=9999999 $APTOPT 
  32     listcurrentlistsdirectory 
> listsdir.lst
 
  33     testsuccess 
grep '_Packages\(\.gz\)\?$' listsdir.lst
 
  34     testsuccess 
grep '_Sources\(\.gz\)\?$' listsdir.lst
 
  35     testsuccess 
grep '_Translation-en\(\.gz\)\?$' listsdir.lst
 
  37     # ensure no leftovers in partial 
  38     testfailure 
ls 'rootdir/var/lib/apt/lists/partial/*' 
  40     # check that I-M-S header is kept in redirections 
  41     echo "$EXPECT" | sed -e 's#(invalid since [^)]\+)#(invalid since)#' > expected.output
 
  42     $TEST aptget update  
-o Debug
::pkgAcquire
::Worker
=0 -o Debug
::Acquire
::http
=0 $APTOPT 
  43     sed -i -e 's#(invalid since [^)]\+)#(invalid since)#' rootdir
/tmp
/${TEST}.output
 
  44     testequal 
"$(cat expected.output)" cat rootdir
/tmp
/${TEST}.output
 
  45     testfileequal 
'listsdir.lst' "$(listcurrentlistsdirectory)" 
  47     # ensure that we still do a hash check for other files on ims hit of Release 
  48     if grep -q '^Hit:[0-9]\+ .* InRelease$' expected.output 
|| ! grep -q '^Ign:[0-9]\+ .* Release\(\.gpg\)\?$' expected.output
; then 
  49             $TEST aptget update 
-o Debug
::Acquire
::gpgv
=1 $APTOPT 
  50             cp rootdir
/tmp
/${TEST}.output goodsign.output
 
  51             testfileequal 
'listsdir.lst' "$(listcurrentlistsdirectory)" 
  52             testsuccess 
grep '^Got GOODSIG, key ID:GOODSIG' goodsign.output
 
  55     # ensure no leftovers in partial 
  56     testfailure 
ls 'rootdir/var/lib/apt/lists/partial/*' 
  60 EXPECT
="Hit:1 http://localhost:${APTHTTPPORT} unstable InRelease 
  61 Reading package lists..." 
  62 echo 'Acquire::GzipIndexes "0";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
 
  64 echo 'Acquire::GzipIndexes "1";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
 
  67 msgmsg 
'Release/Release.gpg' 
  68 EXPECT
="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease 
  70 Hit:2 http://localhost:${APTHTTPPORT} unstable Release 
  71 Reading package lists..." 
  72 find aptarchive 
-name 'InRelease' -delete 
  73 echo 'Acquire::GzipIndexes "0";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
 
  75 echo 'Acquire::GzipIndexes "1";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
 
  79 EXPECT
="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease 
  81 Hit:2 http://localhost:${APTHTTPPORT} unstable Release 
  82 Ign:3 http://localhost:${APTHTTPPORT} unstable Release.gpg 
  84 Reading package lists... 
  85 W: The repository 'http://localhost:${APTHTTPPORT} unstable Release' is not signed. 
  86 N: Data from such a repository can not be authenticated and is therefore potentially dangerous to use. 
  87 N: See apt-secure(8) manpage for repository creation and user configuration details." 
  88 find aptarchive 
-name 'Release.gpg' -delete 
  89 echo 'Acquire::GzipIndexes "0";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
 
  91 echo 'Acquire::GzipIndexes "1";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
 
  95 # make the release file old 
  96 find aptarchive 
-name '*Release' -exec sed -i \
 
  97         -e "s#^Date: .*\$#Date: $(date -d '-2 weeks' '+%a, %d %b %Y %H:%M:%S %Z')#" \
 
  98         -e '/^Valid-Until: / d' -e "/^Date: / a\ 
  99 Valid-Until: $(date -d '-1 weeks' '+%a, %d %b %Y %H:%M:%S %Z')" '{}' \
; 
 102 msgmsg 
'expired InRelease' 
 103 EXPECT
="Hit:1 http://localhost:${APTHTTPPORT} unstable InRelease 
 104 Reading package lists... 
 105 E: Release file for http://localhost:${APTHTTPPORT}/dists/unstable/InRelease is expired (invalid since). Updates for this repository will not be applied." 
 106 echo 'Acquire::GzipIndexes "0";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
 
 108 echo 'Acquire::GzipIndexes "1";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
 
 111 msgmsg 
'expired Release/Release.gpg' 
 112 EXPECT
="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease 
 114 Hit:2 http://localhost:${APTHTTPPORT} unstable Release 
 115 Reading package lists... 
 116 E: Release file for http://localhost:${APTHTTPPORT}/dists/unstable/Release is expired (invalid since). Updates for this repository will not be applied." 
 117 find aptarchive 
-name 'InRelease' -delete 
 118 echo 'Acquire::GzipIndexes "0";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
 
 120 echo 'Acquire::GzipIndexes "1";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
 
 123 msgmsg 
'expired Release only' 
 124 EXPECT
="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease 
 126 Hit:2 http://localhost:${APTHTTPPORT} unstable Release 
 127 Ign:3 http://localhost:${APTHTTPPORT} unstable Release.gpg 
 129 Reading package lists... 
 130 W: The repository 'http://localhost:${APTHTTPPORT} unstable Release' is not signed. 
 131 N: Data from such a repository can not be authenticated and is therefore potentially dangerous to use. 
 132 N: See apt-secure(8) manpage for repository creation and user configuration details. 
 133 E: Release file for http://localhost:${APTHTTPPORT}/dists/unstable/Release is expired (invalid since). Updates for this repository will not be applied." 
 134 find aptarchive 
-name 'Release.gpg' -delete 
 135 echo 'Acquire::GzipIndexes "0";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
 
 136 runtest 
'failure' 'warning' 
 137 echo 'Acquire::GzipIndexes "1";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
 
 138 runtest 
'failure' 'warning' 
 141 msgmsg 
'no Release at all' 
 142 EXPECT
="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease 
 144 Ign:2 http://localhost:${APTHTTPPORT} unstable Release 
 146 Ign:3 http://localhost:${APTHTTPPORT} unstable/main Sources 
 148 Ign:4 http://localhost:${APTHTTPPORT} unstable/main amd64 Packages 
 150 Ign:5 http://localhost:${APTHTTPPORT} unstable/main all Packages 
 152 Ign:6 http://localhost:${APTHTTPPORT} unstable/main Translation-en 
 154 Ign:3 http://localhost:${APTHTTPPORT} unstable/main Sources 
 156 Ign:4 http://localhost:${APTHTTPPORT} unstable/main amd64 Packages 
 158 Ign:5 http://localhost:${APTHTTPPORT} unstable/main all Packages 
 160 Ign:6 http://localhost:${APTHTTPPORT} unstable/main Translation-en 
 162 Ign:3 http://localhost:${APTHTTPPORT} unstable/main Sources 
 164 Ign:4 http://localhost:${APTHTTPPORT} unstable/main amd64 Packages 
 166 Ign:5 http://localhost:${APTHTTPPORT} unstable/main all Packages 
 168 Ign:6 http://localhost:${APTHTTPPORT} unstable/main Translation-en 
 170 Hit:3 http://localhost:${APTHTTPPORT} unstable/main Sources 
 171 Hit:4 http://localhost:${APTHTTPPORT} unstable/main amd64 Packages 
 172 Hit:5 http://localhost:${APTHTTPPORT} unstable/main all Packages 
 173 Hit:6 http://localhost:${APTHTTPPORT} unstable/main Translation-en 
 174 Reading package lists... 
 175 W: The repository 'http://localhost:${APTHTTPPORT} unstable Release' does not have a Release file. 
 176 N: Data from such a repository can not be authenticated and is therefore potentially dangerous to use. 
 177 N: See apt-secure(8) manpage for repository creation and user configuration details." 
 178 find aptarchive 
-name '*Release*' -delete 
 179 echo 'Acquire::GzipIndexes "0"; 
 180 Acquire::PDiffs "0";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex
 
 182 echo 'Acquire::GzipIndexes "1"; 
 183 Acquire::PDiffs "0";' > rootdir
/etc
/apt
/apt.conf.d
/02compressindex