You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

71 lines
2.0 KiB

  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 -f "$1"
  20. }
  21. # normal case as "root"
  22. testdownload apt_2.0_all.deb apt
  23. # simulate normal user with non-existent root-owned directories
  24. rm -rf rootdir/var/cache/apt/archives/
  25. mkdir rootdir/var/cache/apt/archives/
  26. addtrap 'prefix' "chmod -f -R +w $PWD/rootdir/var/cache/apt/archives || true;"
  27. chmod -R -w rootdir/var/cache/apt/archives
  28. # normal case(es)
  29. testdownload apt_1.0_all.deb apt stable
  30. testdownload apt_2.0_all.deb apt
  31. DEBFILE="$(readlink -f aptarchive)/pool/apt_2.0_all.deb"
  32. testequal "'file://${DEBFILE}' apt_2.0_all.deb $(stat -c%s $DEBFILE) SHA512:$(sha512sum $DEBFILE | cut -d' ' -f 1)" aptget download apt --print-uris
  33. # deb:677887
  34. testequal "E: Can't find a source to download version '1.0' of 'vrms:i386'" aptget download vrms
  35. # deb:736962
  36. testsuccess aptget download apt
  37. testsuccess aptget download apt
  38. testsuccess test -s apt_2.0_all.deb
  39. rm -f apt_1.0_all.deb apt_2.0_all.deb
  40. # deb:738103
  41. testsuccess aptget download apt apt apt/unstable apt=2.0
  42. testsuccess test -s apt_2.0_all.deb
  43. # restore "root" rights
  44. chmod -f -R +w $PWD/rootdir/var/cache/apt/archives
  45. rm -rf rootdir/var/cache/apt/archives/
  46. # file: debs aren't copied to archives, so change to http which obviously are
  47. changetowebserver
  48. testsuccess aptget update
  49. # test with already stored deb
  50. testsuccess aptget install -d apt
  51. testsuccess test -s rootdir/var/cache/apt/archives/apt_2.0_all.deb
  52. mv aptarchive/pool/apt_2.0_all.deb aptarchive/pool/apt_2.0_all.deb.gone
  53. testdownload apt_2.0_all.deb apt
  54. mv aptarchive/pool/apt_2.0_all.deb.gone aptarchive/pool/apt_2.0_all.deb