test-apt-keep-downloaded-pkgs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture 'native'
  7. buildsimplenativepackage 'pkg1' 'all' '1.0' 'stable'
  8. buildsimplenativepackage 'pkg2' 'all' '1.0' 'stable'
  9. buildsimplenativepackage 'pkg3' 'all' '1.0' 'stable'
  10. buildsimplenativepackage 'pkg4' 'all' '1.0' 'stable'
  11. # local (file) installs
  12. setupaptarchive
  13. # ensure that install from local sources does not remove debs
  14. testsuccess aptget install pkg1 -o APT::Keep-Downloaded-Packages=false
  15. testsuccess test -f aptarchive/pool/pkg1_1.0_all.deb
  16. # now switch to http and downloading debs
  17. changetowebserver
  18. testsuccess aptget update
  19. # ensure that the downloaded pkg is kept with "keep=true"
  20. testsuccess aptget install pkg2 -o APT::Keep-Downloaded-Packages=true
  21. testsuccess test -f aptarchive/pool/pkg2_1.0_all.deb
  22. testsuccess test -f rootdir/var/cache/apt/archives/pkg2_1.0_all.deb
  23. # ensure that the downloaded pkg is removed when requested
  24. testsuccess aptget install pkg3 -o APT::Keep-Downloaded-Packages=false
  25. testsuccess test -f aptarchive/pool/pkg3_1.0_all.deb
  26. # this was there before, keep it
  27. testsuccess test -f rootdir/var/cache/apt/archives/pkg2_1.0_all.deb
  28. # this got installed so we can remove it now
  29. testfailure test -f rootdir/var/cache/apt/archives/pkg3_1.0_all.deb
  30. # ensure that install from the download dir does not delete packages
  31. mv aptarchive/pool/pkg4_1.0_all.deb rootdir/var/cache/apt/archives
  32. testsuccess aptget install $(pwd)/rootdir/var/cache/apt/archives/pkg4_1.0_all.deb -o APT::Keep-Downloaded-Packages=false
  33. testsuccess test -f $(pwd)/rootdir/var/cache/apt/archives/pkg4_1.0_all.deb