]> git.saurik.com Git - apt.git/blame - test/integration/test-apt-get-download
fix leftover files from Acquire::GzipIndex
[apt.git] / test / integration / test-apt-get-download
CommitLineData
42d41ddb
DK
1#!/bin/sh
2set -e
3
4TESTDIR=$(readlink -f $(dirname $0))
5. $TESTDIR/framework
6
7setupenvironment
8configarchitecture "i386"
9
10buildsimplenativepackage 'apt' 'all' '1.0' 'stable'
11buildsimplenativepackage 'apt' 'all' '2.0' 'unstable'
567785b9 12insertinstalledpackage 'vrms' 'all' '1.0'
42d41ddb
DK
13
14setupaptarchive
15
16testdownload() {
2aa7df1d
DK
17 local APT="$2"
18 if [ -n "$3" ]; then
19 APT="${APT}/${3}"
42d41ddb 20 fi
2aa7df1d 21 msgtest "Test download of package file $1 with" "$APT"
0954c58e 22 testsuccess --nomsg aptget download ${APT}
43acd019
DK
23 testsuccess test -f "$1"
24 rm -f "$1"
42d41ddb
DK
25}
26
43acd019
DK
27# normal case as "root"
28testdownload apt_2.0_all.deb apt
29
30# simulate normal user with non-existent root-owned directories
31rm -rf rootdir/var/cache/apt/archives/
32mkdir rootdir/var/cache/apt/archives/
33addtrap 'prefix' "chmod -f -R +w $PWD/rootdir/var/cache/apt/archives || true;"
34chmod -R -w rootdir/var/cache/apt/archives
35
6ae22905 36# normal case(es)
42d41ddb
DK
37testdownload apt_1.0_all.deb apt stable
38testdownload apt_2.0_all.deb apt
39
40DEBFILE="$(readlink -f aptarchive)/pool/apt_2.0_all.deb"
d57f6084 41testequal "'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
42
43# deb:677887
44testequal "E: Can't find a source to download version '1.0' of 'vrms:i386'" aptget download vrms
6ae22905 45
e2095426
DK
46# deb:736962
47testsuccess aptget download apt
48testsuccess aptget download apt
49testsuccess test -s apt_2.0_all.deb
50
51rm -f apt_1.0_all.deb apt_2.0_all.deb
52
53# deb:738103
54testsuccess aptget download apt apt apt/unstable apt=2.0
6ae22905 55testsuccess test -s apt_2.0_all.deb
8f3594c3 56
43acd019
DK
57# restore "root" rights
58chmod -f -R +w $PWD/rootdir/var/cache/apt/archives
59rm -rf rootdir/var/cache/apt/archives/
60
61# file: debs aren't copied to archives, so change to http which obviously are
62changetowebserver
63testsuccess aptget update
64
65# test with already stored deb
66testsuccess aptget install -d apt
67testsuccess test -s rootdir/var/cache/apt/archives/apt_2.0_all.deb
68mv aptarchive/pool/apt_2.0_all.deb aptarchive/pool/apt_2.0_all.deb.gone
69testdownload apt_2.0_all.deb apt
70mv aptarchive/pool/apt_2.0_all.deb.gone aptarchive/pool/apt_2.0_all.deb