[Pkg-dspam-misc] Bug#659717: dspam: use dh_installdeb maintscript support

Colin Watson cjwatson at ubuntu.com
Mon Feb 13 12:22:00 UTC 2012


Package: dspam
Version: 3.10.1+dfsg-3
Severity: wishlist
Tags: patch
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu ubuntu-patch precise

Using 'dpkg-maintscript-helper supports rm_conffile' guards introduces
unreliability into upgrades; it means that the conffile is removed or
not depending on whether dpkg happens to be unpacked before
dspam-webfrontend/libdspam7-drv-mysql/libdspam7-drv-sqlite3.  This seems
generally undesirable; it would be better to enforce a single code path.
(This is academic for Debian because the version of dpkg in squeeze
supported dpkg-maintscript-helper, hence Severity: wishlist; Ubuntu's
last LTS release didn't have a sufficient version of dpkg for that which
is why I care.)

It would be nice to just use dh_installdeb's support for generating
dpkg-maintscript-helper commands, which was introduced in debhelper
8.1.0.  This would remove duplicate code from your maintainer scripts -
in fact, you could remove some of your handwritten maintainer scripts
entirely.  Here's a patch (you already had a sufficient Build-Depends on
debhelper, and several of the necessary "Pre-Depends:
${misc:Pre-Depends}" were already present):

  * Use maintscript support in dh_installdeb rather than writing out
    dpkg-maintscript-helper commands by hand.  We now simply Pre-Depend on a
    new enough version of dpkg rather than using 'dpkg-maintscript-helper
    supports' guards, leading to more predictable behaviour on upgrades.

diff -Nru dspam-3.10.1+dfsg/debian/control dspam-3.10.1+dfsg/debian/control
--- dspam-3.10.1+dfsg/debian/control	2011-08-21 20:54:29.000000000 +0100
+++ dspam-3.10.1+dfsg/debian/control	2012-02-13 10:39:38.000000000 +0000
@@ -35,6 +35,7 @@
 Package: dspam-webfrontend
 Priority: extra
 Architecture: all
+Pre-Depends: ${misc:Pre-Depends}
 Depends: ${misc:Depends}, ${perl:Depends}, dspam (>= ${source:Version}), ucf (>= 0.28), libgd-gd2-perl | libgd-gd2-noxpm-perl, libgd-graph3d-perl, libhtml-parser-perl
 Suggests: apache2, apache2-suexec (>= 2.2.9-3), libapache2-mod-perl2, libapache2-mod-auth-pam | libapache2-mod-auth-mysql | libapache2-mod-auth-pgsql | libapache2-mod-auth-openid | libapache2-mod-auth-kerb | libapache2-mod-auth-plain | libapache2-mod-auth-radius | libapache2-mod-auth-sys-group, ttf-dejavu-core | ttf-bitstream-vera | ttf-freefont
 Description: Webfrontend for DSPAM anti-spam filter
diff -Nru dspam-3.10.1+dfsg/debian/dspam-webfrontend.maintscript dspam-3.10.1+dfsg/debian/dspam-webfrontend.maintscript
--- dspam-3.10.1+dfsg/debian/dspam-webfrontend.maintscript	1970-01-01 01:00:00.000000000 +0100
+++ dspam-3.10.1+dfsg/debian/dspam-webfrontend.maintscript	2012-02-13 10:34:37.000000000 +0000
@@ -0,0 +1,2 @@
+rm_conffile /etc/dspam/dspam-apache.conf 3.9.1~rc1+git20110419.29261fb+dfsg-2
+rm_conffile /etc/dspam/dspam-apache2.conf 3.9.1~rc1+git20110419.29261fb+dfsg-2
diff -Nru dspam-3.10.1+dfsg/debian/dspam-webfrontend.postinst dspam-3.10.1+dfsg/debian/dspam-webfrontend.postinst
--- dspam-3.10.1+dfsg/debian/dspam-webfrontend.postinst	2011-08-21 20:54:29.000000000 +0100
+++ dspam-3.10.1+dfsg/debian/dspam-webfrontend.postinst	2012-02-13 10:34:46.000000000 +0000
@@ -33,12 +33,6 @@
     ;;
 esac
 
-# Remove old conffiles
-if dpkg-maintscript-helper supports rm_conffile >/dev/null 2>&1; then
-    dpkg-maintscript-helper rm_conffile /etc/dspam/dspam-apache.conf 3.9.1~rc1+git20110419.29261fb+dfsg-2 -- "$@"
-    dpkg-maintscript-helper rm_conffile /etc/dspam/dspam-apache2.conf 3.9.1~rc1+git20110419.29261fb+dfsg-2 -- "$@"
-fi
-
 #DEBHELPER#
 
 exit 0
