test-disappearing-packages 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture 'amd64' 'i386'
  7. buildsimplenativepackage 'old-pkg' 'amd64' '1' 'stable'
  8. setupsimplenativepackage 'new-pkg' 'amd64' '2' 'unstable' 'Provides: old-pkg
  9. Replaces: old-pkg
  10. Conflicts: old-pkg (<< 2)'
  11. BUILDDIR='incoming/new-pkg-2'
  12. echo '/usr/share/doc/new-pkg /usr/share/doc/old-pkg' > "${BUILDDIR}/debian/new-pkg.links"
  13. buildpackage "$BUILDDIR" 'unstable' 'main'
  14. rm -rf "$BUILDDIR"
  15. setupsimplenativepackage 'old-pkg' 'all' '2' 'unstable' 'Depends: new-pkg'
  16. BUILDDIR='incoming/old-pkg-2'
  17. echo '/usr/share/doc/new-pkg /usr/share/doc/old-pkg' > "${BUILDDIR}/debian/old-pkg.links"
  18. echo "
  19. override_dh_link:
  20. rm -rf debian/old-pkg/usr/share/doc/old-pkg/
  21. dh_link" >> "${BUILDDIR}/debian/rules"
  22. buildpackage "$BUILDDIR" 'unstable' 'main'
  23. rm -rf "$BUILDDIR"
  24. setupsimplenativepackage 'super-new-pkg' 'i386' '3' 'experimental' 'Provides: new-pkg
  25. Replaces: new-pkg
  26. Conflicts: new-pkg (<< 3)'
  27. BUILDDIR='incoming/super-new-pkg-3'
  28. echo '/usr/share/doc/super-new-pkg /usr/share/doc/old-pkg' > "${BUILDDIR}/debian/super-new-pkg.links"
  29. echo '/usr/share/doc/super-new-pkg /usr/share/doc/new-pkg' >> "${BUILDDIR}/debian/super-new-pkg.links"
  30. buildpackage "$BUILDDIR" 'experimental' 'main'
  31. rm -rf "$BUILDDIR"
  32. setupsimplenativepackage 'new-pkg' 'all' '3' 'experimental' 'Depends: super-new-pkg'
  33. BUILDDIR='incoming/new-pkg-3'
  34. echo '/usr/share/doc/super-new-pkg /usr/share/doc/old-pkg' > "${BUILDDIR}/debian/new-pkg.links"
  35. echo '/usr/share/doc/super-new-pkg /usr/share/doc/new-pkg' >> "${BUILDDIR}/debian/new-pkg.links"
  36. echo "
  37. override_dh_link:
  38. rm -rf debian/new-pkg/usr/share/doc/new-pkg/
  39. dh_link" >> "${BUILDDIR}/debian/rules"
  40. buildpackage "$BUILDDIR" 'experimental' 'main'
  41. rm -rf "$BUILDDIR"
  42. setupaptarchive
  43. msgmsg 'Let a package disappear' 'old-pkg'
  44. testsuccess aptget install old-pkg=1 --trivial-only
  45. testmarkedauto # old-pkg is manual installed
  46. testsuccess aptget dist-upgrade -y
  47. testdpkgnotinstalled old-pkg
  48. cp rootdir/tmp/testsuccess.output disappear.output
  49. testsuccessequal 'The following package disappeared from your system as
  50. all files have been overwritten by other packages:
  51. old-pkg
  52. Note: This is done automatically and on purpose by dpkg.' tail -n 4 disappear.output
  53. sed -i rootdir/var/log/apt/history.log -e '/^Commandline: / d' -e '/^Start-Date: / d' -e '/^End-Date: / d' -e "s#:$(getarchitecture 'native') #:native #"
  54. if [ -n "$SUDO_USER" ]; then
  55. testfileequal 'rootdir/var/log/apt/history.log' "
  56. Requested-By: $SUDO_USER ($(id -u "$SUDO_USER"))
  57. Install: old-pkg:native (1)
  58. Requested-By: $SUDO_USER ($(id -u "$SUDO_USER"))
  59. Install: new-pkg:native (2, automatic)
  60. Upgrade: old-pkg:native (1, 2)
  61. Disappeared: old-pkg (1)"
  62. else
  63. testfileequal 'rootdir/var/log/apt/history.log' '
  64. Install: old-pkg:native (1)
  65. Install: new-pkg:native (2, automatic)
  66. Upgrade: old-pkg:native (1, 2)
  67. Disappeared: old-pkg (1)'
  68. fi
  69. testmarkedauto # new-pkg should have get the manual flag from old-pkg
  70. msgmsg 'Let a package disappear which let the previous disappear' 'new-pkg'
  71. testsuccess aptget dist-upgrade -y -t experimental
  72. testdpkgnotinstalled new-pkg
  73. cp rootdir/tmp/testsuccess.output disappear.output
  74. testsuccessequal 'The following package disappeared from your system as
  75. all files have been overwritten by other packages:
  76. new-pkg
  77. Note: This is done automatically and on purpose by dpkg.' tail -n 4 disappear.output
  78. testmarkedauto