merged lp:~mvo/apt/add-missing-dsc-hashes
[ntk/apt.git] / test / integration / test-apt-get-download
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'
12 insertinstalledpackage 'vrms' 'all' '1.0'
13
14 setupaptarchive
15
16 testdownload() {
17 local APT="$2"
18 if [ -n "$3" ]; then
19 APT="${APT}/${3}"
20 fi
21 msgtest "Test download of package file $1 with" "$APT"
22 aptget -qq download ${APT} && test -f $1 && msgpass || msgfail
23 }
24
25 testdownload apt_1.0_all.deb apt stable
26 testdownload apt_2.0_all.deb apt
27
28 DEBFILE="$(readlink -f aptarchive)/pool/apt_2.0_all.deb"
29 testequal "'file://${DEBFILE}' apt_2.0_all.deb $(stat -c%s $DEBFILE) sha512:$(sha512sum $DEBFILE | cut -d' ' -f 1)" aptget download apt --print-uris
30
31 # deb:677887
32 testequal "E: Can't find a source to download version '1.0' of 'vrms:i386'" aptget download vrms