diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 18:35:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 18:35:28 +0000 |
commit | ea314d2f45c40a006c0104157013ab4b857f665f (patch) | |
tree | 3ef2971cb3675c318b8d9effd987854ad3f6d3e8 /tests/t-conffile-declarative-removal/Makefile | |
parent | Initial commit. (diff) | |
download | dpkg-ea314d2f45c40a006c0104157013ab4b857f665f.tar.xz dpkg-ea314d2f45c40a006c0104157013ab4b857f665f.zip |
Adding upstream version 1.22.4.upstream/1.22.4
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" |