diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 14:58:51 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 14:58:51 +0000 |
commit | cbffab246997fb5a06211dfb706b54e5ae5bb59f (patch) | |
tree | 0573c5d96f58d74d76a49c0f2a70398e389a36d3 /tests/t-conffile-declarative-removal/Makefile | |
parent | Initial commit. (diff) | |
download | dpkg-upstream.tar.xz dpkg-upstream.zip |
Adding upstream version 1.21.22.upstream/1.21.22upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/t-conffile-declarative-removal/Makefile')
-rw-r--r-- | tests/t-conffile-declarative-removal/Makefile | 101 |
1 files changed, 101 insertions, 0 deletions
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" |