test-apt-get-download 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/sh
  2. set -e
  3. TESTDIR=$(readlink -f $(dirname $0))
  4. . $TESTDIR/framework
  5. setupenvironment
  6. configarchitecture "i386"
  7. buildsimplenativepackage 'apt' 'all' '1.0' 'stable'
  8. buildsimplenativepackage 'apt' 'all' '2.0' 'unstable'
  9. insertinstalledpackage 'vrms' 'all' '1.0'
  10. setupaptarchive
  11. testdownload() {
  12. local APT="$2"
  13. if [ -n "$3" ]; then
  14. APT="${APT}/${3}"
  15. fi
  16. msgtest "Test download of package file $1 with" "$APT"
  17. testsuccess --nomsg aptget download ${APT}
  18. testsuccess test -f $1
  19. rm $1
  20. }
  21. # normal case(es)
  22. testdownload apt_1.0_all.deb apt stable
  23. testdownload apt_2.0_all.deb apt
  24. DEBFILE="$(readlink -f aptarchive)/pool/apt_2.0_all.deb"
  25. testequal "'file://${DEBFILE}' apt_2.0_all.deb $(stat -c%s $DEBFILE) SHA512:$(sha512sum $DEBFILE | cut -d' ' -f 1)" aptget download apt --print-uris
  26. # deb:677887
  27. testequal "E: Can't find a source to download version '1.0' of 'vrms:i386'" aptget download vrms
  28. # deb:736962
  29. testsuccess aptget download apt
  30. testsuccess aptget download apt
  31. testsuccess test -s apt_2.0_all.deb
  32. rm -f apt_1.0_all.deb apt_2.0_all.deb
  33. # deb:738103
  34. testsuccess aptget download apt apt apt/unstable apt=2.0
  35. testsuccess test -s apt_2.0_all.deb