test-pin-non-existent-package 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture "i386"
  7. insertpackage 'unstable' 'rapt' '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 rapt '0.8.15'
  21. testsuccessequal 'N: Unable to locate package doesntexist' aptcache policy doesntexist
  22. testsuccessequal 'Reading package lists...
  23. Building dependency tree...
  24. Calculating upgrade...
  25. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget dist-upgrade --trivial-only
  26. echo 'Package: rapt
  27. Pin: release a=unstable
  28. Pin-Priority: -1' > rootdir/etc/apt/preferences
  29. testcandidate rapt '(none)'
  30. testsuccessequal 'N: Unable to locate package doesntexist' aptcache policy doesntexist
  31. testsuccessequal 'Reading package lists...
  32. Building dependency tree...
  33. Calculating upgrade...
  34. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget dist-upgrade --trivial-only
  35. echo '
  36. Package: doesntexist
  37. Pin: release a=unstable
  38. Pin-Priority: 1000' >> rootdir/etc/apt/preferences
  39. testcandidate rapt '(none)'
  40. echo '
  41. Package: rapt
  42. Pin: release a=unstable
  43. Pin-Priority: 1000' >> rootdir/etc/apt/preferences
  44. testcandidate rapt '(none)'
  45. testsuccessequal 'N: Unable to locate package doesntexist' aptcache policy doesntexist
  46. testsuccessequal 'Reading package lists...
  47. Building dependency tree...
  48. Calculating upgrade...
  49. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget dist-upgrade --trivial-only
  50. echo 'Package: arch:amd64
  51. Pin: release a=unstable
  52. Pin-Priority: -1' > rootdir/etc/apt/preferences
  53. testcandidate arch '1.0'
  54. echo '
  55. Package: arch:i386
  56. Pin: release a=unstable
  57. Pin-Priority: -1' >> rootdir/etc/apt/preferences
  58. testcandidate arch '(none)'