test-ubuntu-bug-761175-remove-purge 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture 'amd64' 'i386'
  7. buildcompizpkg() {
  8. setupsimplenativepackage "compiz-core-$1" "$2" "$3" "$4"
  9. BUILDDIR="incoming/compiz-core-$1-$3"
  10. mkdir -p ${BUILDDIR}/debian/compiz-core/etc
  11. echo 'foo=bar;' > ${BUILDDIR}/compiz.conf
  12. echo 'compiz.conf /etc/compiz.conf' >> ${BUILDDIR}/debian/install
  13. buildpackage "$BUILDDIR" "$4" 'main' "$2"
  14. rm -rf "$BUILDDIR"
  15. }
  16. buildcompizpkg 'native' 'all' '1.0' 'stable'
  17. buildcompizpkg 'all' 'native' '1.0' 'stable'
  18. buildcompizpkg 'native' 'native' '2.0' 'unstable'
  19. buildcompizpkg 'all' 'all' '2.0' 'unstable'
  20. setupaptarchive
  21. runtests() {
  22. local PKG="$1"
  23. local RELEASE="${2}"
  24. shift 2
  25. testdpkgnotinstalled compiz-core-${PKG}
  26. testsuccess aptget install compiz-core-${PKG} -t "${RELEASE}" "$@"
  27. testdpkginstalled compiz-core-${PKG}
  28. testsuccess aptget remove compiz-core-${PKG} -y "$@" -o Debug::pkgDpkgPm=1
  29. testfailure grep -- '--force-remove-essential' rootdir/tmp/testsuccess.output
  30. testsuccess aptget remove compiz-core-${PKG} -y "$@"
  31. testdpkgnotinstalled compiz-core-${PKG}
  32. testdpkgstatus 'rc' '1' "compiz-core-${PKG}"
  33. if [ -z "$1" ]; then
  34. testsuccessequal "Reading package lists...
  35. Building dependency tree...
  36. Reading state information...
  37. The following packages will be REMOVED:
  38. compiz-core-${PKG}*
  39. 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
  40. Purg compiz-core-${PKG}" aptget purge compiz-core-${PKG} -s "$@"
  41. else
  42. # check that the rc-version isn't passed to the external resolver if its only in dpkg/status
  43. export APT_EDSP_DUMP_FILENAME="${TMPWORKINGDIRECTORY}/dump-${PKG}.edsp"
  44. testfailure aptget purge compiz-core-${PKG} -y "$@" -s --solver dump
  45. testsuccessequal '2' grep -c "^Package: compiz-core-${PKG}\$" "$APT_EDSP_DUMP_FILENAME"
  46. mv rootdir/etc/apt/sources.list.d/apt-test-stable-deb.list rootdir/etc/apt/sources.list.d/apt-test-stable-deb.disabled
  47. testfailure aptget purge compiz-core-${PKG} -y "$@" -s --solver dump
  48. testsuccessequal '1' grep -c "^Package: compiz-core-${PKG}\$" "$APT_EDSP_DUMP_FILENAME"
  49. mv rootdir/etc/apt/sources.list.d/apt-test-stable-deb.disabled rootdir/etc/apt/sources.list.d/apt-test-stable-deb.list
  50. testsuccessequal "Reading package lists...
  51. Building dependency tree...
  52. Reading state information...
  53. Execute external solver...
  54. The following packages will be REMOVED:
  55. compiz-core-${PKG}*
  56. 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
  57. Purg compiz-core-${PKG}" aptget purge compiz-core-${PKG} -s "$@"
  58. fi
  59. testsuccess aptget purge compiz-core-${PKG} -y "$@" -o Debug::pkgDpkgPm=1
  60. testfailure grep -- '--force-remove-essential' rootdir/tmp/testsuccess.output
  61. testsuccess aptget purge compiz-core-${PKG} -y "$@"
  62. echo -n '' > rootdir/var/lib/dpkg/available # dpkg -l < 1.16.2 reads the available file by default, where the package can be found
  63. testequalor2 "dpkg-query: no packages found matching compiz-core-${PKG}" "No packages found matching compiz-core-${PKG}." dpkg -l compiz-core-${PKG}
  64. }
  65. runtestround() {
  66. runtests 'native' 'unstable' "$@"
  67. runtests 'all' 'unstable' "$@"
  68. runtests 'native' 'stable' "$@"
  69. runtests 'all' 'stable' "$@"
  70. }
  71. testround() {
  72. msgmsg 'Test in multi arch environment' "$@"
  73. configarchitecture 'amd64' 'i386'
  74. runtestround "$@"
  75. msgmsg 'Test in single arch environment' "$@"
  76. configarchitecture 'amd64'
  77. runtestround "$@"
  78. }
  79. testround
  80. testround --solver apt