test-bug-712116-dpkg-pre-install-pkgs-hook-multiarch 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #!/bin/sh
  2. set -e
  3. TESTDIR=$(readlink -f $(dirname $0))
  4. . $TESTDIR/framework
  5. setupenvironment
  6. configarchitecture 'amd64' 'i386'
  7. buildsimplenativepackage 'toolkit' 'all' '1' 'stable' 'Multi-Arch: foreign'
  8. buildsimplenativepackage 'toolkit' 'amd64' '2' 'unstable' 'Multi-Arch: foreign'
  9. buildsimplenativepackage 'libsame' 'i386,amd64' '1' 'stable' 'Multi-Arch: same'
  10. buildsimplenativepackage 'libsame' 'i386,amd64' '2' 'unstable' 'Multi-Arch: same'
  11. buildsimplenativepackage 'stuff' 'i386,amd64' '1' 'stable' 'Depends: libsame (= 1), toolkit (= 1)'
  12. buildsimplenativepackage 'stuff' 'i386,amd64' '2' 'unstable' 'Depends: libsame (= 2), toolkit (= 2)'
  13. setupaptarchive
  14. hook='pre-install-pkgs'
  15. enablehookversion() {
  16. echo "#!/bin/sh
  17. while read line; do
  18. if echo \"\$line\" | grep -Fq '**'; then
  19. echo \"\$line\"
  20. fi
  21. done > ${hook}-v${1}.list" > ${hook}-v${1}.sh
  22. chmod +x ${hook}-v${1}.sh
  23. echo "dpkg::${hook}:: \"./${hook}-v${1}.sh --foo -bar\";
  24. DPkg::Tools::options::\"./${hook}-v${1}.sh\"::Version \"$1\";" > rootdir/etc/apt/apt.conf.d/hook-v$1
  25. }
  26. enablehookversion 2
  27. enablehookversion 3
  28. observehook() {
  29. rm -f ${hook}-v2.list ${hook}-v3.list
  30. msgtest 'Observe hooks while' "$*"
  31. aptget "$@" -y --force-yes >/dev/null 2>&1 && msgpass || msgfail
  32. }
  33. observehook install stuff -t stable
  34. testfileequal "${hook}-v2.list" 'libsame - < 1 **CONFIGURE**
  35. toolkit - < 1 **CONFIGURE**
  36. stuff - < 1 **CONFIGURE**'
  37. testfileequal "${hook}-v3.list" 'libsame - - none < 1 amd64 same **CONFIGURE**
  38. toolkit - - none < 1 all foreign **CONFIGURE**
  39. stuff - - none < 1 amd64 none **CONFIGURE**'
  40. observehook install stuff -t unstable
  41. testfileequal "${hook}-v2.list" 'libsame 1 < 2 **CONFIGURE**
  42. toolkit 1 < 2 **CONFIGURE**
  43. stuff 1 < 2 **CONFIGURE**'
  44. testfileequal "${hook}-v3.list" 'libsame 1 amd64 same < 2 amd64 same **CONFIGURE**
  45. toolkit 1 all foreign < 2 amd64 foreign **CONFIGURE**
  46. stuff 1 amd64 none < 2 amd64 none **CONFIGURE**'
  47. observehook install stuff:i386 -t unstable
  48. testfileequal "${hook}-v2.list" 'stuff 2 > - **REMOVE**
  49. libsame - < 2 **CONFIGURE**
  50. stuff - < 2 **CONFIGURE**'
  51. testfileequal "${hook}-v3.list" 'stuff 2 amd64 none > - - none **REMOVE**
  52. libsame - - none < 2 i386 same **CONFIGURE**
  53. stuff - - none < 2 i386 none **CONFIGURE**'
  54. observehook remove libsame
  55. testfileequal "${hook}-v2.list" 'libsame 2 > - **REMOVE**'
  56. testfileequal "${hook}-v3.list" 'libsame 2 amd64 same > - - none **REMOVE**'
  57. observehook install stuff:i386/stable libsame:i386/stable toolkit/stable
  58. testfileequal "${hook}-v2.list" 'libsame 2 > 1 **CONFIGURE**
  59. toolkit 2 > 1 **CONFIGURE**
  60. stuff 2 > 1 **CONFIGURE**'
  61. testfileequal "${hook}-v3.list" 'libsame 2 i386 same > 1 i386 same **CONFIGURE**
  62. toolkit 2 amd64 foreign > 1 all foreign **CONFIGURE**
  63. stuff 2 i386 none > 1 i386 none **CONFIGURE**'
  64. observehook install 'libsame:*'
  65. testfileequal "${hook}-v2.list" 'libsame 1 < 2 **CONFIGURE**
  66. libsame - < 2 **CONFIGURE**
  67. toolkit 1 < 2 **CONFIGURE**
  68. stuff 1 < 2 **CONFIGURE**'
  69. testfileequal "${hook}-v3.list" 'libsame 1 i386 same < 2 i386 same **CONFIGURE**
  70. libsame - - none < 2 amd64 same **CONFIGURE**
  71. toolkit 1 all foreign < 2 amd64 foreign **CONFIGURE**
  72. stuff 1 i386 none < 2 i386 none **CONFIGURE**'
  73. observehook purge stuff:i386 'libsame:*' toolkit
  74. testfileequal "${hook}-v2.list" 'libsame 2 > - **REMOVE**
  75. stuff 2 > - **REMOVE**
  76. libsame 2 > - **REMOVE**
  77. toolkit 2 > - **REMOVE**'
  78. testfileequal "${hook}-v3.list" 'libsame 2 amd64 same > - - none **REMOVE**
  79. stuff 2 i386 none > - - none **REMOVE**
  80. libsame 2 i386 same > - - none **REMOVE**
  81. toolkit 2 amd64 foreign > - - none **REMOVE**'