4 TESTDIR
=$(readlink -f $(dirname $0)) 
   8 configarchitecture 
'amd64' 'i386' 
  10 insertpackage 
'unstable' 'apt' 'all' '1.0' 
  12 setupaptarchive 
--no-update 
  15         msgmsg 
'Test InRelease with' "$1" 
  16         rm -rf rootdir
/var
/lib
/apt
/lists
 
  17         cp -a aptarchive
/dists  aptarchive
/dists.good
 
  18         # get our cache populated 
  19         testsuccess aptget update
 
  20         listcurrentlistsdirectory 
> listsdir.lst
 
  22         # hit again with a good cache 
  23         testsuccessequal 
"Hit:1 $1 unstable InRelease 
  24 Reading package lists..." aptget update
 
  25         testfileequal 
'listsdir.lst' "$(listcurrentlistsdirectory)" 
  27         # drop an architecture, which means the file should be gone now 
  28         configarchitecture 
'i386' 
  29         sed '/_binary-amd64_Packages/ d' listsdir.lst 
> listsdir
-without-amd64.lst
 
  30         testsuccessequal 
"Hit:1 $1 unstable InRelease 
  31 Reading package lists..." aptget update
 
  32         testfileequal 
'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)" 
  34         # readd arch so its downloaded again… 
  35         configarchitecture 
'amd64' 'i386' 
  36         # … but oh noes, hashsum mismatch! 
  37         find aptarchive
/dists
/unstable
/main
/binary
-amd64/ -type f 
-delete 
  38         cat >> aptarchive
/dists
/unstable
/main
/binary
-amd64/Packages 
<<EOF 
  44         compressfile aptarchive
/dists
/unstable
/main
/binary
-amd64/Packages
 
  45         testfailureequal 
"Hit:1 $1 unstable InRelease 
  46 Get:2 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B] 
  47 Err:2 $1 unstable/main amd64 Packages 
  49 W: Failed to fetch $1/dists/unstable/main/binary-amd64/Packages.gz  Hash Sum mismatch 
  50 E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update
 
  51         testfileequal 
'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)" 
  52         rm -rf aptarchive
/dists
 
  53         cp -a aptarchive
/dists.good aptarchive
/dists
 
  55         # … now everything is fine again 
  56         testsuccessequal 
"Hit:1 $1 unstable InRelease 
  57 Get:2 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B] 
  58 Reading package lists..." aptget update
 
  59         testfileequal 
'listsdir.lst' "$(listcurrentlistsdirectory)" 
  61         webserverconfig 
'aptwebserver::support::modified-since' 'false' 
  62         webserverconfig 
'aptwebserver::support::last-modified' 'false' 
  63         testsuccessequal 
"Get:1 $1 unstable InRelease [$(stat -c '%s' 'aptarchive/dists/unstable/InRelease') B] 
  64 Reading package lists..." aptget update
 
  65         webserverconfig 
'aptwebserver::support::modified-since' 'true' 
  66         webserverconfig 
'aptwebserver::support::last-modified' 'true' 
  68         msgmsg 
'Test Release.gpg with' "$1" 
  69         rm -rf rootdir
/var
/lib
/apt
/lists
 
  70         find aptarchive
/dists 
-name 'InRelease' -delete 
  71         # get our cache populated 
  72         testsuccess aptget update
 
  73         listcurrentlistsdirectory 
> listsdir.lst
 
  75         # hit again with a good cache 
  76         testsuccessequal 
"Ign:1 $1 unstable InRelease 
  78 Hit:2 $1 unstable Release 
  79 Reading package lists..." aptget update
 
  80         testfileequal 
'listsdir.lst' "$(listcurrentlistsdirectory)" 
  82         # drop an architecture, which means the file should be gone now 
  83         configarchitecture 
'i386' 
  84         sed '/_binary-amd64_Packages/ d' listsdir.lst 
> listsdir
-without-amd64.lst
 
  85         testsuccessequal 
"Ign:1 $1 unstable InRelease 
  87 Hit:2 $1 unstable Release 
  88 Reading package lists..." aptget update
 
  89         testfileequal 
'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)" 
  91         # readd arch so its downloaded again… 
  92         configarchitecture 
'amd64' 'i386' 
  93         # … but oh noes, hashsum mismatch! 
  94         find aptarchive
/dists
/unstable
/main
/binary
-amd64/ -type f 
-delete 
  95         cat >> aptarchive
/dists
/unstable
/main
/binary
-amd64/Packages 
<<EOF 
 101         compressfile aptarchive
/dists
/unstable
/main
/binary
-amd64/Packages
 
 102         testfailureequal 
"Ign:1 $1 unstable InRelease 
 104 Hit:2 $1 unstable Release 
 105 Get:4 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B] 
 106 Err:4 $1 unstable/main amd64 Packages 
 108 W: Failed to fetch $1/dists/unstable/main/binary-amd64/Packages.gz  Hash Sum mismatch 
 109 E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update
 
 110         testfileequal 
'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)" 
 111         rm -rf aptarchive
/dists
 
 112         cp -a aptarchive
/dists.good aptarchive
/dists
 
 113         find aptarchive
/dists 
-name 'InRelease' -delete 
 115         # … now everything is fine again 
 116         testsuccessequal 
"Ign:1 $1 unstable InRelease 
 118 Hit:2 $1 unstable Release 
 119 Get:4 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B] 
 120 Reading package lists..." aptget update
 
 121         testfileequal 
'listsdir.lst' "$(listcurrentlistsdirectory)" 
 123         webserverconfig 
'aptwebserver::support::modified-since' 'false' 
 124         webserverconfig 
'aptwebserver::support::last-modified' 'false' 
 125         testsuccessequal 
"Ign:1 $1 unstable InRelease 
 127 Get:2 $1 unstable Release [$(stat -c '%s' 'aptarchive/dists/unstable/Release') B] 
 128 Reading package lists..." aptget update
 
 129         webserverconfig 
'aptwebserver::support::modified-since' 'true' 
 130         webserverconfig 
'aptwebserver::support::last-modified' 'true' 
 132         rm -rf aptarchive
/dists
 
 133         cp -a aptarchive
/dists.good aptarchive
/dists
 
 135         # new release file, but the indexes are the same 
 136         redatereleasefiles 
'+2 hours' 
 138         rm -rf rootdir
/var
/lib
/apt
/lists.good
 
 139         cp -a rootdir
/var
/lib
/apt
/lists rootdir
/var
/lib
/apt
/lists.good
 
 140         testsuccessequal 
"Get:1 $1 unstable InRelease [$(stat -c '%s' 'aptarchive/dists/unstable/InRelease') B] 
 141 Reading package lists..." aptget update
 
 143         rm -rf rootdir
/var
/lib
/apt
/lists
 
 144         cp -a rootdir
/var
/lib
/apt
/lists.good rootdir
/var
/lib
/apt
/lists
 
 145         find rootdir
/var
/lib
/apt
/lists 
-name '*_Packages*' -delete 
 146         testsuccessequal 
"Get:1 $1 unstable InRelease [$(stat -c '%s' 'aptarchive/dists/unstable/InRelease') B] 
 147 Get:2 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B] 
 148 Get:3 $1 unstable/main i386 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-i386/Packages.gz') B] 
 149 Reading package lists..." aptget update
 
 151         rm -rf aptarchive
/dists
 
 152         cp -a aptarchive
/dists.good aptarchive
/dists
 
 156 methodtest 
'http://localhost:8080' 
 158 changetohttpswebserver
 
 159 methodtest 
'https://localhost:4433'