test-pin-non-existent-package 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. setupaptarchive
  9. testcandidate() {
  10. msgtest "Test that the Candidate for $1 is" $2
  11. test "$(aptcache policy $1 | grep '^ Candidate:')" = " Candidate: $2" && msgpass || msgfail
  12. }
  13. testcandidate apt '0.8.15'
  14. testequal 'N: Unable to locate package doesntexist' aptcache policy doesntexist -q=0
  15. testequal 'Reading package lists...
  16. Building dependency tree...
  17. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget dist-upgrade
  18. echo 'Package: apt
  19. Pin: release a=unstable
  20. Pin-Priority: -1' > rootdir/etc/apt/preferences
  21. testcandidate apt '(none)'
  22. testequal 'N: Unable to locate package doesntexist' aptcache policy doesntexist -q=0
  23. testequal 'Reading package lists...
  24. Building dependency tree...
  25. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget dist-upgrade
  26. echo '
  27. Package: doesntexist
  28. Pin: release a=unstable
  29. Pin-Priority: 1000' >> rootdir/etc/apt/preferences
  30. testcandidate apt '(none)'
  31. testequal 'N: Unable to locate package doesntexist' aptcache policy doesntexist -q=0
  32. testequal 'Reading package lists...
  33. Building dependency tree...
  34. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget dist-upgrade