4 TESTDIR
="$(readlink -f "$(dirname "$0")")"
8 configarchitecture 'amd64' 'i386'
11 insertpackage 'unstable' 'apt' 'amd64,i386' '1.0'
13 export APT_DONT_SIGN=''
14 setupaptarchive --no-update
17 msgmsg 'Test InRelease with' "$1"
18 rm -rf rootdir/var/lib/apt/lists
19 cp -a aptarchive/dists aptarchive/dists.good
20 # get our cache populated
21 testsuccess aptget update
22 listcurrentlistsdirectory > listsdir.lst
24 # hit again with a good cache
25 testsuccessequal "Hit
:1 $1 unstable InRelease
26 Reading package lists...
" aptget update
27 testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
29 # drop an architecture, which means the file should be gone now
30 configarchitecture 'i386'
31 sed '/_binary-amd64_Packages/ d' listsdir.lst > listsdir-without-amd64.lst
32 testsuccessequal "Hit
:1 $1 unstable InRelease
33 Reading package lists...
" aptget update
34 testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)"
36 # readd arch so its downloaded again…
37 configarchitecture 'amd64' 'i386'
38 # … but oh noes, hashsum mismatch!
39 SIZE=$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz')
40 mv aptarchive/dists/unstable/main/binary-amd64/Packages.gz aptarchive/dists/unstable/main/binary-amd64/Packages.gz.orig
41 cat > aptarchive/dists/unstable/main/binary-amd64/Packages <<EOF
46 compressfile aptarchive/dists/unstable/main/binary-amd64/Packages
47 testfailureequal "Hit
:1 $1 unstable InRelease
48 Get
:2 $1 unstable
/main amd64 Packages
[$SIZE B
]
49 Err
:2 $1 unstable
/main amd64 Packages
51 Hashes of expected
file:
52 - Filesize
:$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz.orig') [weak
]
53 - SHA256
:$(sha256sum 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz.orig' | cut -d' ' -f 1)
54 Hashes of received
file:
55 - SHA256
:$(sha256sum 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz' | cut -d' ' -f 1)
56 - Filesize
:$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') [weak
]
57 Last modification reported
: $(lastmodification 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz')
58 Release
file created
at: $(releasefiledate 'aptarchive/dists/unstable/InRelease')
59 Reading package lists...
60 E
: Failed to fetch
$1/dists
/unstable
/main
/binary
-amd64/Packages.gz Hash Sum mismatch
61 Hashes of expected
file:
62 - Filesize
:$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz.orig') [weak
]
63 - SHA256
:$(sha256sum 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz.orig' | cut -d' ' -f 1)
64 Hashes of received
file:
65 - SHA256
:$(sha256sum 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz' | cut -d' ' -f 1)
66 - Filesize
:$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') [weak
]
67 Last modification reported
: $(lastmodification 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz')
68 Release
file created
at: $(releasefiledate 'aptarchive/dists/unstable/InRelease')
69 E
: Some index files failed to download. They have been ignored
, or old ones used instead.
" aptget update
70 testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)"
71 rm -rf aptarchive/dists
72 cp -a aptarchive/dists.good aptarchive/dists
74 # … now everything is fine again
75 testsuccessequal "Hit
:1 $1 unstable InRelease
76 Get
:2 $1 unstable
/main amd64 Packages
[$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B
]
77 Reading package lists...
" aptget update
78 testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
80 webserverconfig 'aptwebserver::support::modified-since' 'false'
81 webserverconfig 'aptwebserver::support::last-modified' 'false'
82 testsuccessequal "Get
:1 $1 unstable InRelease
[$(stat -c '%s' 'aptarchive/dists/unstable/InRelease') B
]
83 Reading package lists...
" aptget update
84 webserverconfig 'aptwebserver::support::modified-since' 'true'
85 webserverconfig 'aptwebserver::support::last-modified' 'true'
87 msgmsg 'Test Release.gpg with' "$1"
88 rm -rf rootdir/var/lib/apt/lists
89 find aptarchive/dists -name 'InRelease' -delete
90 # get our cache populated
91 testsuccess aptget update
92 listcurrentlistsdirectory > listsdir.lst
94 # hit again with a good cache
95 testsuccessequal "Ign
:1 $1 unstable InRelease
97 Hit
:2 $1 unstable Release
98 Reading package lists...
" aptget update
99 testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
101 # drop an architecture, which means the file should be gone now
102 configarchitecture 'i386'
103 sed '/_binary-amd64_Packages/ d' listsdir.lst > listsdir-without-amd64.lst
104 testsuccessequal "Ign
:1 $1 unstable InRelease
106 Hit
:2 $1 unstable Release
107 Reading package lists...
" aptget update
108 testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)"
110 # readd arch so its downloaded again…
111 configarchitecture 'amd64' 'i386'
112 # … but oh noes, hashsum mismatch!
113 SIZE=$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz')
114 mv aptarchive/dists/unstable/main/binary-amd64/Packages.gz aptarchive/dists/unstable/main/binary-amd64/Packages.gz.orig
115 cat > aptarchive/dists/unstable/main/binary-amd64/Packages <<EOF
120 compressfile aptarchive/dists/unstable/main/binary-amd64/Packages
121 testfailureequal "Ign
:1 $1 unstable InRelease
123 Hit
:2 $1 unstable Release
124 Get
:4 $1 unstable
/main amd64 Packages
[$SIZE B
]
125 Err
:4 $1 unstable
/main amd64 Packages
127 Hashes of expected
file:
128 - Filesize
:$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz.orig') [weak
]
129 - SHA256
:$(sha256sum 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz.orig' | cut -d' ' -f 1)
130 Hashes of received
file:
131 - SHA256
:$(sha256sum 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz' | cut -d' ' -f 1)
132 - Filesize
:$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') [weak
]
133 Last modification reported
: $(lastmodification 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz')
134 Release
file created
at: $(releasefiledate 'aptarchive/dists/unstable/Release')
135 Reading package lists...
136 E
: Failed to fetch
$1/dists
/unstable
/main
/binary
-amd64/Packages.gz Hash Sum mismatch
137 Hashes of expected
file:
138 - Filesize
:$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz.orig') [weak
]
139 - SHA256
:$(sha256sum 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz.orig' | cut -d' ' -f 1)
140 Hashes of received
file:
141 - SHA256
:$(sha256sum 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz' | cut -d' ' -f 1)
142 - Filesize
:$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') [weak
]
143 Last modification reported
: $(lastmodification 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz')
144 Release
file created
at: $(releasefiledate 'aptarchive/dists/unstable/Release')
145 E
: Some index files failed to download. They have been ignored
, or old ones used instead.
" aptget update
146 testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)"
147 rm -rf aptarchive/dists
148 cp -a aptarchive/dists.good aptarchive/dists
149 find aptarchive/dists -name 'InRelease' -delete
151 # … now everything is fine again
152 testsuccessequal "Ign
:1 $1 unstable InRelease
154 Hit
:2 $1 unstable Release
155 Get
:4 $1 unstable
/main amd64 Packages
[$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B
]
156 Reading package lists...
" aptget update
157 testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
159 webserverconfig 'aptwebserver::support::modified-since' 'false'
160 webserverconfig 'aptwebserver::support::last-modified' 'false'
161 testsuccessequal "Ign
:1 $1 unstable InRelease
163 Get
:2 $1 unstable Release
[$(stat -c '%s' 'aptarchive/dists/unstable/Release') B
]
164 Reading package lists...
" aptget update
165 webserverconfig 'aptwebserver::support::modified-since' 'true'
166 webserverconfig 'aptwebserver::support::last-modified' 'true'
168 rm -rf aptarchive/dists
169 cp -a aptarchive/dists.good aptarchive/dists
171 # new release file, but the indexes are the same
172 redatereleasefiles '+2 hours'
174 rm -rf rootdir/var/lib/apt/lists.good
175 cp -a rootdir/var/lib/apt/lists rootdir/var/lib/apt/lists.good
176 testsuccessequal "Get
:1 $1 unstable InRelease
[$(stat -c '%s' 'aptarchive/dists/unstable/InRelease') B
]
177 Reading package lists...
" aptget update
179 rm -rf rootdir/var/lib/apt/lists
180 cp -a rootdir/var/lib/apt/lists.good rootdir/var/lib/apt/lists
181 find rootdir/var/lib/apt/lists -name '*_Packages*' -delete
182 testsuccessequal "Get
:1 $1 unstable InRelease
[$(stat -c '%s' 'aptarchive/dists/unstable/InRelease') B
]
183 Get
:2 $1 unstable
/main amd64 Packages
[$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B
]
184 Get
:3 $1 unstable
/main i386 Packages
[$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-i386/Packages.gz') B
]
185 Reading package lists...
" aptget update
187 rm -rf aptarchive/dists
188 cp -a aptarchive/dists.good aptarchive/dists
192 methodtest "http
://localhost
:${APTHTTPPORT}"
194 changetohttpswebserver
195 methodtest "https
://localhost
:${APTHTTPSPORT}"