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.
 
 
 
 
 
 

91 lines
2.2 KiB

  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture 'i386'
  7. insertpackage 'unstable' 'base-files' 'all' '5.0.0'
  8. insertinstalledpackage 'base-files' 'all' '5.0.0-1'
  9. setupaptarchive
  10. STATUS=$(readlink -f rootdir/var/lib/dpkg/status)
  11. APTARCHIVE="$(readlink -f aptarchive)"
  12. testsuccessequal "base-files:
  13. Installed: 5.0.0-1
  14. Candidate: 5.0.0-1
  15. Version table:
  16. *** 5.0.0-1 100
  17. 100 $STATUS
  18. 5.0.0 500
  19. 500 file:${APTARCHIVE} unstable/main all Packages" aptcache policy base-files -o apt::pin=0
  20. writepin() {
  21. echo "Package: $1
  22. Pin: release a=unstable
  23. Pin-Priority: $2" > rootdir/etc/apt/preferences
  24. }
  25. testpinning() {
  26. local PKGPINPRIO=''
  27. local REPPINPRIO=''
  28. if [ "$1" != '*' ]; then
  29. PKGPINPRIO=''
  30. REPPINPRIO=' 500'
  31. fi
  32. writepin "$1" '99'
  33. testsuccessequal "base-files:
  34. Installed: 5.0.0-1
  35. Candidate: 5.0.0-1
  36. Version table:
  37. *** 5.0.0-1 100
  38. 100 $STATUS
  39. 5.0.0 ${PKGPINPRIO:-99}
  40. ${REPPINPRIO:- 99} file:${APTARCHIVE} unstable/main all Packages" aptcache policy base-files -o apt::pin=99
  41. writepin "$1" '100'
  42. testsuccessequal "base-files:
  43. Installed: 5.0.0-1
  44. Candidate: 5.0.0-1
  45. Version table:
  46. *** 5.0.0-1 100
  47. 100 $STATUS
  48. 5.0.0 ${PKGPINPRIO:-100}
  49. ${REPPINPRIO:- 100} file:${APTARCHIVE} unstable/main all Packages" aptcache policy base-files -o apt::pin=100
  50. writepin "$1" '999'
  51. testsuccessequal "base-files:
  52. Installed: 5.0.0-1
  53. Candidate: 5.0.0-1
  54. Version table:
  55. *** 5.0.0-1 100
  56. 100 $STATUS
  57. 5.0.0 ${PKGPINPRIO:-999}
  58. ${REPPINPRIO:- 999} file:${APTARCHIVE} unstable/main all Packages" aptcache policy base-files -o apt::pin=999
  59. writepin "$1" '1000'
  60. testsuccessequal "base-files:
  61. Installed: 5.0.0-1
  62. Candidate: 5.0.0
  63. Version table:
  64. *** 5.0.0-1 100
  65. 100 $STATUS
  66. 5.0.0 ${PKGPINPRIO:-1000}
  67. ${REPPINPRIO:-1000} file:${APTARCHIVE} unstable/main all Packages" aptcache policy base-files -o apt::pin=1000
  68. }
  69. msgmsg 'Tests with generic-form pin'
  70. testpinning '*'
  71. msgmsg 'Tests with specific-form pin'
  72. testpinning 'base-files'
  73. msgmsg 'Tests with specific-form pin with glob'
  74. testpinning 'base-fil*'
  75. msgmsg 'Tests with specific-form pin with regex'
  76. testpinning '/^base-f[iI]les$/'