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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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 "$@"
  29. testdpkgnotinstalled compiz-core-${PKG}
  30. testdpkgstatus 'rc' '1' "compiz-core-${PKG}"
  31. if [ -z "$1" ]; then
  32. testsuccessequal "Reading package lists...
  33. Building dependency tree...
  34. Reading state information...
  35. The following packages will be REMOVED:
  36. compiz-core-${PKG}*
  37. 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
  38. Purg compiz-core-${PKG}" aptget purge compiz-core-${PKG} -s "$@"
  39. else
  40. # check that the rc-version isn't passed to the external resolver if its only in dpkg/status
  41. export APT_EDSP_DUMP_FILENAME="${TMPWORKINGDIRECTORY}/dump-${PKG}.edsp"
  42. testfailure aptget purge compiz-core-${PKG} -y "$@" -s --solver dump
  43. testsuccessequal '2' grep -c "^Package: compiz-core-${PKG}\$" "$APT_EDSP_DUMP_FILENAME"
  44. mv rootdir/etc/apt/sources.list.d/apt-test-stable-deb.list rootdir/etc/apt/sources.list.d/apt-test-stable-deb.disabled
  45. testfailure aptget purge compiz-core-${PKG} -y "$@" -s --solver dump
  46. testsuccessequal '1' grep -c "^Package: compiz-core-${PKG}\$" "$APT_EDSP_DUMP_FILENAME"
  47. mv rootdir/etc/apt/sources.list.d/apt-test-stable-deb.disabled rootdir/etc/apt/sources.list.d/apt-test-stable-deb.list
  48. testsuccessequal "Reading package lists...
  49. Building dependency tree...
  50. Reading state information...
  51. Execute external solver...
  52. The following packages will be REMOVED:
  53. compiz-core-${PKG}*
  54. 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
  55. Purg compiz-core-${PKG}" aptget purge compiz-core-${PKG} -s "$@"
  56. fi
  57. testsuccess aptget purge compiz-core-${PKG} -y "$@"
  58. echo -n '' > rootdir/var/lib/dpkg/available # dpkg -l < 1.16.2 reads the available file by default, where the package can be found
  59. testequalor2 "dpkg-query: no packages found matching compiz-core-${PKG}" "No packages found matching compiz-core-${PKG}." dpkg -l compiz-core-${PKG}
  60. }
  61. runtestround() {
  62. runtests 'native' 'unstable' "$@"
  63. runtests 'all' 'unstable' "$@"
  64. runtests 'native' 'stable' "$@"
  65. runtests 'all' 'stable' "$@"
  66. }
  67. testround() {
  68. msgmsg 'Test in multi arch environment' "$@"
  69. configarchitecture 'amd64' 'i386'
  70. runtestround "$@"
  71. msgmsg 'Test in single arch environment' "$@"
  72. configarchitecture 'amd64'
  73. runtestround "$@"
  74. }
  75. testround
  76. testround --solver apt