summaryrefslogtreecommitdiffstats
path: root/tests/t-conffile-declarative-removal
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 14:58:51 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 14:58:51 +0000
commitcbffab246997fb5a06211dfb706b54e5ae5bb59f (patch)
tree0573c5d96f58d74d76a49c0f2a70398e389a36d3 /tests/t-conffile-declarative-removal
parentInitial commit. (diff)
downloaddpkg-cbffab246997fb5a06211dfb706b54e5ae5bb59f.tar.xz
dpkg-cbffab246997fb5a06211dfb706b54e5ae5bb59f.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')
-rw-r--r--tests/t-conffile-declarative-removal/Makefile101
-rw-r--r--tests/t-conffile-declarative-removal/pkg-conffile-owns-filename/DEBIAN/conffiles1
-rw-r--r--tests/t-conffile-declarative-removal/pkg-conffile-owns-filename/DEBIAN/control7
-rw-r--r--tests/t-conffile-declarative-removal/pkg-conffile-owns-filename/test-dir/test-conffile-to-be-removed0
-rw-r--r--tests/t-conffile-declarative-removal/pkg-conffile-owns-symlink/DEBIAN/conffiles1
-rw-r--r--tests/t-conffile-declarative-removal/pkg-conffile-owns-symlink/DEBIAN/control7
-rw-r--r--tests/t-conffile-declarative-removal/pkg-conffile-owns-symlink/test-dir/test-conffile-owned0
-rw-r--r--tests/t-conffile-declarative-removal/pkg-conffile-removal-present/DEBIAN/conffiles1
-rw-r--r--tests/t-conffile-declarative-removal/pkg-conffile-removal-present/DEBIAN/control7
-rw-r--r--tests/t-conffile-declarative-removal/pkg-conffile-removal-present/test-dir/test-conffile-to-be-removed0
-rw-r--r--tests/t-conffile-declarative-removal/pkg-conffile-v1/DEBIAN/conffiles1
-rw-r--r--tests/t-conffile-declarative-removal/pkg-conffile-v1/DEBIAN/control7
-rw-r--r--tests/t-conffile-declarative-removal/pkg-conffile-v1/test-dir/test-conffile-to-be-removed0
-rw-r--r--tests/t-conffile-declarative-removal/pkg-conffile-v2/DEBIAN/conffiles1
-rw-r--r--tests/t-conffile-declarative-removal/pkg-conffile-v2/DEBIAN/control7
15 files changed, 141 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"
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 <debian-dpkg@lists.debian.org>
+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
--- /dev/null
+++ b/tests/t-conffile-declarative-removal/pkg-conffile-owns-filename/test-dir/test-conffile-to-be-removed
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 <debian-dpkg@lists.debian.org>
+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
--- /dev/null
+++ b/tests/t-conffile-declarative-removal/pkg-conffile-owns-symlink/test-dir/test-conffile-owned
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 <debian-dpkg@lists.debian.org>
+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
--- /dev/null
+++ b/tests/t-conffile-declarative-removal/pkg-conffile-removal-present/test-dir/test-conffile-to-be-removed
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 <debian-dpkg@lists.debian.org>
+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
--- /dev/null
+++ b/tests/t-conffile-declarative-removal/pkg-conffile-v1/test-dir/test-conffile-to-be-removed
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 <debian-dpkg@lists.debian.org>
+Architecture: all
+Description: test package - conffile to be removed v2