Bug#619817: Patch for perl upgrade triggers

2011-04-09 Thread Dominic Hargreaves
On Sun, Mar 27, 2011 at 02:05:21PM +0100, Dominic Hargreaves wrote:
 tags 619817 + patch
 thanks
 
 Please find attached a patch fixing this. Note that there is still some
 discussion in #619275 about the exact details of the implementation.

I think there is consensus in that bug that this can be applied, so please
go ahead at your leisure :)

Cheers,
Dominic.

-- 
Dominic Hargreaves | http://www.larted.org.uk/~dom/
PGP key 5178E2A5 from the.earth.li (keyserver,web,email)



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#619817: Patch for perl upgrade triggers

2011-03-27 Thread Dominic Hargreaves
tags 619817 + patch
thanks

Please find attached a patch fixing this. Note that there is still some
discussion in #619275 about the exact details of the implementation.

Cheers,
Dominic.

-- 
Dominic Hargreaves | http://www.larted.org.uk/~dom/
PGP key 5178E2A5 from the.earth.li (keyserver,web,email)
diff -Nru spamassassin-3.3.1/debian/changelog spamassassin-3.3.1/debian/changelog
--- spamassassin-3.3.1/debian/changelog	2010-03-25 04:01:18.0 +
+++ spamassassin-3.3.1/debian/changelog	2011-02-26 18:49:43.0 +
@@ -1,3 +1,12 @@
+spamassassin (3.3.1-1.1~test.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Register an interest in the perl-major-upgrade trigger, and
+recompile rules and restart spamd when perl is upgraded to a new
+major version.
+
+ -- Dominic Hargreaves d...@earth.li  Sat, 26 Feb 2011 18:48:49 +
+
 spamassassin (3.3.1-1) unstable; urgency=low
 
   * New upstream version.
diff -Nru spamassassin-3.3.1/debian/spamassassin.postinst spamassassin-3.3.1/debian/spamassassin.postinst
--- spamassassin-3.3.1/debian/spamassassin.postinst	2010-03-01 09:01:23.0 +
+++ spamassassin-3.3.1/debian/spamassassin.postinst	2011-03-20 21:55:37.0 +
@@ -2,15 +2,29 @@
 
 set -e
 
-# Compile, if rules have previously been compiled, and it's possible
-if [ -x /usr/bin/re2c -a -x /usr/bin/sa-compile -a -d /var/lib/spamassassin/compiled ]; then
-echo Running sa-compile (may take a long time)
-sa-compile --quiet
+sa_compile() {
+# Compile, if rules have previously been compiled, and it's possible
+if [ -x /usr/bin/re2c -a -x /usr/bin/sa-compile -a -d /var/lib/spamassassin/compiled ]; then
+echo Running sa-compile (may take a long time)
+sa-compile --quiet
+fi
+}
+
+sa_fix_broken_gpg_key () {
+# Work around broken key caused by gpg upgrade
+if [ -f /etc/spamassassin/sa-update-keys/pubring.gpg -a -f /usr/share/doc/spamassassin/GPG.KEY ]; then
+sa-update --import /usr/share/doc/spamassassin/GPG.KEY
+fi
+}
+
+if [ $1 = configure ]; then
+sa_compile
+sa_fix_broken_gpg_key
 fi
 
-# Work around broken key caused by gpg upgrade
-if [ -f /etc/spamassassin/sa-update-keys/pubring.gpg -a -f /usr/share/doc/spamassassin/GPG.KEY ]; then
-sa-update --import /usr/share/doc/spamassassin/GPG.KEY
+if [ $1 = triggered ]  [ $2 = perl-major-upgrade ]; then
+sa_compile
+invoke-rc.d spamassassin restart
 fi
 
 #DEBHELPER#
diff -Nru spamassassin-3.3.1/debian/spamassassin.triggers spamassassin-3.3.1/debian/spamassassin.triggers
--- spamassassin-3.3.1/debian/spamassassin.triggers	1970-01-01 01:00:00.0 +0100
+++ spamassassin-3.3.1/debian/spamassassin.triggers	2011-02-26 18:48:46.0 +
@@ -0,0 +1 @@
+interest perl-major-upgrade