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-triggers-halt/Makefile | 26 ++++++++++++++++++++++ tests/t-triggers-halt/pkg-depends/DEBIAN/control | 8 +++++++ tests/t-triggers-halt/pkg-files/DEBIAN/control | 7 ++++++ .../pkg-files/test/trigger/test-file | 1 + tests/t-triggers-halt/pkg-remove/DEBIAN/control | 7 ++++++ tests/t-triggers-halt/pkg-trigger/DEBIAN/control | 8 +++++++ tests/t-triggers-halt/pkg-trigger/DEBIAN/postinst | 23 +++++++++++++++++++ tests/t-triggers-halt/pkg-trigger/DEBIAN/triggers | 1 + 8 files changed, 81 insertions(+) create mode 100644 tests/t-triggers-halt/Makefile create mode 100644 tests/t-triggers-halt/pkg-depends/DEBIAN/control create mode 100644 tests/t-triggers-halt/pkg-files/DEBIAN/control create mode 100644 tests/t-triggers-halt/pkg-files/test/trigger/test-file create mode 100644 tests/t-triggers-halt/pkg-remove/DEBIAN/control create mode 100644 tests/t-triggers-halt/pkg-trigger/DEBIAN/control create mode 100755 tests/t-triggers-halt/pkg-trigger/DEBIAN/postinst create mode 100644 tests/t-triggers-halt/pkg-trigger/DEBIAN/triggers (limited to 'tests/t-triggers-halt') diff --git a/tests/t-triggers-halt/Makefile b/tests/t-triggers-halt/Makefile new file mode 100644 index 0000000..0ce5c0f --- /dev/null +++ b/tests/t-triggers-halt/Makefile @@ -0,0 +1,26 @@ +TESTS_DEB := pkg-files pkg-depends pkg-remove pkg-trigger + +include ../Test.mk + +test-case: + # This is what apt is doing currently. :( + $(DPKG_INSTALL) pkg-files.deb + $(DPKG_INSTALL) pkg-depends.deb + $(DPKG_INSTALL) pkg-remove.deb + $(DPKG_INSTALL) pkg-trigger.deb + $(DPKG_REMOVE) --force-depends pkg-remove + $(DPKG_INSTALL) pkg-files.deb + $(DPKG_UNPACK) pkg-depends.deb + + $(DPKG) -s pkg-trigger pkg-files pkg-depends + + # Make sure everything is left in the expected state. + $(call pkg_status_is,pkg-depends,install ok unpacked) + $(call pkg_status_is,pkg-files,install ok triggers-awaited) + $(call pkg_status_is,pkg-trigger,install ok triggers-pending) + + # Should fail due to unsatisfied dependencies. + ! $(DPKG_CONFIGURE) pkg-trigger pkg-depends + +test-clean: + -$(DPKG_PURGE) pkg-trigger pkg-depends pkg-files diff --git a/tests/t-triggers-halt/pkg-depends/DEBIAN/control b/tests/t-triggers-halt/pkg-depends/DEBIAN/control new file mode 100644 index 0000000..aadf8be --- /dev/null +++ b/tests/t-triggers-halt/pkg-depends/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-depends +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers +Architecture: all +Depends: pkg-files +Description: test package - package to be configured diff --git a/tests/t-triggers-halt/pkg-files/DEBIAN/control b/tests/t-triggers-halt/pkg-files/DEBIAN/control new file mode 100644 index 0000000..92fa468 --- /dev/null +++ b/tests/t-triggers-halt/pkg-files/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-files +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers +Architecture: all +Description: test package - provides a file under /test/trigger/ diff --git a/tests/t-triggers-halt/pkg-files/test/trigger/test-file b/tests/t-triggers-halt/pkg-files/test/trigger/test-file new file mode 100644 index 0000000..fb67027 --- /dev/null +++ b/tests/t-triggers-halt/pkg-files/test/trigger/test-file @@ -0,0 +1 @@ +sample file diff --git a/tests/t-triggers-halt/pkg-remove/DEBIAN/control b/tests/t-triggers-halt/pkg-remove/DEBIAN/control new file mode 100644 index 0000000..59c8876 --- /dev/null +++ b/tests/t-triggers-halt/pkg-remove/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-remove +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers +Architecture: all +Description: test package - package to be removed diff --git a/tests/t-triggers-halt/pkg-trigger/DEBIAN/control b/tests/t-triggers-halt/pkg-trigger/DEBIAN/control new file mode 100644 index 0000000..05a4d31 --- /dev/null +++ b/tests/t-triggers-halt/pkg-trigger/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-trigger +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers +Architecture: all +Depends: pkg-remove, pkg-depends +Description: test package - interested in files on /test/trigger/ diff --git a/tests/t-triggers-halt/pkg-trigger/DEBIAN/postinst b/tests/t-triggers-halt/pkg-trigger/DEBIAN/postinst new file mode 100755 index 0000000..72b74a1 --- /dev/null +++ b/tests/t-triggers-halt/pkg-trigger/DEBIAN/postinst @@ -0,0 +1,23 @@ +#!/bin/sh +set -e + +case "$1" in + triggered) + pkg_status=`dpkg-query -f '${Status}' -W pkg-depends` + if [ "$pkg_status" = "install ok installed" ]; then + echo "Pass: pkg-depends is installed" + else + echo "Fail: pkg-depends is not installed ($pkg_status)" + exit 1 + fi + pkg_status=`dpkg-query -f '${Status}' -W pkg-nonexistent` + if [ "$pkg_status" = "install ok installed" ]; then + echo "Pass: pkg-nonexistent is installed" + else + echo "Fail: pkg-nonexistent is not installed ($pkg_status)" + exit 1 + fi + ;; +esac + +exit 0 diff --git a/tests/t-triggers-halt/pkg-trigger/DEBIAN/triggers b/tests/t-triggers-halt/pkg-trigger/DEBIAN/triggers new file mode 100644 index 0000000..3b047af --- /dev/null +++ b/tests/t-triggers-halt/pkg-trigger/DEBIAN/triggers @@ -0,0 +1 @@ +interest /test/trigger -- cgit v1.2.3