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-switch-dir-to-symlink-abs | |
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-switch-dir-to-symlink-abs')
25 files changed, 249 insertions, 0 deletions
diff --git a/tests/t-switch-dir-to-symlink-abs/Makefile b/tests/t-switch-dir-to-symlink-abs/Makefile new file mode 100644 index 0000000..028cb93 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/Makefile @@ -0,0 +1,146 @@ +TESTS_DEB := \ + pkg-dir-conffile-0 pkg-dir-conffile-1 \ + pkg-dir-file-other pkg-dir-symlink-int-0 pkg-dir-symlink-int-1 \ + pkg-dir-file-moved pkg-dir-symlink-ext-0 pkg-dir-symlink-ext-1 + +include ../Test.mk + +build-hook: + ln -sfT test-dir pkg-dir-conffile-1/test-path + ln -sfT test-dir pkg-dir-symlink-ext-1/test-path + ln -sfT test-dir pkg-dir-symlink-int-1/test-path + +clean-hook: + $(RM) pkg-dir-conffile-1/test-path + $(RM) pkg-dir-symlink-ext-1/test-path + $(RM) pkg-dir-symlink-int-1/test-path + +test-case: + # Cannot switch a directory containing conffiles + $(DPKG_INSTALL) pkg-dir-conffile-0.deb + test -d '$(DPKG_INSTDIR)/test-path' + ! $(DPKG_INSTALL) pkg-dir-conffile-1.deb + test -d '$(DPKG_INSTDIR)/test-path' + $(DPKG_PURGE) pkg-dir-conffile + + # Cannot switch a directory containing files owned by another package + $(DPKG_INSTALL) pkg-dir-file-other.deb + $(DPKG_INSTALL) pkg-dir-symlink-int-0.deb + test -d '$(DPKG_INSTDIR)/test-path' + ! test -h '$(DPKG_INSTDIR)/test-path' + ! $(DPKG_INSTALL) pkg-dir-symlink-int-1.deb + test -d '$(DPKG_INSTDIR)/test-path' + ! test -h '$(DPKG_INSTDIR)/test-path' + $(DPKG_PURGE) pkg-dir-symlink-int + $(DPKG_PURGE) pkg-dir-file-other + + # Cannot switch a directory containing local files + $(DPKG_INSTALL) pkg-dir-symlink-int-0.deb + test -d '$(DPKG_INSTDIR)/test-path' + ! test -h '$(DPKG_INSTDIR)/test-path' + touch '$(DPKG_INSTDIR)/test-path/local file' + ! $(DPKG_INSTALL) pkg-dir-symlink-int-1.deb + test -d '$(DPKG_INSTDIR)/test-path' + ! test -h '$(DPKG_INSTDIR)/test-path' + rm '$(DPKG_INSTDIR)/test-path/local file' + $(DPKG_PURGE) pkg-dir-symlink-int + + # + # Otherwise allow the switch + # + + # Switch a directory to a symlink, contents moved within the package, + # with intermediate full installs. + $(DPKG_INSTALL) pkg-dir-symlink-int-0.deb + test -d '$(DPKG_INSTDIR)/test-path' + ! test -h '$(DPKG_INSTDIR)/test-path' + $(DPKG_INSTALL) pkg-dir-symlink-int-1.deb + test -h '$(DPKG_INSTDIR)/test-path' + $(DPKG_PURGE) pkg-dir-symlink-int + ! test -e '$(DPKG_INSTDIR)/test-path' + + # Switch a directory to a symlink, contents moved within the package, + # with full install, upgrade with upack and configure. + $(DPKG_INSTALL) pkg-dir-symlink-int-0.deb + ! test -h '$(DPKG_INSTDIR)/test-path' + test -d '$(DPKG_INSTDIR)/test-path' + $(DPKG_UNPACK) pkg-dir-symlink-int-1.deb + ! test -h '$(DPKG_INSTDIR)/test-path' + test -d '$(DPKG_INSTDIR)/test-path' + $(DPKG_CONFIGURE) pkg-dir-symlink-int + test -h '$(DPKG_INSTDIR)/test-path' + $(DPKG_PURGE) pkg-dir-symlink-int + ! test -e '$(DPKG_INSTDIR)/test-path' + + # Switch a directory to a symlink, contents moved within the package, + # with two unpacks and configure. + $(DPKG_UNPACK) pkg-dir-symlink-int-0.deb + ! test -h '$(DPKG_INSTDIR)/test-path' + $(DPKG_UNPACK) pkg-dir-symlink-int-1.deb + ! test -h '$(DPKG_INSTDIR)/test-path' + test -d '$(DPKG_INSTDIR)/test-path' + $(DPKG_CONFIGURE) pkg-dir-symlink-int + test -h '$(DPKG_INSTDIR)/test-path' + $(DPKG_PURGE) pkg-dir-symlink-int + ! test -e '$(DPKG_INSTDIR)/test-path' + + # Switch a directory to a symlink, contents moved to another package, + # with intermediate full installs. + $(DPKG_INSTALL) pkg-dir-symlink-ext-0.deb + test -d '$(DPKG_INSTDIR)/test-path' + $(DPKG_INSTALL) pkg-dir-file-moved.deb + test -d '$(DPKG_INSTDIR)/test-path' + test -d '$(DPKG_INSTDIR)/test-dir' + $(DPKG_INSTALL) pkg-dir-symlink-ext-1.deb + test -h '$(DPKG_INSTDIR)/test-path' + test "`readlink -f '$(DPKG_INSTDIR)/test-path'`" = "/test-dir" + ! test -h '$(DPKG_INSTDIR)/test-dir' + test -d '$(DPKG_INSTDIR)/test-dir' + test -f '$(DPKG_INSTDIR)/test-dir/file-normal' + $(DPKG_PURGE) pkg-dir-symlink-ext + $(DPKG_PURGE) pkg-dir-file-moved + + # Switch a directory to a symlink, contents moved to another package, + # with full installs, upgrade with upack and configure. + $(DPKG_INSTALL) pkg-dir-symlink-ext-0.deb + test -d '$(DPKG_INSTDIR)/test-path' + $(DPKG_INSTALL) pkg-dir-file-moved.deb + test -d '$(DPKG_INSTDIR)/test-path' + test -d '$(DPKG_INSTDIR)/test-dir' + $(DPKG_UNPACK) pkg-dir-symlink-ext-1.deb + test -d '$(DPKG_INSTDIR)/test-path' + test -d '$(DPKG_INSTDIR)/test-dir' + $(DPKG_CONFIGURE) -a + test -h '$(DPKG_INSTDIR)/test-path' + test "`readlink -f '$(DPKG_INSTDIR)/test-path'`" = "/test-dir" + ! test -h '$(DPKG_INSTDIR)/test-dir' + test -d '$(DPKG_INSTDIR)/test-dir' + test -f '$(DPKG_INSTDIR)/test-dir/file-normal' + $(DPKG_PURGE) pkg-dir-symlink-ext + $(DPKG_PURGE) pkg-dir-file-moved + + # Switch a directory to a symlink, contents moved to another package, + # with three unpacks and configure. + $(DPKG_UNPACK) pkg-dir-symlink-ext-0.deb + test -d '$(DPKG_INSTDIR)/test-path' + $(DPKG_UNPACK) pkg-dir-file-moved.deb + test -d '$(DPKG_INSTDIR)/test-path' + test -d '$(DPKG_INSTDIR)/test-dir' + $(DPKG_UNPACK) pkg-dir-symlink-ext-1.deb + test -d '$(DPKG_INSTDIR)/test-path' + test -d '$(DPKG_INSTDIR)/test-dir' + $(DPKG_CONFIGURE) -a + test -h '$(DPKG_INSTDIR)/test-path' + test "`readlink -f '$(DPKG_INSTDIR)/test-path'`" = "/test-dir" + ! test -h '$(DPKG_INSTDIR)/test-dir' + test -d '$(DPKG_INSTDIR)/test-dir' + test -f '$(DPKG_INSTDIR)/test-dir/file-normal' + $(DPKG_PURGE) pkg-dir-symlink-ext + $(DPKG_PURGE) pkg-dir-file-moved + +test-clean: + $(DPKG_PURGE) pkg-dir-conffile + $(DPKG_PURGE) pkg-dir-symlink-int + $(DPKG_PURGE) pkg-dir-symlink-ext + $(DPKG_PURGE) pkg-dir-file-other + $(DPKG_PURGE) pkg-dir-file-moved diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-0/DEBIAN/conffiles b/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-0/DEBIAN/conffiles new file mode 100644 index 0000000..296ef19 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-0/DEBIAN/conffiles @@ -0,0 +1 @@ +/test-path/file-conf diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-0/DEBIAN/control b/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-0/DEBIAN/control new file mode 100644 index 0000000..57fdc53 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-0/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-dir-conffile +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - package with dir to be switched to symlink diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-0/test-path/file-conf b/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-0/test-path/file-conf new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-0/test-path/file-conf diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-1/DEBIAN/control b/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-1/DEBIAN/control new file mode 100644 index 0000000..69f4d74 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-1/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-dir-conffile +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - package switching dir to symlink diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-1/DEBIAN/postinst b/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-1/DEBIAN/postinst new file mode 100755 index 0000000..1e539b9 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-1/DEBIAN/postinst @@ -0,0 +1,5 @@ +#!/bin/sh +set -e +if dpkg-maintscript-helper supports dir_to_symlink; then + dpkg-maintscript-helper dir_to_symlink /test-path /test-dir 0 -- "$@" +fi diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-1/DEBIAN/postrm b/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-1/DEBIAN/postrm new file mode 100755 index 0000000..1e539b9 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-1/DEBIAN/postrm @@ -0,0 +1,5 @@ +#!/bin/sh +set -e +if dpkg-maintscript-helper supports dir_to_symlink; then + dpkg-maintscript-helper dir_to_symlink /test-path /test-dir 0 -- "$@" +fi diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-1/DEBIAN/preinst b/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-1/DEBIAN/preinst new file mode 100755 index 0000000..1e539b9 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-conffile-1/DEBIAN/preinst @@ -0,0 +1,5 @@ +#!/bin/sh +set -e +if dpkg-maintscript-helper supports dir_to_symlink; then + dpkg-maintscript-helper dir_to_symlink /test-path /test-dir 0 -- "$@" +fi diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-file-moved/DEBIAN/control b/tests/t-switch-dir-to-symlink-abs/pkg-dir-file-moved/DEBIAN/control new file mode 100644 index 0000000..db492dd --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-file-moved/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-dir-file-moved +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - package with file moved from dir-to-symlink switch diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-file-moved/test-dir/file-normal b/tests/t-switch-dir-to-symlink-abs/pkg-dir-file-moved/test-dir/file-normal new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-file-moved/test-dir/file-normal diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-file-other/DEBIAN/control b/tests/t-switch-dir-to-symlink-abs/pkg-dir-file-other/DEBIAN/control new file mode 100644 index 0000000..985c6db --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-file-other/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-dir-file-other +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - package with real dir and contents diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-file-other/test-path/file-other b/tests/t-switch-dir-to-symlink-abs/pkg-dir-file-other/test-path/file-other new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-file-other/test-path/file-other diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-ext-0/DEBIAN/control b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-ext-0/DEBIAN/control new file mode 100644 index 0000000..f9aca91 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-ext-0/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-dir-symlink-ext +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - package with dir to be switched to symlink diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-ext-0/test-path/file-normal b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-ext-0/test-path/file-normal new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-ext-0/test-path/file-normal diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-ext-1/DEBIAN/control b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-ext-1/DEBIAN/control new file mode 100644 index 0000000..255195b --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-ext-1/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-dir-symlink-ext +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Depends: pkg-dir-file-moved (>= 1) +Description: test package - package switching dir to symlink diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-ext-1/DEBIAN/postinst b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-ext-1/DEBIAN/postinst new file mode 100755 index 0000000..1e539b9 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-ext-1/DEBIAN/postinst @@ -0,0 +1,5 @@ +#!/bin/sh +set -e +if dpkg-maintscript-helper supports dir_to_symlink; then + dpkg-maintscript-helper dir_to_symlink /test-path /test-dir 0 -- "$@" +fi diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-ext-1/DEBIAN/postrm b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-ext-1/DEBIAN/postrm new file mode 100755 index 0000000..1e539b9 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-ext-1/DEBIAN/postrm @@ -0,0 +1,5 @@ +#!/bin/sh +set -e +if dpkg-maintscript-helper supports dir_to_symlink; then + dpkg-maintscript-helper dir_to_symlink /test-path /test-dir 0 -- "$@" +fi diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-ext-1/DEBIAN/preinst b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-ext-1/DEBIAN/preinst new file mode 100755 index 0000000..1e539b9 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-ext-1/DEBIAN/preinst @@ -0,0 +1,5 @@ +#!/bin/sh +set -e +if dpkg-maintscript-helper supports dir_to_symlink; then + dpkg-maintscript-helper dir_to_symlink /test-path /test-dir 0 -- "$@" +fi diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-0/DEBIAN/control b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-0/DEBIAN/control new file mode 100644 index 0000000..3526664 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-0/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-dir-symlink-int +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - package with dir to be switched to symlink diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-0/test-path/file-normal b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-0/test-path/file-normal new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-0/test-path/file-normal diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-1/DEBIAN/control b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-1/DEBIAN/control new file mode 100644 index 0000000..6852587 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-1/DEBIAN/control @@ -0,0 +1,7 @@ +Package: pkg-dir-symlink-int +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org> +Architecture: all +Description: test package - package switching dir to symlink diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-1/DEBIAN/postinst b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-1/DEBIAN/postinst new file mode 100755 index 0000000..1e539b9 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-1/DEBIAN/postinst @@ -0,0 +1,5 @@ +#!/bin/sh +set -e +if dpkg-maintscript-helper supports dir_to_symlink; then + dpkg-maintscript-helper dir_to_symlink /test-path /test-dir 0 -- "$@" +fi diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-1/DEBIAN/postrm b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-1/DEBIAN/postrm new file mode 100755 index 0000000..1e539b9 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-1/DEBIAN/postrm @@ -0,0 +1,5 @@ +#!/bin/sh +set -e +if dpkg-maintscript-helper supports dir_to_symlink; then + dpkg-maintscript-helper dir_to_symlink /test-path /test-dir 0 -- "$@" +fi diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-1/DEBIAN/preinst b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-1/DEBIAN/preinst new file mode 100755 index 0000000..1e539b9 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-1/DEBIAN/preinst @@ -0,0 +1,5 @@ +#!/bin/sh +set -e +if dpkg-maintscript-helper supports dir_to_symlink; then + dpkg-maintscript-helper dir_to_symlink /test-path /test-dir 0 -- "$@" +fi diff --git a/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-1/test-dir/file-other b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-1/test-dir/file-other new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/t-switch-dir-to-symlink-abs/pkg-dir-symlink-int-1/test-dir/file-other |