Package: elpa-company
Version: 0.8.12-5
Severity: important
Tags: patch

Dear maintainer,

If xemacs21 is installed, apt cannot upgrade from elpa-company 0.8.12-4
to 0.8.12-5.

Steps to reproduce in a minimal sid chroot:

    apt-get install xemacs21
    apt-get install elpa-company=0.8.12-4
    apt-get install elpa-company=0.8.12-5

Sample output:

    Preparing to unpack .../elpa-company_0.8.12-5_all.deb ...
    Remove elpa-company for xemacs21
    remove/company-0.8.12: Skipping unsupported emacs
    dh-elpa: purging flavor specific files for xemacs21
    find: '/usr/share/xemacs21/site-lisp/elpa/company-0.8.12': No such file or 
directory
    ERROR: remove script from elpa-company package failed
    dpkg: warning: subprocess old pre-removal script returned error exit status 
1
    dpkg: trying script from the new package instead ...
    Remove elpa-company for xemacs21
    remove/company-0.8.12: Skipping unsupported emacs
    dh-elpa: purging flavor specific files for xemacs21
    find: '/usr/share/xemacs21/site-lisp/elpa/company-0.8.12': No such file or 
directory
    ERROR: remove script from elpa-company package failed
    dpkg: error processing archive 
/var/cache/apt/archives/elpa-company_0.8.12-5_all.deb (--unpack):
     subprocess new pre-removal script returned error exit status 1

The attached patch fixes the problem (also available as a branch
'upgrade-fix' in the team git repository).  Please consider uploading it
before 0.8.12-5 migrates to stretch.

Thanks to 'cruncher' on #debian-next for help with this fix.

-- System Information:
Debian Release: stretch/sid
  APT prefers testing
  APT policy: (900, 'testing')
Architecture: i386 (i686)

Kernel: Linux 4.8.0-1-686-pae (SMP w/2 CPU cores)
Locale: LANG=en_GB.utf8, LC_CTYPE=en_GB.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages elpa-company depends on:
ii  emacs              46.1
ii  emacs24 [emacsen]  24.5+1-7.1
ii  emacs25 [emacsen]  25.1+1-3
ii  emacsen-common     2.0.8

elpa-company recommends no packages.

elpa-company suggests no packages.

-- no debconf information

-- 
Sean Whitton
From d379d65b76d975b91a30f5e8905c8cabdfe96bc9 Mon Sep 17 00:00:00 2001
From: Sean Whitton <spwhit...@spwhitton.name>
Date: Sun, 8 Jan 2017 10:21:21 -0700
Subject: [PATCH] add d/elpa-company.prerm to fix upgrade from -4

---
 debian/changelog          |  8 ++++++++
 debian/elpa-company.prerm | 16 ++++++++++++++++
 2 files changed, 24 insertions(+)
 create mode 100755 debian/elpa-company.prerm

diff --git a/debian/changelog b/debian/changelog
index 83b346b..9eabae8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+company-mode (0.8.12-6) UNRELEASED; urgency=medium
+
+  * Team upload.
+  * Add d/elpa-company.prerm to fix upgrades from 0.8.12-4 and below.
+    Thanks to 'cruncher' on #debian-next for help preparing the fix.
+
+ -- Sean Whitton <spwhit...@spwhitton.name>  Sun, 08 Jan 2017 10:20:35 -0700
+
 company-mode (0.8.12-5) unstable; urgency=medium
 
   * Rebuild with dh-elpa 1.5. Fix for removal in the presence of xemacs (fix
diff --git a/debian/elpa-company.prerm b/debian/elpa-company.prerm
new file mode 100755
index 0000000..905d734
--- /dev/null
+++ b/debian/elpa-company.prerm
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+set -e
+
+# fix upgrade from 0.8.12-5 and below, which can fail if xemacs21 is
+# also installed.  We manually upgrade the emacsen-common remove
+# script so that it won't exit non-zero, which blocks the upgrade
+if [ "$1" = "failed-upgrade" ] && dpkg --compare-versions "$2" lt 0.8.12-5; then
+    broken_remove_script="/usr/lib/emacsen-common/packages/remove/elpa-company"
+    sed --quiet -i "$broken_remove_script" \
+        -e 's/find ${elc_dir} -type l -delete/[ -d ${elc_dir} ] && find ${elc_dir} -type l -delete/'
+    sed --quiet -i "$broken_remove_script" \
+        -e 's/emacs23)/emacs2[0123]*)/'
+fi
+
+#DEBHELPER#
-- 
2.11.0

Attachment: signature.asc
Description: PGP signature

Reply via email to