From: Andreas Beckmann Date: Sun, 27 Jan 2019 16:08:55 +0000 (+0100) Subject: Really handle the emacs-{gtk,lucid,nox} doc dir transition manually X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1~1^2~166 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=64d474397add56275dabea5ed48ed9c1ae448adc;p=emacs.git Really handle the emacs-{gtk,lucid,nox} doc dir transition manually reimplementing the guts of dir_to_symlink is quite easy: in the postinst replace the empty directory with the intended symlink caveats compared to dpkg-maintscript-helper: * fails during postinst (not preinst) if the directory is not empty * absolutely no rollback or downgrade support --- diff --git a/debian/changelog b/debian/changelog index 71e16ad7ae6..04a178708a0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,13 @@ emacs (1:26.1+1-3.1) UNRELEASED; urgency=medium * Non-maintainer upload. + * Really handle the emacs-{gtk,lucid,nox} doc dir transition manually. + This cannot be handled by 'dpkg-maintscript-helper dir_to_symlink' because + of the arch:all to arch:any switch at the same time (bug #813455). + Do not forcibly remove the old docdir in the preinst to avoid bad effects + on other packages. Instead, in the postinst, replace the now empty + directory with the intended symlink. (Closes: #911616) + -- Andreas Beckmann Sun, 27 Jan 2019 16:56:15 +0100 emacs (1:26.1+1-3) unstable; urgency=medium @@ -77,7 +84,7 @@ emacs (1:25.2+1-10) unstable; urgency=medium * Handle the emacs-{gtk,lucid,nox} doc dir transition manually. Before the unversioning, these packages were in a different source package (emacs-defaults) and were arch all. Since - dpkg-mainscript-helper can't hande "all to any" transitions + dpkg-maintscript-helper can't hande "all to any" transitions (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=813455), clean up manually in the preinsts. Thanks to Sven Joachim for reporting the problem and indentifying the underlying cause. diff --git a/debian/emacsVAR.postinst b/debian/emacsVAR.postinst index 8dadd23a896..6ff8576f416 100644 --- a/debian/emacsVAR.postinst +++ b/debian/emacsVAR.postinst @@ -2,6 +2,20 @@ set -e +# Manual dir_to_symlink conversion since dpkg-maintscript-helper does not +# handle this in combination with arch:all to arch:any switches (#813455). +# Keep this code for buster and bullseye to ease backports. +if [ "$1" = "configure" ] && dpkg --compare-versions "$2" lt-nl "1:26.1+1-3.1~" +then + test -n '@PKG_NAME@' + if [ -d /usr/share/doc/@PKG_NAME@ ] && [ ! -h /usr/share/doc/@PKG_NAME@ ] + then + # This will intentionally fail if the directory is not empty. + rmdir /usr/share/doc/@PKG_NAME@ + ln -sv emacs-common /usr/share/doc/@PKG_NAME@ + fi +fi + update-alternatives \ --install /usr/bin/emacs emacs \ /usr/bin/emacs-@X_SUPPORT@ @BIN_PRIORITY@ \ diff --git a/debian/emacsVAR.preinst b/debian/emacsVAR.preinst deleted file mode 100644 index 26aac393c65..00000000000 --- a/debian/emacsVAR.preinst +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -set -e - -doc_dir=/usr/share/doc/@PKG_NAME@ - -test '@PKG_NAME@' - -case "$1" in - install|upgrade) - # Before the unversioning, emacs-{gtk,lucid,nox} packages were - # in a different source package (emacs-defaults) and were arch - # all, and dpkg can't handle dir to symlink transitions. - rm -rf "$doc_dir" - ;; - abort-upgrade) - ;; - *) - echo "unexpected $(basename "$0") argument" - ;; -esac - -#DEBHELPER# diff --git a/debian/rules b/debian/rules index 6a3c40a2833..b2bd4931fcc 100755 --- a/debian/rules +++ b/debian/rules @@ -129,12 +129,9 @@ nonpersistent_autogen_install_files := \ debian/emacs-common.postinst \ debian/emacs-common.prerm \ debian/emacs-nox.postinst \ - debian/emacs-nox.preinst \ debian/emacs-nox.prerm \ debian/emacs-lucid.postinst \ - debian/emacs-lucid.preinst \ debian/emacs-lucid.prerm \ - debian/emacs-gtk.preinst \ debian/emacs-gtk.postinst \ debian/emacs-gtk.prerm