Bug#850630: [Pkg-emacsen-addons] Bug#850630: elpa-company: Fails to upgrade from 0.8.12-4 when xemacs21 installed

2017-01-08 Thread David Bremner
Sean Whitton  writes:

> On Sun, Jan 08, 2017 at 04:25:07PM -0400, David Bremner wrote:
>> I agree we should fix both upgrade problems. But we should also document
>> what we are actually fixing
>
> Agreed.  I've pushed two more commits to the upgrade-fix branch.
>
> If you approve, and have nothing else to add, I can perform a team upload.
>

That version looks good to me (I didn't test it, but I guess you have/will).

d



Bug#850630: [Pkg-emacsen-addons] Bug#850630: elpa-company: Fails to upgrade from 0.8.12-4 when xemacs21 installed

2017-01-08 Thread Sean Whitton
On Sun, Jan 08, 2017 at 04:25:07PM -0400, David Bremner wrote:
> I agree we should fix both upgrade problems. But we should also document
> what we are actually fixing

Agreed.  I've pushed two more commits to the upgrade-fix branch.

If you approve, and have nothing else to add, I can perform a team upload.

-- 
Sean Whitton
From dc23d9be6631d1dcdbe909dde8402bf0faf8f640 Mon Sep 17 00:00:00 2001
From: Sean Whitton 
Date: Sun, 8 Jan 2017 14:59:24 -0700
Subject: [PATCH 2/3] simplify fix for xemacs21

---
 debian/elpa-company.prerm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/debian/elpa-company.prerm b/debian/elpa-company.prerm
index 905d734..6595b40 100755
--- a/debian/elpa-company.prerm
+++ b/debian/elpa-company.prerm
@@ -8,7 +8,7 @@ set -e
 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/'
+-e '/Skipping unsupported emacs ${FLAVOUR}/a \   exit 0'
 sed --quiet -i "$broken_remove_script" \
 -e 's/emacs23)/emacs2[0123]*)/'
 fi
-- 
2.11.0

From a7561341a6e9ed5b62ed46a7e39f6de6133cc4a9 Mon Sep 17 00:00:00 2001
From: Sean Whitton 
Date: Sun, 8 Jan 2017 14:59:32 -0700
Subject: [PATCH 3/3] properly document prerm script

---
 debian/elpa-company.prerm | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/debian/elpa-company.prerm b/debian/elpa-company.prerm
index 6595b40..6d4dc33 100755
--- a/debian/elpa-company.prerm
+++ b/debian/elpa-company.prerm
@@ -2,13 +2,19 @@
 
 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
+# Pre-emptively upgrade emacsen-common remove script to deal with several
+# possible issues when upgrading from version 0.8.12-4 or older.  These can
+# cause the emacsen-common remove script to exit non-zero, breaking the package
+# 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"
+
+# (1) exit cleanly for xemacs21 -- without this, the call to find(1) can
+# exit non-zero
 sed --quiet -i "$broken_remove_script" \
 -e '/Skipping unsupported emacs ${FLAVOUR}/a \   exit 0'
+
+# (2) exit cleanly for yet older unsupported Emacsen that might be installed
 sed --quiet -i "$broken_remove_script" \
 -e 's/emacs23)/emacs2[0123]*)/'
 fi
-- 
2.11.0



signature.asc
Description: PGP signature


Bug#850630: [Pkg-emacsen-addons] Bug#850630: elpa-company: Fails to upgrade from 0.8.12-4 when xemacs21 installed

2017-01-08 Thread David Bremner
Sean Whitton  writes:

>> > + sed --quiet -i "$broken_remove_script" \ + -e
>> > 's/emacs23)/emacs2[0123]*)/'
>> 
>> this seems unrelated to the problem in the comments. Did you mean to say
>> something like "xemacs21 or gnu emacs version 20-22"
>
> It's unrelated, but I thought it would be best to update the
> emacsen-common remove script completely to avoid any other upgrade
> issues that might arise.  Would you prefer to keep the fix more minimal?
>

I agree we should fix both upgrade problems. But we should also document
what we are actually fixing



Bug#850630: [Pkg-emacsen-addons] Bug#850630: elpa-company: Fails to upgrade from 0.8.12-4 when xemacs21 installed

2017-01-08 Thread Sean Whitton
Thank you for your review!

On Sun, Jan 08, 2017 at 02:23:42PM -0400, David Bremner wrote:
> I think you mean -4 and below

Yes.

> > +# 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/'
> 
> this is OK, but it might be simpler to add the 'exit 0' that dh-elpa 1.6
> added to the xemacs case.

Okay.

> > + sed --quiet -i "$broken_remove_script" \ + -e
> > 's/emacs23)/emacs2[0123]*)/'
> 
> this seems unrelated to the problem in the comments. Did you mean to say
> something like "xemacs21 or gnu emacs version 20-22"

It's unrelated, but I thought it would be best to update the
emacsen-common remove script completely to avoid any other upgrade
issues that might arise.  Would you prefer to keep the fix more minimal?

-- 
Sean Whitton


signature.asc
Description: PGP signature


Bug#850630: [Pkg-emacsen-addons] Bug#850630: elpa-company: Fails to upgrade from 0.8.12-4 when xemacs21 installed

2017-01-08 Thread David Bremner
Sean Whitton  writes:



> +++ 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

I think you mean -4 and below
> +# 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/'

this is OK, but it might be simpler to add the 'exit 0' that dh-elpa 1.6
added to the xemacs case.

> +sed --quiet -i "$broken_remove_script" \
> +-e 's/emacs23)/emacs2[0123]*)/'

this seems unrelated to the problem in the comments. Did you mean to say
something like "xemacs21 or gnu emacs version 20-22"



Bug#850630: elpa-company: Fails to upgrade from 0.8.12-4 when xemacs21 installed

2017-01-08 Thread Sean Whitton
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 
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   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 000..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



signature.asc
Description: PGP signature