4 TESTDIR
="$(readlink -f "$(dirname "$0")")"
8 configarchitecture 'native'
10 buildsimplenativepackage 'dpkg' 'native' '42' 'stable'
11 buildsimplenativepackage 'foo' 'all' '1.0' 'stable'
12 buildsimplenativepackage 'libbar' 'all' '1.0' 'stable'
14 getlabelfromsuite() { echo 'Testcases'; }
15 getoriginfromsuite() { echo 'Debian'; }
17 setupaptarchive --no-update
19 testsuccess aptget update
21 testsuccessequal "'http://metadata.ftp-master.debian.org/changelogs/main/f/foo/foo_1.0_changelog' foo.changelog
22 'http://metadata.ftp-master.debian.org/changelogs/main/libb/libbar/libbar_1.0_changelog' libbar.changelog
" aptget changelog foo libbar --print-uris
25 # modifying the Release files in lists… bad stuff. Good that this is only a test…
26 sed -i "s
#^${1}: .*#${1}: ${2}#" $(find rootdir/var/lib/apt/lists -name '*Release')
27 rm -f rootdir
/var
/cache
/apt
/*.bin
29 releasechanger
'Origin' 'Ubuntu'
30 testsuccessequal
"'http://changelogs.ubuntu.com/changelogs/pool/main/f/foo/foo_1.0/changelog' foo.changelog
31 'http://changelogs.ubuntu.com/changelogs/pool/main/libb/libbar/libbar_1.0/changelog' libbar.changelog" aptget changelog foo libbar
--print-uris
33 releasechanger
'Label' 'Debian'
34 testsuccessequal
"'http://changelogs.ubuntu.com/changelogs/pool/main/f/foo/foo_1.0/changelog' foo.changelog
35 'http://changelogs.ubuntu.com/changelogs/pool/main/libb/libbar/libbar_1.0/changelog' libbar.changelog" aptget changelog foo libbar
--print-uris
37 testsuccessequal
"'http://localhost:${APTHTTPPORT}/main/f/foo/foo_1.0.changelog' foo.changelog
38 '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"
40 sed -i '/^Origin: / a\
41 Changelogs: http://example.org/@CHANGEPATH@-changelog' $(find rootdir/var/lib/apt/lists -name '*Release')
42 rm -f rootdir
/var
/cache
/apt
/*.bin
44 testsuccessequal
"'http://example.org/main/f/foo/foo_1.0-changelog' foo.changelog
45 '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"
47 testsuccessequal
"'http://localhost:${APTHTTPPORT}/main/f/foo/foo_1.0.changelog' foo.changelog
48 '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"
50 releasechanger
'Changelogs' 'no'
51 testfailuremsg
'E: Failed to fetch changelog:/foo.changelog Changelog unavailable for foo=1.0' aptget changelog foo
-d
53 sed -i '/^Changelogs: / d' $(find rootdir/var/lib/apt/lists -name '*Release')
54 releasechanger
'Label' 'Testcases'
56 echo "Acquire::Changelogs::URI::Label::Testcases \"http://localhost:${APTHTTPPORT}/@CHANGEPATH@/change.txt\";" > rootdir
/etc
/apt
/apt.conf.d
/changelog.conf
57 testsuccessequal
"'http://localhost:${APTHTTPPORT}/main/f/foo/foo_1.0/change.txt' foo.changelog
58 'http://localhost:${APTHTTPPORT}/main/libb/libbar/libbar_1.0/change.txt' libbar.changelog" aptget changelog foo libbar
--print-uris
60 echo "Acquire::Changelogs::URI::Label::Testcases \"http://localhost:${APTHTTPPORT}/pool/@CHANGEPATH@/changelog\";" > rootdir
/etc
/apt
/apt.conf.d
/changelog.conf
61 testsuccessequal
"'http://localhost:${APTHTTPPORT}/pool/main/f/foo/foo_1.0/changelog' foo.changelog" aptget changelog foo
--print-uris
64 testsuccess aptget changelog foo
-qq
65 testfileequal
'rootdir/tmp/testsuccess.output' "$(cat aptarchive/pool/main/f/foo/foo_1.0/changelog)"
67 testsuccess aptget changelog foo libbar
-qq
68 testfileequal
'rootdir/tmp/testsuccess.output' "$(cat aptarchive/pool/main/f/foo/foo_1.0/changelog)
69 $(cat aptarchive/pool/main/libb/libbar/libbar_1.0/changelog)"
71 testsuccess aptget changelog foo
-d
72 testfilestats
'foo.changelog' '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644"
73 testfileequal
'foo.changelog' "$(cat aptarchive/pool/main/f/foo/foo_1.0/changelog)"
76 testsuccess aptget changelog libbar foo
-d
77 testfilestats
'libbar.changelog' '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644"
78 testfilestats
'foo.changelog' '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644"
79 testfileequal
'libbar.changelog' "$(cat aptarchive/pool/main/libb/libbar/libbar_1.0/changelog)"
80 testfileequal
'foo.changelog' "$(cat aptarchive/pool/main/f/foo/foo_1.0/changelog)"
81 rm -f libbar.changelog foo.changelog
83 # as such bogus, but can happen with multiple binaries from the same source
84 testsuccessequal
"'http://localhost:${APTHTTPPORT}/pool/main/f/foo/foo_1.0/changelog' foo.changelog
85 'http://localhost:${APTHTTPPORT}/pool/main/f/foo/foo_1.0/changelog' foo.changelog" aptget changelog foo foo
--print-uris
86 testsuccess aptget changelog foo foo
-qq
87 testfileequal
'rootdir/tmp/testsuccess.output' "$(cat aptarchive/pool/main/f/foo/foo_1.0/changelog)
88 $(cat aptarchive/pool/main/f/foo/foo_1.0/changelog)"
89 testsuccess aptget changelog foo foo
-d
90 testfilestats
'foo.changelog' '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644"
91 testfileequal
'foo.changelog' "$(cat aptarchive/pool/main/f/foo/foo_1.0/changelog)"
92 # we have the file already, confused?
93 testsuccess aptget changelog foo foo
-d
94 testfilestats
'foo.changelog' '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644"
95 testfileequal
'foo.changelog' "$(cat aptarchive/pool/main/f/foo/foo_1.0/changelog)"
96 echo 'bogus' > foo.changelog
97 touch -d 'now + 1 hour' foo.changelog
98 testsuccess aptget changelog foo foo
-d
99 testfilestats
'foo.changelog' '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644"
100 testfileequal
'foo.changelog' "$(cat aptarchive/pool/main/f/foo/foo_1.0/changelog)"
101 echo -n 'bogus' > foo.changelog
102 touch -d "$(stat -c%y aptarchive/pool/main/f/foo/foo_1.0/changelog)" foo.changelog
103 testsuccess aptget changelog foo foo
-d
104 testfilestats
'foo.changelog' '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644"
105 testequal
'bogus1.0) stable; urgency=low' head -n 1 foo.changelog
108 # no @CHANGEPATH@ in the URI
109 testequal
'E: Failed to fetch changelog:/foo.changelog Changelog unavailable for foo=1.0' \
110 aptget changelog foo
-qq -d -o Acquire
::Changelogs
::URI
::Label
::Testcases
="http://localhost:${APTHTTPPORT}/change.txt"
111 testfailure
test -e foo.changelog
113 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)" \
114 aptget changelog foo
-qq -d -o Acquire
::Changelogs
::URI
::Label
::Testcases
="http://localhost:${APTHTTPPORT}/does/not/exist/@CHANGEPATH@/change.txt"
115 testfailure
test -e foo.changelog
117 testdpkgnotinstalled
'foo'
118 testsuccessequal
"'http://localhost:${APTHTTPPORT}/pool/main/f/foo/foo_1.0/changelog' foo.changelog" apt changelog foo
--print-uris -o Acquire
::Changelogs
::AlwaysOnline
=false
119 testsuccessequal
"'http://localhost:${APTHTTPPORT}/pool/main/f/foo/foo_1.0/changelog' foo.changelog" apt changelog foo
--print-uris -o Acquire
::Changelogs
::AlwaysOnline
=true
121 testsuccess apt
install dpkg
-y
122 # at this moment, we still have the Releasefile claim to be origin:ubuntu
123 echo 'Acquire::Changelogs::AlwaysOnline::Origin::Ubuntu "false";' >> rootdir
/etc
/apt
/apt.conf.d
/nooriginchangelogs
124 testsuccessequal
"'http://localhost:${APTHTTPPORT}/pool/main/d/dpkg/dpkg_42/changelog' dpkg.changelog" apt changelog dpkg
--print-uris
125 testsuccessequal
"'copy://${TMPWORKINGDIRECTORY}/rootdir/usr/share/doc/dpkg/changelog' dpkg.changelog" apt changelog dpkg
--print-uris -o Acquire
::Changelogs
::AlwaysOnline
=false
126 testsuccessequal
"'http://localhost:${APTHTTPPORT}/pool/main/d/dpkg/dpkg_42/changelog' dpkg.changelog" apt changelog dpkg
--print-uris -o Acquire
::Changelogs
::AlwaysOnline
=true
127 testsuccessequal
"'http://localhost:${APTHTTPPORT}/pool/main/d/dpkg/dpkg_42/changelog' dpkg.changelog" apt changelog dpkg
--print-uris -o Acquire
::Changelogs
::AlwaysOnline
=false
-o Acquire
::Changelogs
::AlwaysOnline
::Origin
::Ubuntu
=true
128 testsuccessequal
"'copy://${TMPWORKINGDIRECTORY}/rootdir/usr/share/doc/dpkg/changelog' dpkg.changelog" apt changelog dpkg
--print-uris -o Acquire
::Changelogs
::AlwaysOnline
=false
-o Acquire
::Changelogs
::AlwaysOnline
::Origin
::Debian
=true
130 testsuccess apt changelog dpkg
-d
131 testfilestats
'dpkg.changelog' '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644"
132 head -n 3 dpkg.changelog
> dpkg.change
133 testfileequal
'dpkg.change' "$(apthelper cat-file 'rootdir/usr/share/doc/dpkg/changelog' | head -n 3)"
134 rm -f dpkg.change dpkg.changelog