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