]>
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" | |
c5ede4ca | 9 | confighashes 'SHA512' |
42d41ddb DK |
10 | |
11 | buildsimplenativepackage 'apt' 'all' '1.0' 'stable' | |
12 | buildsimplenativepackage 'apt' 'all' '2.0' 'unstable' | |
567785b9 | 13 | insertinstalledpackage 'vrms' 'all' '1.0' |
42d41ddb | 14 | |
30c8107e | 15 | addtrap 'prefix' "umask $(umask);" |
5684f71f | 16 | umask 0027 |
68ba0b7f | 17 | setupaptarchive --no-update |
5684f71f | 18 | |
68ba0b7f DK |
19 | # directories should be readable by everyone |
20 | find aptarchive/dists -type d | while read dir; do | |
21 | chmod o+rx "$dir" | |
22 | done | |
5684f71f DK |
23 | # apt-ftparchive knows how to chmod files |
24 | find aptarchive/dists -name '*Packages*' -type f | while read file; do | |
25 | testaccessrights "$file" '644' | |
68ba0b7f | 26 | chmod 640 "$file" |
5684f71f DK |
27 | done |
28 | # created by the framework without special care | |
29 | find aptarchive/dists -name '*Release*' -type f | while read file; do | |
30 | testaccessrights "$file" '640' | |
31 | done | |
30c8107e | 32 | if [ "$(id -u)" = '0' ]; then |
514a25cb | 33 | # Release file can't be accessed by _apt |
87d6947d | 34 | testsuccesswithnotice aptget update |
30c8107e DK |
35 | fi |
36 | ||
37 | #everything (too) permissive | |
38 | find aptarchive/ -type f | while read file; do | |
39 | chmod 777 "$file" | |
40 | done | |
41 | find incoming/ -type f | while read file; do | |
42 | chmod 777 "$file" | |
43 | done | |
68ba0b7f DK |
44 | testsuccess aptget update |
45 | ||
42d41ddb | 46 | testdownload() { |
30c8107e DK |
47 | local DEB="$1" |
48 | shift | |
49 | msgtest "Test download of package file $DEB with" "$@" | |
50 | testsuccess --nomsg aptget download "$@" -o Debug::pkgAcquire::Worker=1 -o Debug::pkgAcquire::Auth=1 | |
51 | testsuccess test -f "$DEB" | |
52 | testaccessrights "$DEB" '644' | |
53 | rm -f "$DEB" | |
42d41ddb DK |
54 | } |
55 | ||
43acd019 | 56 | # normal case as "root" |
03aa0847 DK |
57 | OLDPWD="$(pwd)" |
58 | cd downloaded | |
43acd019 | 59 | testdownload apt_2.0_all.deb apt |
03aa0847 | 60 | cd "$OLDPWD" |
43acd019 DK |
61 | |
62 | # simulate normal user with non-existent root-owned directories | |
63 | rm -rf rootdir/var/cache/apt/archives/ | |
64 | mkdir rootdir/var/cache/apt/archives/ | |
65 | addtrap 'prefix' "chmod -f -R +w $PWD/rootdir/var/cache/apt/archives || true;" | |
66 | chmod -R -w rootdir/var/cache/apt/archives | |
67 | ||
03aa0847 DK |
68 | OLDPWD="$(pwd)" |
69 | cd downloaded | |
70 | ||
6ae22905 | 71 | # normal case(es) |
30c8107e | 72 | testdownload apt_1.0_all.deb apt/stable |
42d41ddb DK |
73 | testdownload apt_2.0_all.deb apt |
74 | ||
03aa0847 | 75 | DEBFILE="$(readlink -f ../aptarchive)/pool/apt_2.0_all.deb" |
63c71412 | 76 | 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 |
77 | |
78 | # deb:677887 | |
03aa0847 | 79 | testequal "E: Can't find a source to download version '1.0' of 'vrms:i386'" aptget download vrms --print-uris |
567785b9 | 80 | testequal "E: Can't find a source to download version '1.0' of 'vrms:i386'" aptget download vrms |
6ae22905 | 81 | |
e2095426 DK |
82 | # deb:736962 |
83 | testsuccess aptget download apt | |
30c8107e DK |
84 | testsuccess test -s apt_2.0_all.deb |
85 | testaccessrights 'apt_2.0_all.deb' '644' | |
e2095426 DK |
86 | testsuccess aptget download apt |
87 | testsuccess test -s apt_2.0_all.deb | |
30c8107e | 88 | testaccessrights 'apt_2.0_all.deb' '644' |
e2095426 DK |
89 | |
90 | rm -f apt_1.0_all.deb apt_2.0_all.deb | |
91 | ||
92 | # deb:738103 | |
30c8107e | 93 | testdownload apt_2.0_all.deb apt apt apt/unstable apt=2.0 |
8f3594c3 | 94 | |
30c8107e | 95 | # FIXME: pick up already downloaded deb files for real |
43acd019 | 96 | # restore "root" rights |
30c8107e DK |
97 | #cd "$OLDPWD" |
98 | #chmod -f -R +w "$PWD/rootdir/var/cache/apt/archives" | |
99 | #rm -rf rootdir/var/cache/apt/archives/ | |
43acd019 DK |
100 | |
101 | # file: debs aren't copied to archives, so change to http which obviously are | |
30c8107e DK |
102 | #changetowebserver |
103 | #testsuccess aptget update | |
43acd019 DK |
104 | |
105 | # test with already stored deb | |
30c8107e DK |
106 | #testsuccess aptget install -d apt |
107 | #testsuccess test -s rootdir/var/cache/apt/archives/apt_2.0_all.deb | |
108 | #testaccessrights 'rootdir/var/cache/apt/archives/apt_2.0_all.deb' '644' | |
109 | #mv aptarchive/pool/apt_2.0_all.deb aptarchive/pool/apt_2.0_all.deb.gone | |
110 | #cd downloaded | |
111 | #testdownload apt_2.0_all.deb apt | |
112 | #cd "$OLDPWD" | |
113 | #mv aptarchive/pool/apt_2.0_all.deb.gone aptarchive/pool/apt_2.0_all.deb |