diff -Nru dspam-3.10.1+dfsg/debian/dspam-webfrontend.postrm dspam-3.10.1+dfsg/debian/dspam-webfrontend.postrm
--- dspam-3.10.1+dfsg/debian/dspam-webfrontend.postrm	2011-08-21 20:54:29.000000000 +0100
+++ dspam-3.10.1+dfsg/debian/dspam-webfrontend.postrm	2012-02-13 10:34:49.000000000 +0000
@@ -37,12 +37,6 @@
 
 esac
 
-# Remove old conffiles
-if dpkg-maintscript-helper supports rm_conffile >/dev/null 2>&1; then
-    dpkg-maintscript-helper rm_conffile /etc/dspam/dspam-apache.conf 3.9.1~rc1+git20110419.29261fb+dfsg-2 -- "$@"
-    dpkg-maintscript-helper rm_conffile /etc/dspam/dspam-apache2.conf 3.9.1~rc1+git20110419.29261fb+dfsg-2 -- "$@"
-fi
-
 #DEBHELPER#
 
 exit 0
diff -Nru dspam-3.10.1+dfsg/debian/dspam-webfrontend.preinst dspam-3.10.1+dfsg/debian/dspam-webfrontend.preinst
--- dspam-3.10.1+dfsg/debian/dspam-webfrontend.preinst	2011-08-21 20:54:29.000000000 +0100
+++ dspam-3.10.1+dfsg/debian/dspam-webfrontend.preinst	2012-02-13 10:34:44.000000000 +0000
@@ -19,12 +19,6 @@
     ;;  
 esac
 
-# Remove old conffiles
-if dpkg-maintscript-helper supports rm_conffile >/dev/null 2>&1; then
-    dpkg-maintscript-helper rm_conffile /etc/dspam/dspam-apache.conf 3.9.1~rc1+git20110419.29261fb+dfsg-2 -- "$@"
-    dpkg-maintscript-helper rm_conffile /etc/dspam/dspam-apache2.conf 3.9.1~rc1+git20110419.29261fb+dfsg-2 -- "$@"
-fi
-
 #DEBHELPER#
 
 exit 0
diff -Nru dspam-3.10.1+dfsg/debian/libdspam7-drv-mysql.maintscript dspam-3.10.1+dfsg/debian/libdspam7-drv-mysql.maintscript
--- dspam-3.10.1+dfsg/debian/libdspam7-drv-mysql.maintscript	1970-01-01 01:00:00.000000000 +0100
+++ dspam-3.10.1+dfsg/debian/libdspam7-drv-mysql.maintscript	2012-02-13 10:35:48.000000000 +0000
@@ -0,0 +1 @@
+rm_conffile /etc/cron.daily/libdspam7-drv-mysql 3.9.1~rc1+git20110419.29261fb+dfsg-2
diff -Nru dspam-3.10.1+dfsg/debian/libdspam7-drv-mysql.postinst dspam-3.10.1+dfsg/debian/libdspam7-drv-mysql.postinst
--- dspam-3.10.1+dfsg/debian/libdspam7-drv-mysql.postinst	2011-08-21 20:54:29.000000000 +0100
+++ dspam-3.10.1+dfsg/debian/libdspam7-drv-mysql.postinst	2012-02-13 10:36:00.000000000 +0000
@@ -31,11 +31,6 @@
     ;;
 esac
 
-# Remove old conffile
-if dpkg-maintscript-helper supports rm_conffile >/dev/null 2>&1; then
-    dpkg-maintscript-helper rm_conffile /etc/cron.daily/libdspam7-drv-mysql 3.9.1~rc1+git20110419.29261fb+dfsg-2 -- "$@"
-fi
-
 #DEBHELPER#
 
 exit 0
diff -Nru dspam-3.10.1+dfsg/debian/libdspam7-drv-mysql.postrm dspam-3.10.1+dfsg/debian/libdspam7-drv-mysql.postrm
--- dspam-3.10.1+dfsg/debian/libdspam7-drv-mysql.postrm	2011-08-21 20:54:29.000000000 +0100
+++ dspam-3.10.1+dfsg/debian/libdspam7-drv-mysql.postrm	2012-02-13 10:36:03.000000000 +0000
@@ -35,11 +35,6 @@
     ;;
 esac
 
-# Remove olf conffile
-if dpkg-maintscript-helper supports rm_conffile >/dev/null 2>&1; then
-    dpkg-maintscript-helper rm_conffile /etc/cron.daily/libdspam7-drv-mysql 3.9.1~rc1+git20110419.29261fb+dfsg-2 -- "$@"
-fi
-
 #DEBHELPER#
 
 exit 0
