From ea314d2f45c40a006c0104157013ab4b857f665f Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 20:35:28 +0200 Subject: Adding upstream version 1.22.4. Signed-off-by: Daniel Baumann --- tests/t-conffile-declarative-removal/Makefile | 101 +++++++++++++++++++++ .../pkg-conffile-owns-filename/DEBIAN/conffiles | 1 + .../pkg-conffile-owns-filename/DEBIAN/control | 7 ++ .../test-dir/test-conffile-to-be-removed | 0 .../pkg-conffile-owns-symlink/DEBIAN/conffiles | 1 + .../pkg-conffile-owns-symlink/DEBIAN/control | 7 ++ .../test-dir/test-conffile-owned | 0 .../pkg-conffile-removal-present/DEBIAN/conffiles | 1 + .../pkg-conffile-removal-present/DEBIAN/control | 7 ++ .../test-dir/test-conffile-to-be-removed | 0 .../pkg-conffile-v1/DEBIAN/conffiles | 1 + .../pkg-conffile-v1/DEBIAN/control | 7 ++ .../test-dir/test-conffile-to-be-removed | 0 .../pkg-conffile-v2/DEBIAN/conffiles | 1 + .../pkg-conffile-v2/DEBIAN/control | 7 ++ 15 files changed, 141 insertions(+) create mode 100644 tests/t-conffile-declarative-removal/Makefile create mode 100644 tests/t-conffile-declarative-removal/pkg-conffile-owns-filename/DEBIAN/conffiles create mode 100644 tests/t-conffile-declarative-removal/pkg-conffile-owns-filename/DEBIAN/control create mode 100644 tests/t-conffile-declarative-removal/pkg-conffile-owns-filename/test-dir/test-conffile-to-be-removed create mode 100644 tests/t-conffile-declarative-removal/pkg-conffile-owns-symlink/DEBIAN/conffiles create mode 100644 tests/t-conffile-declarative-removal/pkg-conffile-owns-symlink/DEBIAN/control create mode 100644 tests/t-conffile-declarative-removal/pkg-conffile-owns-symlink/test-dir/test-conffile-owned create mode 100644 tests/t-conffile-declarative-removal/pkg-conffile-removal-present/DEBIAN/conffiles create mode 100644 tests/t-conffile-declarative-removal/pkg-conffile-removal-present/DEBIAN/control create mode 100644 tests/t-conffile-declarative-removal/pkg-conffile-removal-present/test-dir/test-conffile-to-be-removed create mode 100644 tests/t-conffile-declarative-removal/pkg-conffile-v1/DEBIAN/conffiles create mode 100644 tests/t-conffile-declarative-removal/pkg-conffile-v1/DEBIAN/control create mode 100644 tests/t-conffile-declarative-removal/pkg-conffile-v1/test-dir/test-conffile-to-be-removed create mode 100644 tests/t-conffile-declarative-removal/pkg-conffile-v2/DEBIAN/conffiles create mode 100644 tests/t-conffile-declarative-removal/pkg-conffile-v2/DEBIAN/control (limited to 'tests/t-conffile-declarative-removal') 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" diff --git a/tests/t-conffile-declarative-removal/pkg-conffile-owns-filename/DEBIAN/conffiles b/tests/t-conffile-declarative-removal/pkg-conffile-owns-filename/DEBIAN/conffiles new file mode 100644 index 0000000..c4138c4 --- /dev/null +++ b/tests/t-conffile-declarative-removal/pkg-conffile-owns-filename/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-dir/test-conffile-to-be-removed diff --git a/tests/t-conffile-declarative-removal/pkg-conffile-owns-filename/DEBIAN/control b/tests/t-conffile-declarative-removal/pkg-conffile-owns-filename/DEBIAN/control new file mode 100644 index 0000000..1f5b771 --- /dev/null +++ b/tests/t-conffile-declarative-removal/pkg-conffile-owns-filename/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-conffile-owns +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers +Architecture: all +Description: test package - owns conffile to be removed diff --git a/tests/t-conffile-declarative-removal/pkg-conffile-owns-filename/test-dir/test-conffile-to-be-removed b/tests/t-conffile-declarative-removal/pkg-conffile-owns-filename/test-dir/test-conffile-to-be-removed new file mode 100644 index 0000000..e69de29 diff --git a/tests/t-conffile-declarative-removal/pkg-conffile-owns-symlink/DEBIAN/conffiles b/tests/t-conffile-declarative-removal/pkg-conffile-owns-symlink/DEBIAN/conffiles new file mode 100644 index 0000000..298a4dc --- /dev/null +++ b/tests/t-conffile-declarative-removal/pkg-conffile-owns-symlink/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-dir/test-conffile-owned diff --git a/tests/t-conffile-declarative-removal/pkg-conffile-owns-symlink/DEBIAN/control b/tests/t-conffile-declarative-removal/pkg-conffile-owns-symlink/DEBIAN/control new file mode 100644 index 0000000..53862ca --- /dev/null +++ b/tests/t-conffile-declarative-removal/pkg-conffile-owns-symlink/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-conffile-owns +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers +Architecture: all +Description: test package - owns conffile to be removed via symlink diff --git a/tests/t-conffile-declarative-removal/pkg-conffile-owns-symlink/test-dir/test-conffile-owned b/tests/t-conffile-declarative-removal/pkg-conffile-owns-symlink/test-dir/test-conffile-owned new file mode 100644 index 0000000..e69de29 diff --git a/tests/t-conffile-declarative-removal/pkg-conffile-removal-present/DEBIAN/conffiles b/tests/t-conffile-declarative-removal/pkg-conffile-removal-present/DEBIAN/conffiles new file mode 100644 index 0000000..587753b --- /dev/null +++ b/tests/t-conffile-declarative-removal/pkg-conffile-removal-present/DEBIAN/conffiles @@ -0,0 +1 @@ +remove-on-upgrade /test-dir/test-conffile-to-be-removed diff --git a/tests/t-conffile-declarative-removal/pkg-conffile-removal-present/DEBIAN/control b/tests/t-conffile-declarative-removal/pkg-conffile-removal-present/DEBIAN/control new file mode 100644 index 0000000..78d5ee4 --- /dev/null +++ b/tests/t-conffile-declarative-removal/pkg-conffile-removal-present/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-conffile-removal-present +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers +Architecture: all +Description: test package - conffile to be removed but present diff --git a/tests/t-conffile-declarative-removal/pkg-conffile-removal-present/test-dir/test-conffile-to-be-removed b/tests/t-conffile-declarative-removal/pkg-conffile-removal-present/test-dir/test-conffile-to-be-removed new file mode 100644 index 0000000..e69de29 diff --git a/tests/t-conffile-declarative-removal/pkg-conffile-v1/DEBIAN/conffiles b/tests/t-conffile-declarative-removal/pkg-conffile-v1/DEBIAN/conffiles new file mode 100644 index 0000000..c4138c4 --- /dev/null +++ b/tests/t-conffile-declarative-removal/pkg-conffile-v1/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-dir/test-conffile-to-be-removed diff --git a/tests/t-conffile-declarative-removal/pkg-conffile-v1/DEBIAN/control b/tests/t-conffile-declarative-removal/pkg-conffile-v1/DEBIAN/control new file mode 100644 index 0000000..5626d2a --- /dev/null +++ b/tests/t-conffile-declarative-removal/pkg-conffile-v1/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-conffile +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers +Architecture: all +Description: test package - conffile to be removed v1 diff --git a/tests/t-conffile-declarative-removal/pkg-conffile-v1/test-dir/test-conffile-to-be-removed b/tests/t-conffile-declarative-removal/pkg-conffile-v1/test-dir/test-conffile-to-be-removed new file mode 100644 index 0000000..e69de29 diff --git a/tests/t-conffile-declarative-removal/pkg-conffile-v2/DEBIAN/conffiles b/tests/t-conffile-declarative-removal/pkg-conffile-v2/DEBIAN/conffiles new file mode 100644 index 0000000..587753b --- /dev/null +++ b/tests/t-conffile-declarative-removal/pkg-conffile-v2/DEBIAN/conffiles @@ -0,0 +1 @@ +remove-on-upgrade /test-dir/test-conffile-to-be-removed diff --git a/tests/t-conffile-declarative-removal/pkg-conffile-v2/DEBIAN/control b/tests/t-conffile-declarative-removal/pkg-conffile-v2/DEBIAN/control new file mode 100644 index 0000000..7057432 --- /dev/null +++ b/tests/t-conffile-declarative-removal/pkg-conffile-v2/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-conffile +Version: 2 +Section: test +Priority: extra +Maintainer: Dpkg Developers +Architecture: all +Description: test package - conffile to be removed v2 -- cgit v1.2.3