From cbffab246997fb5a06211dfb706b54e5ae5bb59f Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 16:58:51 +0200 Subject: Adding upstream version 1.21.22. Signed-off-by: Daniel Baumann --- tests/t-conffile-declarative-removal/Makefile | 101 ++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 tests/t-conffile-declarative-removal/Makefile (limited to 'tests/t-conffile-declarative-removal/Makefile') diff --git a/tests/t-conffile-declarative-removal/Makefile b/tests/t-conffile-declarative-removal/Makefile new file mode 100644 index 0000000..0d0e77b --- /dev/null +++ b/tests/t-conffile-declarative-removal/Makefile @@ -0,0 +1,101 @@ +TESTS_DEB := pkg-conffile-v1 pkg-conffile-v2 \ + pkg-conffile-owns-filename pkg-conffile-owns-symlink + +include ../Test.mk + +build-hook: + ln -sf test-conffile-owned \ + pkg-conffile-owns-symlink/test-dir/test-conffile-to-be-removed + +clean-hook: + $(RM) pkg-conffile-owns-symlink/test-dir/test-conffile-to-be-removed + $(RM) pkg-conffile-removal-present.deb + +test-case: + # Conffile marked for removal but present, cannot be installed. + $(DPKG_BUILD_DEB) --nocheck pkg-conffile-removal-present + ! $(DPKG_INSTALL) pkg-conffile-removal-present.deb + $(call pkg_is_not_installed,pkg-conffile-removal-present) + $(DPKG_PURGE) pkg-conffile-removal-present + + # Unmodified case, one invocation. + $(DPKG_INSTALL) pkg-conffile-v1.deb + test -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed" + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed.dpkg-old" + $(DPKG_INSTALL) pkg-conffile-v2.deb + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed" + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed.dpkg-old" + + # Reset. + $(DPKG_PURGE) pkg-conffile + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed" + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed.dpkg-old" + + # Unmodified case; but force it to happen via two invocations. + $(DPKG_INSTALL) pkg-conffile-v1.deb + test -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed" + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed.dpkg-old" + $(DPKG_UNPACK) pkg-conffile-v2.deb + # The old conffile is removed during unpack. + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed" + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed.dpkg-old" + # After configure, the file is still removed. + $(DPKG_CONFIGURE) pkg-conffile + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed" + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed.dpkg-old" + + # Reset. + $(DPKG_PURGE) pkg-conffile + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed" + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed.dpkg-old" + + # Modified; should store .dpkg-old. + $(DPKG_INSTALL) pkg-conffile-v1.deb + test -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed" + echo "modify this" >"$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed" + $(DPKG_INSTALL) pkg-conffile-v2.deb + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed" + test -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed.dpkg-old" + + # Reset. + $(DPKG_PURGE) pkg-conffile + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed" + $(RM) "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed.dpkg-old" + + # Queue a remove on upgrade, and move ownership. + $(DPKG_INSTALL) pkg-conffile-v1.deb + test -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed" + $(DPKG_INSTALL) pkg-conffile-v2.deb + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed" + $(DPKG_INSTALL) pkg-conffile-owns-filename.deb + test -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed" + # Upgrade the package again, should not remove unowned conffile. + $(DPKG_INSTALL) pkg-conffile-v2.deb + test -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed" + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed.dpkg-old" + + # Reset. + $(DPKG_PURGE) pkg-conffile + $(DPKG_PURGE) pkg-conffile-owns + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed" + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed.dpkg-old" + + # Queue a remove on upgrade, and move ownership via symlink. + $(DPKG_INSTALL) pkg-conffile-v1.deb + test -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed" + $(DPKG_INSTALL) pkg-conffile-v2.deb + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed" + test ! -f "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed.dpkg-old" + $(DPKG_INSTALL) pkg-conffile-owns-symlink.deb + test -f "$(DPKG_INSTDIR)/test-dir/test-conffile-owned" + test -L "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed" + # Upgrade the package again, should not remove unowned conffile. + $(DPKG_INSTALL) pkg-conffile-v2.deb + test -f "$(DPKG_INSTDIR)/test-dir/test-conffile-owned" + test -L "$(DPKG_INSTDIR)/test-dir/test-conffile-to-be-removed" + +test-clean: + $(DPKG_PURGE) pkg-conffile-removal-present + $(DPKG_PURGE) pkg-conffile-owns + $(DPKG_PURGE) pkg-conffile + $(BEROOT) $(RM) -rf "$(DPKG_INSTDIR)/test-dir" -- cgit v1.2.3