diff options
Diffstat (limited to 'tests/t-disappear-diverted')
9 files changed, 100 insertions, 0 deletions
diff --git a/tests/t-disappear-diverted/Makefile b/tests/t-disappear-diverted/Makefile new file mode 100644 index 0000000..6df38e6 --- /dev/null +++ b/tests/t-disappear-diverted/Makefile @@ -0,0 +1,58 @@ +TESTS_DEB := pkg-normal pkg-divert pkg-disappear + +include ../Test.mk + +test-case: + # Test not disappearing diverted package. + $(DPKG_INSTALL) pkg-disappear.deb + test -e $(DPKG_INSTDIR)/test-dir/test-normal + ! test -e $(DPKG_INSTDIR)/test-dir/test-normal.distrib + $(DPKG_INSTALL) pkg-divert.deb + test -e $(DPKG_INSTDIR)/test-dir/test-normal + test -e $(DPKG_INSTDIR)/test-dir/test-normal.distrib + # Should not disappear while it's being diverted. + $(call pkg_is_installed,pkg-disappear) + $(DPKG_PURGE) pkg-divert + test -e $(DPKG_INSTDIR)/test-dir/test-normal + ! test -e $(DPKG_INSTDIR)/test-dir/test-normal.distrib + $(DPKG_PURGE) pkg-disappear + : + # Test disappearing package not being diverted. + $(DPKG_INSTALL) pkg-disappear.deb + test -e $(DPKG_INSTDIR)/test-dir/test-normal + ! test -e $(DPKG_INSTDIR)/test-dir/test-normal.distrib + $(DPKG_INSTALL) pkg-normal.deb + test -e $(DPKG_INSTDIR)/test-dir/test-normal + ! test -e $(DPKG_INSTDIR)/test-dir/test-normal.distrib + # Should have been disappeared now. + $(call pkg_is_not_installed,pkg-disappear) + $(DPKG_PURGE) pkg-normal + ! test -e $(DPKG_INSTDIR)/test-dir/test-normal + ! test -e $(DPKG_INSTDIR)/test-dir/test-normal.distrib + $(DPKG_PURGE) pkg-disappear + : + # Test disappearing package diverted but replaced by a 3rd package. + $(DPKG_INSTALL) pkg-disappear.deb + test -e $(DPKG_INSTDIR)/test-dir/test-normal + ! test -e $(DPKG_INSTDIR)/test-dir/test-normal.distrib + $(DPKG_INSTALL) pkg-divert.deb + test -e $(DPKG_INSTDIR)/test-dir/test-normal + test -e $(DPKG_INSTDIR)/test-dir/test-normal.distrib + $(DPKG_INSTALL) pkg-normal.deb + test -e $(DPKG_INSTDIR)/test-dir/test-normal + test -e $(DPKG_INSTDIR)/test-dir/test-normal.distrib + # Should have been disappeared now, as it is diverted by a 3rd package. + $(call pkg_is_not_installed,pkg-disappear) + $(DPKG_PURGE) pkg-normal + test -e $(DPKG_INSTDIR)/test-dir/test-normal + ! test -e $(DPKG_INSTDIR)/test-dir/test-normal.distrib + $(DPKG_PURGE) pkg-divert + ! test -e $(DPKG_INSTDIR)/test-dir/test-normal + ! test -e $(DPKG_INSTDIR)/test-dir/test-normal.distrib + $(DPKG_PURGE) pkg-disappear + +test-clean: + $(DPKG_PURGE) pkg-divert + $(DPKG_PURGE) pkg-disappear + $(DPKG_PURGE) pkg-normal + diff --git a/tests/t-disappear-diverted/pkg-disappear/DEBIAN/control b/tests/t-disappear-diverted/pkg-disappear/DEBIAN/control new file mode 100644 index 0000000..78c2a17 --- /dev/null +++ b/tests/t-disappear-diverted/pkg-disappear/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-disappear +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - disappear + diff --git a/tests/t-disappear-diverted/pkg-disappear/test-dir/test-normal b/tests/t-disappear-diverted/pkg-disappear/test-dir/test-normal new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-disappear-diverted/pkg-disappear/test-dir/test-normal diff --git a/tests/t-disappear-diverted/pkg-divert/DEBIAN/control b/tests/t-disappear-diverted/pkg-divert/DEBIAN/control new file mode 100644 index 0000000..42515eb --- /dev/null +++ b/tests/t-disappear-diverted/pkg-divert/DEBIAN/control @@ -0,0 +1,9 @@ +Package: pkg-divert +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Replaces: pkg-disappear +Description: test package - divert on disappearing package + diff --git a/tests/t-disappear-diverted/pkg-divert/DEBIAN/postrm b/tests/t-disappear-diverted/pkg-divert/DEBIAN/postrm new file mode 100755 index 0000000..3787c66 --- /dev/null +++ b/tests/t-disappear-diverted/pkg-divert/DEBIAN/postrm @@ -0,0 +1,8 @@ +#!/bin/sh + +set -e + +if [ "$1" = "purge" ] || [ "$1" = "disappear" ]; then + dpkg-divert --rename --remove /test-dir/test-normal +fi + diff --git a/tests/t-disappear-diverted/pkg-divert/DEBIAN/preinst b/tests/t-disappear-diverted/pkg-divert/DEBIAN/preinst new file mode 100755 index 0000000..898c3c5 --- /dev/null +++ b/tests/t-disappear-diverted/pkg-divert/DEBIAN/preinst @@ -0,0 +1,8 @@ +#!/bin/sh + +set -e + +if [ "$1" = "install" ] || [ "$1" = "upgrade" ]; then + dpkg-divert --rename --add /test-dir/test-normal +fi + diff --git a/tests/t-disappear-diverted/pkg-divert/test-dir/test-normal b/tests/t-disappear-diverted/pkg-divert/test-dir/test-normal new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-disappear-diverted/pkg-divert/test-dir/test-normal diff --git a/tests/t-disappear-diverted/pkg-normal/DEBIAN/control b/tests/t-disappear-diverted/pkg-normal/DEBIAN/control new file mode 100644 index 0000000..6d82537 --- /dev/null +++ b/tests/t-disappear-diverted/pkg-normal/DEBIAN/control @@ -0,0 +1,9 @@ +Package: pkg-normal +Version: 0.0-1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Replaces: pkg-disappear +Description: test package - normal + diff --git a/tests/t-disappear-diverted/pkg-normal/test-dir/test-normal b/tests/t-disappear-diverted/pkg-normal/test-dir/test-normal new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-disappear-diverted/pkg-normal/test-dir/test-normal |