]>
Commit | Line | Data |
---|---|---|
1 | #!/bin/sh | |
2 | set -e | |
3 | ||
4 | TESTDIR="$(readlink -f "$(dirname "$0")")" | |
5 | . "$TESTDIR/framework" | |
6 | setupenvironment | |
7 | configarchitecture 'amd64' | |
8 | configcompression '.' 'gz' | |
9 | ||
10 | buildsimplenativepackage 'unrelated' 'all' '0.5~squeeze1' 'unstable' | |
11 | ||
12 | export APT_DONT_SIGN='' | |
13 | setupaptarchive --no-update | |
14 | changetowebserver | |
15 | webserverconfig 'aptwebserver::redirect::replace::/redirectme/' "http://0.0.0.0:${APTHTTPPORT}/" | |
16 | rewritesourceslist "http://localhost:${APTHTTPPORT}/redirectme" | |
17 | ||
18 | testsuccessequal "Get:1 http://0.0.0.0:${APTHTTPPORT} unstable InRelease [$(stat -c %s aptarchive/dists/unstable/InRelease) B] | |
19 | Get:2 http://0.0.0.0:${APTHTTPPORT} unstable/main Sources [$(stat -c %s aptarchive/dists/unstable/main/source/Sources.gz) B] | |
20 | Get:3 http://0.0.0.0:${APTHTTPPORT} unstable/main all Packages [$(stat -c %s aptarchive/dists/unstable/main/binary-all/Packages.gz) B] | |
21 | Get:4 http://0.0.0.0:${APTHTTPPORT} unstable/main Translation-en [$(stat -c %s aptarchive/dists/unstable/main/i18n/Translation-en.gz) B] | |
22 | Reading package lists..." aptget update | |
23 | ||
24 | # ensure we asked the redirector only once | |
25 | testsuccessequal "Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/InRelease" grep '^Location:' aptarchive/webserver.log | |
26 | ||
27 | testsuccessequal "Hit:1 http://0.0.0.0:${APTHTTPPORT} unstable InRelease | |
28 | Reading package lists..." aptget update | |
29 | ||
30 | testsuccessequal "Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/InRelease | |
31 | Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/InRelease" grep '^Location:' aptarchive/webserver.log | |
32 | ||
33 | rm -rf rootdir/var/lib/apt/lists | |
34 | testsuccess apt update -o Debug::Acquire::http=1 -o Acquire::SameMirrorForAllIndexes=0 | |
35 | testsuccessequal "Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/InRelease | |
36 | Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/InRelease | |
37 | Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/InRelease | |
38 | Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/main/source/Sources.gz | |
39 | Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/main/binary-all/Packages.gz | |
40 | Location: http://0.0.0.0:${APTHTTPPORT}/dists/unstable/main/i18n/Translation-en.gz" grep '^Location:' aptarchive/webserver.log | |
41 | ||
42 | cd downloaded | |
43 | testsuccess apthelper download-file "http://localhost:${APTHTTPPORT}/redirectme/dists/unstable/InRelease" inrelease | |
44 | testsuccess test -s inrelease | |
45 | cd - >/dev/null | |
46 | ||
47 | webserverconfig "aptwebserver::redirect::replace::http://0.0.0.0:${APTHTTPPORT}/dists/unstable/InRelease" "http://0.0.0.0:${APTHTTPPORT}/storage/dists/unstable/InRelease" | |
48 | mkdir -p aptarchive/storage/dists/unstable | |
49 | mv aptarchive/dists/unstable/InRelease aptarchive/storage/dists/unstable | |
50 | rm -rf rootdir/var/lib/apt/lists | |
51 | testsuccessequal "Get:1 http://0.0.0.0:${APTHTTPPORT}/storage unstable InRelease [$(stat -c %s aptarchive/storage/dists/unstable/InRelease) B] | |
52 | Ign:2 http://0.0.0.0:${APTHTTPPORT}/storage unstable/main Sources | |
53 | 404 Not Found | |
54 | Ign:3 http://0.0.0.0:${APTHTTPPORT}/storage unstable/main all Packages | |
55 | 404 Not Found | |
56 | Ign:4 http://0.0.0.0:${APTHTTPPORT}/storage unstable/main Translation-en | |
57 | 404 Not Found | |
58 | Get:2 http://0.0.0.0:${APTHTTPPORT} unstable/main Sources [$(stat -c %s aptarchive/dists/unstable/main/source/Sources.gz) B] | |
59 | Get:3 http://0.0.0.0:${APTHTTPPORT} unstable/main all Packages [$(stat -c %s aptarchive/dists/unstable/main/binary-all/Packages.gz) B] | |
60 | Get:4 http://0.0.0.0:${APTHTTPPORT} unstable/main Translation-en [$(stat -c %s aptarchive/dists/unstable/main/i18n/Translation-en.gz) B] | |
61 | Reading package lists... | |
62 | Building dependency tree... | |
63 | All packages are up to date." apt update | |
64 | ||
65 | find aptarchive -name 'InRelease' -delete | |
66 | rm -rf rootdir/var/lib/apt/lists | |
67 | ||
68 | testsuccessequal "Ign:1 http://0.0.0.0:${APTHTTPPORT}/storage unstable InRelease | |
69 | 404 Not Found | |
70 | Get:2 http://0.0.0.0:${APTHTTPPORT} unstable Release [$(stat -c %s aptarchive/dists/unstable/Release) B] | |
71 | Get:3 http://0.0.0.0:${APTHTTPPORT} unstable Release.gpg [$(stat -c %s aptarchive/dists/unstable/Release.gpg) B] | |
72 | Get:4 http://0.0.0.0:${APTHTTPPORT} unstable/main Sources [$(stat -c %s aptarchive/dists/unstable/main/source/Sources.gz) B] | |
73 | Get:5 http://0.0.0.0:${APTHTTPPORT} unstable/main all Packages [$(stat -c %s aptarchive/dists/unstable/main/binary-all/Packages.gz) B] | |
74 | Get:6 http://0.0.0.0:${APTHTTPPORT} unstable/main Translation-en [$(stat -c %s aptarchive/dists/unstable/main/i18n/Translation-en.gz) B] | |
75 | Reading package lists..." aptget update | |
76 | ||
77 | testsuccessequal "Ign:1 http://0.0.0.0:${APTHTTPPORT}/storage unstable InRelease | |
78 | 404 Not Found | |
79 | Hit:2 http://0.0.0.0:${APTHTTPPORT} unstable Release | |
80 | Reading package lists..." aptget update | |
81 | ||
82 | rm -rf rootdir/var/lib/apt/lists | |
83 | find aptarchive -name 'Release.gpg' -delete | |
84 | find aptarchive -name 'Release' -delete | |
85 | testwarning aptget update | |
86 | testsuccess grep 'does not have a Release file' rootdir/tmp/testwarning.output |