test-dpkg-assert-multi-arch 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture 'amd64' 'i386'
  7. buildsimplenativepackage 'native-pkg' 'amd64' '1.0' 'stable'
  8. buildsimplenativepackage 'foreign-pkg' 'i386' '0.5' 'stable' 'Multi-Arch: foreign'
  9. buildsimplenativepackage 'same-lib' 'amd64,i386' '0.5' 'stable' 'Multi-Arch: same'
  10. buildsimplenativepackage 'all-pkg' 'all' '2.0' 'stable'
  11. buildsimplenativepackage 'all-foreign-pkg' 'all' '2.0' 'stable' 'Multi-Arch: foreign'
  12. setupaptarchive
  13. testqualifier() {
  14. msgtest 'Test with' $1 'for correct qualifier mode' $2
  15. #aptget install $1 -qq -o Debug::pkgDPkgPM=1 || true
  16. aptget install $1 -qq -o Debug::pkgDPkgPM=1 -o Dpkg::ExplicitLastConfigure=1 -o PackageManager::Configure=all > testqualifier.output 2>&1 || true
  17. GIVEN="$(grep -v -- '--unpack' testqualifier.output | sed -ne 's/^.*--[rpc][^ ]* \([^ ]*\).*$/\1/p')"
  18. if [ "$GIVEN" = "$2" ]; then
  19. msgpass
  20. else
  21. cat >&2 testqualifier.output
  22. echo >&2
  23. echo >&2 "$GIVEN"
  24. msgfail
  25. fi
  26. }
  27. msgmsg 'non-multiarch or "ubuntus" old multiarchified dpkg'
  28. echo 'Dir::Bin::dpkg "./dpkg-wrapper";' > rootdir/etc/apt/apt.conf.d/99dpkgwrapper
  29. cat > ./dpkg-wrapper <<EOF
  30. #! /bin/sh
  31. if echo "\$*" | grep -q -- "--assert-multi-arch"; then
  32. echo >&2 'dpkg: Fehler: unbekannte Option --assert-multi-arch'
  33. echo >&1 'dpkg: Info: unbekannte Option --assert-multi-arch'
  34. exit 2
  35. fi
  36. exec "\$@"
  37. EOF
  38. chmod +x ./dpkg-wrapper
  39. testqualifier 'native-pkg' 'native-pkg'
  40. testqualifier 'native-pkg:amd64' 'native-pkg'
  41. testqualifier 'foreign-pkg' 'foreign-pkg:i386'
  42. testqualifier 'foreign-pkg:i386' 'foreign-pkg:i386'
  43. testqualifier 'same-lib' 'same-lib'
  44. testqualifier 'same-lib:amd64' 'same-lib'
  45. testqualifier 'same-lib:i386' 'same-lib:i386'
  46. testqualifier 'all-pkg' 'all-pkg'
  47. testqualifier 'all-pkg:amd64' 'all-pkg'
  48. testqualifier 'all-foreign-pkg' 'all-foreign-pkg'
  49. testqualifier 'all-foreign-pkg:amd64' 'all-foreign-pkg'
  50. insertinstalledpackage 'all-pkg' 'amd64' '1.0'
  51. insertinstalledpackage 'all-foreign-pkg' 'amd64' '1.0' 'Multi-Arch: foreign'
  52. testqualifier 'all-pkg' 'all-pkg'
  53. testqualifier 'all-pkg:amd64' 'all-pkg'
  54. testqualifier 'all-foreign-pkg' 'all-foreign-pkg'
  55. testqualifier 'all-foreign-pkg:amd64' 'all-foreign-pkg'
  56. insertinstalledpackage 'always-all-pkg' 'all' '1.0'
  57. insertinstalledpackage 'always-all-foreign-pkg' 'all' '1.0' 'Multi-Arch: foreign'
  58. testqualifier 'all-pkg-' 'all-pkg'
  59. testqualifier 'all-foreign-pkg-' 'all-foreign-pkg'
  60. testqualifier 'always-all-pkg-' 'always-all-pkg'
  61. testqualifier 'always-all-foreign-pkg-' 'always-all-foreign-pkg'
  62. msgmsg 'multiarch dpkg (new interface version)'
  63. rm rootdir/var/lib/dpkg/status
  64. touch rootdir/var/lib/dpkg/status
  65. echo 'Dir::Bin::dpkg "./dpkg-wrapper";' > rootdir/etc/apt/apt.conf.d/99dpkgwrapper
  66. cat > ./dpkg-wrapper <<EOF
  67. #! /bin/sh
  68. if echo "\$*" | grep -q -- "--assert-multi-arch"; then
  69. exit 0
  70. fi
  71. exec "\$@"
  72. EOF
  73. chmod +x ./dpkg-wrapper
  74. testqualifier 'native-pkg' 'native-pkg:amd64'
  75. testqualifier 'native-pkg:amd64' 'native-pkg:amd64'
  76. testqualifier 'foreign-pkg' 'foreign-pkg:i386'
  77. testqualifier 'foreign-pkg:i386' 'foreign-pkg:i386'
  78. testqualifier 'same-lib' 'same-lib:amd64'
  79. testqualifier 'same-lib:amd64' 'same-lib:amd64'
  80. testqualifier 'same-lib:i386' 'same-lib:i386'
  81. testqualifier 'all-pkg' 'all-pkg:all'
  82. testqualifier 'all-pkg:amd64' 'all-pkg:all'
  83. testqualifier 'all-foreign-pkg' 'all-foreign-pkg:all'
  84. testqualifier 'all-foreign-pkg:amd64' 'all-foreign-pkg:all'
  85. insertinstalledpackage 'all-pkg' 'amd64' '1.0'
  86. insertinstalledpackage 'all-foreign-pkg' 'amd64' '1.0' 'Multi-Arch: foreign'
  87. testqualifier 'all-pkg' 'all-pkg:all'
  88. testqualifier 'all-pkg:amd64' 'all-pkg:all'
  89. testqualifier 'all-foreign-pkg' 'all-foreign-pkg:all'
  90. testqualifier 'all-foreign-pkg:amd64' 'all-foreign-pkg:all'
  91. insertinstalledpackage 'always-all-pkg' 'all' '1.0'
  92. insertinstalledpackage 'always-all-foreign-pkg' 'all' '1.0' 'Multi-Arch: foreign'
  93. testqualifier 'all-pkg-' 'all-pkg:amd64'
  94. testqualifier 'all-foreign-pkg-' 'all-foreign-pkg:amd64'
  95. testqualifier 'always-all-pkg-' 'always-all-pkg:all'
  96. testqualifier 'always-all-foreign-pkg-' 'always-all-foreign-pkg:all'