]>
Commit | Line | Data |
---|---|---|
e5837128 MV |
1 | #!/bin/sh |
2 | set -e | |
3 | ||
4 | TESTDIR=$(readlink -f $(dirname $0)) | |
5 | . $TESTDIR/framework | |
6 | ||
7 | setupenvironment | |
d56e2917 | 8 | configarchitecture 'native' |
e5837128 | 9 | |
d56e2917 DK |
10 | buildsimplenativepackage 'foo' 'all' '1.0' 'stable' |
11 | buildsimplenativepackage 'libbar' 'all' '1.0' 'stable' | |
12 | ||
13 | getlabelfromsuite() { echo 'Testcases'; } | |
14 | getoriginfromsuite() { echo 'Debian'; } | |
e5837128 | 15 | |
75b09312 | 16 | setupaptarchive --no-update |
13845042 | 17 | changetowebserver |
75b09312 | 18 | testsuccess aptget update |
e5837128 | 19 | |
d56e2917 DK |
20 | testsuccessequal "'http://metadata.ftp-master.debian.org/changelogs/main/f/foo/foo_1.0_changelog' foo.changelog |
21 | 'http://metadata.ftp-master.debian.org/changelogs/main/libb/libbar/libbar_1.0_changelog' libbar.changelog" aptget changelog foo libbar --print-uris | |
22 | ||
23 | releasechanger() { | |
24 | # modifying the Release files in lists… bad stuff. Good that this is only a test… | |
25 | sed -i "s#^${1}: .*#${1}: ${2}#" $(find rootdir/var/lib/apt/lists -name '*Release') | |
26 | rm -f rootdir/var/cache/apt/*.bin | |
27 | } | |
28 | releasechanger 'Origin' 'Ubuntu' | |
29 | testsuccessequal "'http://changelogs.ubuntu.com/changelogs/pool/main/f/foo/foo_1.0/changelog' foo.changelog | |
30 | 'http://changelogs.ubuntu.com/changelogs/pool/main/libb/libbar/libbar_1.0/changelog' libbar.changelog" aptget changelog foo libbar --print-uris | |
31 | ||
32 | releasechanger 'Label' 'Debian' | |
33 | testsuccessequal "'http://changelogs.ubuntu.com/changelogs/pool/main/f/foo/foo_1.0/changelog' foo.changelog | |
34 | 'http://changelogs.ubuntu.com/changelogs/pool/main/libb/libbar/libbar_1.0/changelog' libbar.changelog" aptget changelog foo libbar --print-uris | |
35 | ||
6c0765c0 DK |
36 | testsuccessequal "'http://localhost:${APTHTTPPORT}/main/f/foo/foo_1.0.changelog' foo.changelog |
37 | 'http://localhost:${APTHTTPPORT}/main/libb/libbar/libbar_1.0.changelog' libbar.changelog" aptget changelog foo libbar --print-uris -o Acquire::Changelogs::URI::Label::Debian="http://localhost:${APTHTTPPORT}/CHANGEPATH.changelog" | |
d56e2917 DK |
38 | |
39 | sed -i '/^Origin: / a\ | |
40 | Changelogs: http://example.org/CHANGEPATH-changelog' $(find rootdir/var/lib/apt/lists -name '*Release') | |
41 | rm -f rootdir/var/cache/apt/*.bin | |
43acd019 | 42 | |
d56e2917 | 43 | testsuccessequal "'http://example.org/main/f/foo/foo_1.0-changelog' foo.changelog |
6c0765c0 | 44 | 'http://example.org/main/libb/libbar/libbar_1.0-changelog' libbar.changelog" aptget changelog foo libbar --print-uris -o Acquire::Changelogs::URI::Label::Debian="http://localhost:${APTHTTPPORT}/CHANGEPATH.changelog" |
e5837128 | 45 | |
6c0765c0 DK |
46 | testsuccessequal "'http://localhost:${APTHTTPPORT}/main/f/foo/foo_1.0.changelog' foo.changelog |
47 | 'http://localhost:${APTHTTPPORT}/main/libb/libbar/libbar_1.0.changelog' libbar.changelog" aptget changelog foo libbar --print-uris -o Acquire::Changelogs::URI::Override::Label::Debian="http://localhost:${APTHTTPPORT}/CHANGEPATH.changelog" | |
fcb144b9 | 48 | |
d56e2917 | 49 | releasechanger 'Changelogs' 'no' |
7c8206bf DK |
50 | if [ "$(id -u)" = '0' ]; then |
51 | testfailuremsg "W: Can't drop privileges for downloading as file 'foo.changelog' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied) | |
52 | E: Failed to fetch changelog:/foo.changelog Changelog unavailable for foo=1.0" aptget changelog foo -d | |
53 | else | |
54 | testfailuremsg 'E: Failed to fetch changelog:/foo.changelog Changelog unavailable for foo=1.0' aptget changelog foo -d | |
55 | fi | |
d56e2917 DK |
56 | |
57 | sed -i '/^Changelogs: / d' $(find rootdir/var/lib/apt/lists -name '*Release') | |
58 | releasechanger 'Label' 'Testcases' | |
59 | ||
6c0765c0 DK |
60 | echo "Acquire::Changelogs::URI::Label::Testcases \"http://localhost:${APTHTTPPORT}/CHANGEPATH/change.txt\";" > rootdir/etc/apt/apt.conf.d/changelog.conf |
61 | testsuccessequal "'http://localhost:${APTHTTPPORT}/main/f/foo/foo_1.0/change.txt' foo.changelog | |
62 | 'http://localhost:${APTHTTPPORT}/main/libb/libbar/libbar_1.0/change.txt' libbar.changelog" aptget changelog foo libbar --print-uris | |
d56e2917 | 63 | |
6c0765c0 DK |
64 | echo "Acquire::Changelogs::URI::Label::Testcases \"http://localhost:${APTHTTPPORT}/pool/CHANGEPATH/changelog\";" > rootdir/etc/apt/apt.conf.d/changelog.conf |
65 | testsuccessequal "'http://localhost:${APTHTTPPORT}/pool/main/f/foo/foo_1.0/changelog' foo.changelog" aptget changelog foo --print-uris | |
03aa0847 | 66 | |
a98b6615 | 67 | |
d56e2917 | 68 | testsuccess aptget changelog foo -qq |
d1256170 | 69 | testfileequal 'rootdir/tmp/testsuccess.output' "$(cat aptarchive/pool/main/f/foo/foo_1.0/changelog)" |
d56e2917 DK |
70 | |
71 | testsuccess aptget changelog foo libbar -qq | |
d1256170 DK |
72 | testfileequal 'rootdir/tmp/testsuccess.output' "$(cat aptarchive/pool/main/f/foo/foo_1.0/changelog) |
73 | $(cat aptarchive/pool/main/libb/libbar/libbar_1.0/changelog)" | |
74 | ||
75 | cd downloaded | |
d56e2917 DK |
76 | |
77 | testsuccess aptget changelog foo -d | |
78 | testfilestats 'foo.changelog' '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644" | |
79 | testfileequal 'foo.changelog' "$(cat ../aptarchive/pool/main/f/foo/foo_1.0/changelog)" | |
80 | rm -f foo.changelog | |
72dd5bec | 81 | |
d56e2917 DK |
82 | testsuccess aptget changelog libbar foo -d |
83 | testfilestats 'libbar.changelog' '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644" | |
84 | testfilestats 'foo.changelog' '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644" | |
85 | testfileequal 'libbar.changelog' "$(cat ../aptarchive/pool/main/libb/libbar/libbar_1.0/changelog)" | |
86 | testfileequal 'foo.changelog' "$(cat ../aptarchive/pool/main/f/foo/foo_1.0/changelog)" | |
87 | rm -f libbar.changelog foo.changelog | |
13845042 | 88 | |
d56e2917 | 89 | # as such bogus, but can happen with multiple binaries from the same source |
6c0765c0 DK |
90 | testsuccessequal "'http://localhost:${APTHTTPPORT}/pool/main/f/foo/foo_1.0/changelog' foo.changelog |
91 | 'http://localhost:${APTHTTPPORT}/pool/main/f/foo/foo_1.0/changelog' foo.changelog" aptget changelog foo foo --print-uris | |
d56e2917 DK |
92 | testsuccess aptget changelog foo foo -qq |
93 | testfileequal '../rootdir/tmp/testsuccess.output' "$(cat ../aptarchive/pool/main/f/foo/foo_1.0/changelog) | |
94 | $(cat ../aptarchive/pool/main/f/foo/foo_1.0/changelog)" | |
95 | testsuccess aptget changelog foo foo -d | |
96 | testfilestats 'foo.changelog' '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644" | |
97 | testfileequal 'foo.changelog' "$(cat ../aptarchive/pool/main/f/foo/foo_1.0/changelog)" | |
98 | rm -f foo.changelog | |
72dd5bec | 99 | |
d56e2917 DK |
100 | # no CHANGEPATH in the URI |
101 | testequal 'E: Failed to fetch changelog:/foo.changelog Changelog unavailable for foo=1.0 | |
6c0765c0 | 102 | ' aptget changelog foo -qq -d -o Acquire::Changelogs::URI::Label::Testcases="http://localhost:${APTHTTPPORT}/change.txt" |
d56e2917 | 103 | testfailure test -e foo.changelog |
13845042 | 104 | |
6c0765c0 DK |
105 | testequal "E: Failed to fetch http://localhost:${APTHTTPPORT}/does/not/exist/main/f/foo/foo_1.0/change.txt Changelog unavailable for foo=1.0 (404 Not Found) |
106 | " aptget changelog foo -qq -d -o Acquire::Changelogs::URI::Label::Testcases="http://localhost:${APTHTTPPORT}/does/not/exist/CHANGEPATH/change.txt" | |
d56e2917 | 107 | testfailure test -e foo.changelog |