summaryrefslogtreecommitdiff
path: root/test/integration/test-apt-get-changelog
blob: 01f2bd393be32f25c0a1de9af54b178ab0c5d199 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh
set -e

TESTDIR=$(readlink -f $(dirname $0))
. $TESTDIR/framework

setupenvironment
configarchitecture "i386"

buildsimplenativepackage 'apt' 'all' '1.0' 'stable'

setupaptarchive --no-update
changetowebserver
testsuccess aptget update

# simulate normal user with non-existent root-owned directories
rm -rf rootdir/var/cache/apt/archives/
mkdir rootdir/var/cache/apt/archives/
addtrap 'prefix' "chmod -f -R +w $PWD/rootdir/var/cache/apt/archives || true;"
chmod -R -w rootdir/var/cache/apt/archives

echo 'Apt::Changelogs::Server "http://localhost:8080/";' > rootdir/etc/apt/apt.conf.d/changelog.conf

testequal "'http://localhost:8080/pool/apt_1.0/changelog'" aptget changelog apt --print-uris

testequal "'http://localhost:8080/pool/apt_1.0/changelog'
'http://localhost:8080/pool/apt_1.0/changelog'" aptget changelog apt apt --print-uris

cd downloaded

testsuccess aptget changelog apt -qq
testfileequal '../rootdir/tmp/testsuccess.output' "$(cat ../aptarchive/pool/apt_1.0/changelog)"

testsuccess aptget changelog apt -d
testfileequal 'apt.changelog' "$(cat  ../aptarchive/pool/apt_1.0/changelog)"
testfilestats 'apt.changelog' '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644"
rm -f apt.changelog ../aptarchive/pool/apt_1.0/changelog

testequal "$(cat ../aptarchive/pool/apt_1.0.changelog)" aptget changelog apt \
	-qq -o APT::Changelogs::Server='http://not-on-the-main-server:8080/'

testsuccess aptget changelog apt -d
testfileequal 'apt.changelog' "$(cat ../aptarchive/pool/apt_1.0.changelog)"
testfilestats 'apt.changelog' '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644"
rm -f apt.changelog ../aptarchive/pool/apt_1.0.changelog

testequal 'E: changelog download failed' aptget changelog apt -qq -d -o APT::Changelogs::Server='http://not-on-the-main-server:8080/'
testfailure test -e apt.changelog