test-pin-non-existent-package 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #!/bin/sh
  2. set -e
  3. TESTDIR=$(readlink -f $(dirname $0))
  4. . $TESTDIR/framework
  5. setupenvironment
  6. configarchitecture "i386"
  7. insertpackage 'unstable' 'apt' 'i386' '0.8.15'
  8. insertpackage 'unstable' 'arch' 'i386' '1.0'
  9. setupaptarchive
  10. testcandidate() {
  11. msgtest "Test that the Candidate for $1 is" $2
  12. if [ "$(aptcache policy $1 | grep '^ Candidate:')" = " Candidate: $2" ]; then
  13. msgpass
  14. else
  15. echo
  16. aptcache policy $1
  17. msgfail
  18. fi
  19. }
  20. testcandidate apt '0.8.15'
  21. testequal 'N: Unable to locate package doesntexist' aptcache policy doesntexist -q=0
  22. testequal 'Reading package lists...
  23. Building dependency tree...
  24. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget dist-upgrade
  25. echo 'Package: apt
  26. Pin: release a=unstable
  27. Pin-Priority: -1' > rootdir/etc/apt/preferences
  28. testcandidate apt '(none)'
  29. testequal 'N: Unable to locate package doesntexist' aptcache policy doesntexist -q=0
  30. testequal 'Reading package lists...
  31. Building dependency tree...
  32. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget dist-upgrade
  33. echo '
  34. Package: doesntexist
  35. Pin: release a=unstable
  36. Pin-Priority: 1000' >> rootdir/etc/apt/preferences
  37. testcandidate apt '(none)'
  38. echo '
  39. Package: apt
  40. Pin: release a=unstable
  41. Pin-Priority: 1000' >> rootdir/etc/apt/preferences
  42. testcandidate apt '(none)'
  43. testequal 'N: Unable to locate package doesntexist' aptcache policy doesntexist -q=0
  44. testequal 'Reading package lists...
  45. Building dependency tree...
  46. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget dist-upgrade
  47. echo 'Package: arch:amd64
  48. Pin: release a=unstable
  49. Pin-Priority: -1' > rootdir/etc/apt/preferences
  50. testcandidate arch '1.0'
  51. echo '
  52. Package: arch:i386
  53. Pin: release a=unstable
  54. Pin-Priority: -1' >> rootdir/etc/apt/preferences
  55. testcandidate arch '(none)'