]>
Commit | Line | Data |
---|---|---|
42d41ddb DK |
1 | #!/bin/sh |
2 | set -e | |
3 | ||
4 | TESTDIR=$(readlink -f $(dirname $0)) | |
5 | . $TESTDIR/framework | |
6 | ||
7 | setupenvironment | |
8 | configarchitecture "i386" | |
9 | ||
10 | buildsimplenativepackage 'apt' 'all' '1.0' 'stable' | |
11 | buildsimplenativepackage 'apt' 'all' '2.0' 'unstable' | |
567785b9 | 12 | insertinstalledpackage 'vrms' 'all' '1.0' |
42d41ddb | 13 | |
5684f71f DK |
14 | umask 0027 |
15 | ||
42d41ddb DK |
16 | setupaptarchive |
17 | ||
5684f71f DK |
18 | # apt-ftparchive knows how to chmod files |
19 | find aptarchive/dists -name '*Packages*' -type f | while read file; do | |
20 | testaccessrights "$file" '644' | |
21 | done | |
22 | # created by the framework without special care | |
23 | find aptarchive/dists -name '*Release*' -type f | while read file; do | |
24 | testaccessrights "$file" '640' | |
25 | done | |
26 | # all copied files are properly chmodded | |
27 | find rootdir/var/lib/apt/lists -type f | while read file; do | |
28 | testaccessrights "$file" '644' | |
29 | done | |
30 | ||
42d41ddb | 31 | testdownload() { |
2aa7df1d DK |
32 | local APT="$2" |
33 | if [ -n "$3" ]; then | |
34 | APT="${APT}/${3}" | |
42d41ddb | 35 | fi |
2aa7df1d | 36 | msgtest "Test download of package file $1 with" "$APT" |
0954c58e | 37 | testsuccess --nomsg aptget download ${APT} |
43acd019 DK |
38 | testsuccess test -f "$1" |
39 | rm -f "$1" | |
42d41ddb DK |
40 | } |
41 | ||
43acd019 DK |
42 | # normal case as "root" |
43 | testdownload apt_2.0_all.deb apt | |
44 | ||
45 | # simulate normal user with non-existent root-owned directories | |
46 | rm -rf rootdir/var/cache/apt/archives/ | |
47 | mkdir rootdir/var/cache/apt/archives/ | |
48 | addtrap 'prefix' "chmod -f -R +w $PWD/rootdir/var/cache/apt/archives || true;" | |
49 | chmod -R -w rootdir/var/cache/apt/archives | |
50 | ||
6ae22905 | 51 | # normal case(es) |
42d41ddb DK |
52 | testdownload apt_1.0_all.deb apt stable |
53 | testdownload apt_2.0_all.deb apt | |
54 | ||
55 | DEBFILE="$(readlink -f aptarchive)/pool/apt_2.0_all.deb" | |
d57f6084 | 56 | testequal "'file://${DEBFILE}' apt_2.0_all.deb $(stat -c%s $DEBFILE) SHA512:$(sha512sum $DEBFILE | cut -d' ' -f 1)" aptget download apt --print-uris |
567785b9 DK |
57 | |
58 | # deb:677887 | |
59 | testequal "E: Can't find a source to download version '1.0' of 'vrms:i386'" aptget download vrms | |
6ae22905 | 60 | |
e2095426 DK |
61 | # deb:736962 |
62 | testsuccess aptget download apt | |
63 | testsuccess aptget download apt | |
64 | testsuccess test -s apt_2.0_all.deb | |
65 | ||
66 | rm -f apt_1.0_all.deb apt_2.0_all.deb | |
67 | ||
68 | # deb:738103 | |
69 | testsuccess aptget download apt apt apt/unstable apt=2.0 | |
6ae22905 | 70 | testsuccess test -s apt_2.0_all.deb |
8f3594c3 | 71 | |
43acd019 DK |
72 | # restore "root" rights |
73 | chmod -f -R +w $PWD/rootdir/var/cache/apt/archives | |
74 | rm -rf rootdir/var/cache/apt/archives/ | |
75 | ||
76 | # file: debs aren't copied to archives, so change to http which obviously are | |
77 | changetowebserver | |
78 | testsuccess aptget update | |
79 | ||
80 | # test with already stored deb | |
81 | testsuccess aptget install -d apt | |
82 | testsuccess test -s rootdir/var/cache/apt/archives/apt_2.0_all.deb | |
5684f71f | 83 | testaccessrights 'aptarchive/pool/apt_2.0_all.deb' '644' |
43acd019 DK |
84 | mv aptarchive/pool/apt_2.0_all.deb aptarchive/pool/apt_2.0_all.deb.gone |
85 | testdownload apt_2.0_all.deb apt | |
86 | mv aptarchive/pool/apt_2.0_all.deb.gone aptarchive/pool/apt_2.0_all.deb |