4 TESTDIR
=$(readlink -f $(dirname $0))
8 configarchitecture
"i386"
10 buildsimplenativepackage
'apt' 'all' '1.0' 'stable'
11 buildsimplenativepackage
'apt' 'all' '2.0' 'unstable'
12 insertinstalledpackage
'vrms' 'all' '1.0'
16 setupaptarchive
--no-update
19 # directories should be readable by everyone
20 find aptarchive
/dists
-type d
| while read dir
; do
23 # apt-ftparchive knows how to chmod files
24 find aptarchive
/dists
-name '*Packages*' -type f
| while read file; do
25 testaccessrights
"$file" '644'
28 # created by the framework without special care
29 find aptarchive
/dists
-name '*Release*' -type f
| while read file; do
30 testaccessrights
"$file" '640'
33 testsuccess aptget update
40 msgtest
"Test download of package file $1 with" "$APT"
41 testsuccess
--nomsg aptget download
${APT} -o Debug
::pkgAcquire
::Worker
=1 -o Debug
::pkgAcquire
::Auth
=1
42 testsuccess
test -f "$1"
46 # normal case as "root"
49 testdownload apt_2.0_all.deb apt
52 # simulate normal user with non-existent root-owned directories
53 rm -rf rootdir
/var
/cache
/apt
/archives
/
54 mkdir rootdir
/var
/cache
/apt
/archives
/
55 addtrap
'prefix' "chmod -f -R +w $PWD/rootdir/var/cache/apt/archives || true;"
56 chmod -R -w rootdir
/var
/cache
/apt
/archives
62 testdownload apt_1.0_all.deb apt stable
63 testdownload apt_2.0_all.deb apt
65 DEBFILE
="$(readlink -f ../aptarchive)/pool/apt_2.0_all.deb"
66 testequal
"'file://${DEBFILE}' apt_2.0_all.deb $(stat -c%s $DEBFILE) SHA512:$(sha512sum $DEBFILE | cut -d' ' -f 1)" aptget download apt
--print-uris
69 testequal
"E: Can't find a source to download version '1.0' of 'vrms:i386'" aptget download vrms
--print-uris
70 testequal
"E: Can't find a source to download version '1.0' of 'vrms:i386'" aptget download vrms
73 testsuccess aptget download apt
74 testsuccess aptget download apt
75 testsuccess
test -s apt_2.0_all.deb
77 rm -f apt_1.0_all.deb apt_2.0_all.deb
80 testsuccess aptget download apt apt apt
/unstable apt
=2.0
81 testsuccess
test -s apt_2.0_all.deb
83 # restore "root" rights
85 chmod -f -R +w
$PWD/rootdir
/var
/cache
/apt
/archives
86 rm -rf rootdir
/var
/cache
/apt
/archives
/
88 # file: debs aren't copied to archives, so change to http which obviously are
90 testsuccess aptget update
92 # test with already stored deb
93 testsuccess aptget
install -d apt
94 testsuccess
test -s rootdir
/var
/cache
/apt
/archives
/apt_2.0_all.deb
95 testaccessrights
'aptarchive/pool/apt_2.0_all.deb' '644'
96 mv aptarchive
/pool
/apt_2.0_all.deb aptarchive
/pool
/apt_2.0_all.deb.gone
98 testdownload apt_2.0_all.deb apt
100 mv aptarchive
/pool
/apt_2.0_all.deb.gone aptarchive
/pool
/apt_2.0_all.deb