diff -Nru dspam-3.10.1+dfsg/debian/libdspam7-drv-mysql.preinst dspam-3.10.1+dfsg/debian/libdspam7-drv-mysql.preinst
--- dspam-3.10.1+dfsg/debian/libdspam7-drv-mysql.preinst	2011-08-21 20:54:29.000000000 +0100
+++ dspam-3.10.1+dfsg/debian/libdspam7-drv-mysql.preinst	1970-01-01 01:00:00.000000000 +0100
@@ -1,24 +0,0 @@
-#!/bin/sh
-set -e
-
-case "$1" in
-    install|upgrade)
-    ;;
-
-    abort-upgrade)
-    ;;  
-
-    *)  
-        echo "preinst called with unknown argument \`$1'" >&2
-        exit 1
-    ;;  
-esac
-
-# Remove old conffile
-if dpkg-maintscript-helper supports rm_conffile >/dev/null 2>&1; then
-    dpkg-maintscript-helper rm_conffile /etc/cron.daily/libdspam7-drv-mysql 3.9.1~rc1+git20110419.29261fb+dfsg-2 -- "$@"
-fi
-
-#DEBHELPER#
-
-exit 0
diff -Nru dspam-3.10.1+dfsg/debian/libdspam7-drv-sqlite3.maintscript dspam-3.10.1+dfsg/debian/libdspam7-drv-sqlite3.maintscript
--- dspam-3.10.1+dfsg/debian/libdspam7-drv-sqlite3.maintscript	1970-01-01 01:00:00.000000000 +0100
+++ dspam-3.10.1+dfsg/debian/libdspam7-drv-sqlite3.maintscript	2012-02-13 10:37:53.000000000 +0000
@@ -0,0 +1 @@
+rm_conffile /etc/cron.daily/libdspam7-drv-sqlite3 3.9.1~rc1+git20110419.29261fb+dfsg-2
diff -Nru dspam-3.10.1+dfsg/debian/libdspam7-drv-sqlite3.postinst dspam-3.10.1+dfsg/debian/libdspam7-drv-sqlite3.postinst
--- dspam-3.10.1+dfsg/debian/libdspam7-drv-sqlite3.postinst	2011-08-21 20:54:29.000000000 +0100
+++ dspam-3.10.1+dfsg/debian/libdspam7-drv-sqlite3.postinst	2012-02-13 10:38:15.000000000 +0000
@@ -17,11 +17,6 @@
     ;;
 esac
 
-# Remove old conffile
-if dpkg-maintscript-helper supports rm_conffile >/dev/null 2>&1; then
-    dpkg-maintscript-helper rm_conffile /etc/cron.daily/libdspam7-drv-sqlite3 3.9.1~rc1+git20110419.29261fb+dfsg-2 -- "$@"
-fi
-
 #DEBHELPER#
 
 exit 0
diff -Nru dspam-3.10.1+dfsg/debian/libdspam7-drv-sqlite3.postrm dspam-3.10.1+dfsg/debian/libdspam7-drv-sqlite3.postrm
--- dspam-3.10.1+dfsg/debian/libdspam7-drv-sqlite3.postrm	2011-08-21 20:54:29.000000000 +0100
+++ dspam-3.10.1+dfsg/debian/libdspam7-drv-sqlite3.postrm	1970-01-01 01:00:00.000000000 +0100
@@ -1,21 +0,0 @@
-#!/bin/sh
-set -e
-
-case "$1" in
-    purge|remove|upgrade|abort-install|abort-upgrade|failed-upgrade|disappear)
-    ;;
-
-    *)
-        echo "postrm called with unknown argument \`$1'" >&2
-        exit 1
-    ;;
-esac
-
-# Remove old conffile
-if dpkg-maintscript-helper supports rm_conffile >/dev/null 2>&1; then
-    dpkg-maintscript-helper rm_conffile /etc/cron.daily/libdspam7-drv-sqlite3 3.9.1~rc1+git20110419.29261fb+dfsg-2 -- "$@"
-fi
-
-#DEBHELPER#
-
-exit 0
diff -Nru dspam-3.10.1+dfsg/debian/libdspam7-drv-sqlite3.preinst dspam-3.10.1+dfsg/debian/libdspam7-drv-sqlite3.preinst
--- dspam-3.10.1+dfsg/debian/libdspam7-drv-sqlite3.preinst	2011-08-21 20:54:29.000000000 +0100
+++ dspam-3.10.1+dfsg/debian/libdspam7-drv-sqlite3.preinst	1970-01-01 01:00:00.000000000 +0100
@@ -1,24 +0,0 @@
-#!/bin/sh
-set -e
-
-case "$1" in
-    install|upgrade)
-    ;;
-
-    abort-upgrade)
-    ;;  
-
-    *)  
-        echo "preinst called with unknown argument \`$1'" >&2
-        exit 1
-    ;;  
-esac
-
-# Remove old conffile
-if dpkg-maintscript-helper supports rm_conffile >/dev/null 2>&1; then
-    dpkg-maintscript-helper rm_conffile /etc/cron.daily/libdspam7-drv-sqlite3 3.9.1~rc1+git20110419.29261fb+dfsg-2 -- "$@"
-fi
-
-#DEBHELPER#
-
-exit 0

Thanks,

-- 
Colin Watson                                       [cjwatson at ubuntu.com]





More information about the Pkg-dspam-misc mailing list