Bug#659885: system-tools-backends: use dh_installdeb maintscript support

Colin Watson cjwatson at ubuntu.com
Tue Feb 14 14:39:09 UTC 2012


Package: system-tools-backends
Version: 2.10.2-1
Severity: wishlist
Tags: patch
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu ubuntu-patch precise

Using 'dpkg-maintscript-helper supports mv_conffile' guards introduces
unreliability into upgrades; it means that the conffile is moved or not
depending on whether dpkg happens to be unpacked before
system-tools-backends.  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 your handwritten postinst entirely.  Here's a
patch:

  * 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 system-tools-backends-2.10.2/debian/control system-tools-backends-2.10.2/debian/control
--- system-tools-backends-2.10.2/debian/control	2011-10-22 16:17:05.000000000 +0100
+++ system-tools-backends-2.10.2/debian/control	2012-02-14 14:35:58.000000000 +0000
@@ -9,7 +9,7 @@
 Maintainer: Jose Carlos Garcia Sogo <jsogo at debian.org>
 Uploaders: Debian GNOME Maintainers <pkg-gnome-maintainers at lists.alioth.debian.org>, Emilio Pozuelo Monfort <pochu at debian.org>, Josselin Mouette <joss at debian.org>, Michael Biebl <biebl at debian.org>, Niv Sardi <xaiki at debian.org>
 Standards-Version: 3.9.2
-Build-Depends: debhelper (>= 8),
+Build-Depends: debhelper (>= 8.1.0~),
                cdbs,
                gnome-pkg-tools (>= 0.10),
                intltool (>= 0.40),
@@ -24,6 +24,7 @@
 
 Package: system-tools-backends
 Architecture: any
+Pre-Depends: ${misc:Pre-Depends}
 Depends: ${shlibs:Depends},
          ${misc:Depends},
          libnet-dbus-perl,
diff -Nru system-tools-backends-2.10.2/debian/control.in system-tools-backends-2.10.2/debian/control.in
--- system-tools-backends-2.10.2/debian/control.in	2011-10-22 16:12:39.000000000 +0100
+++ system-tools-backends-2.10.2/debian/control.in	2012-02-14 14:35:50.000000000 +0000
@@ -4,7 +4,7 @@
 Maintainer: Jose Carlos Garcia Sogo <jsogo at debian.org>
 Uploaders: @GNOME_TEAM@, Niv Sardi <xaiki at debian.org>
 Standards-Version: 3.9.2
-Build-Depends: debhelper (>= 8),
+Build-Depends: debhelper (>= 8.1.0~),
                cdbs,
                gnome-pkg-tools (>= 0.10),
                intltool (>= 0.40),
@@ -19,6 +19,7 @@
 
 Package: system-tools-backends
 Architecture: any
+Pre-Depends: ${misc:Pre-Depends}
 Depends: ${shlibs:Depends},
          ${misc:Depends},
          libnet-dbus-perl,
diff -Nru system-tools-backends-2.10.2/debian/system-tools-backends.maintscript system-tools-backends-2.10.2/debian/system-tools-backends.maintscript
--- system-tools-backends-2.10.2/debian/system-tools-backends.maintscript	1970-01-01 01:00:00.000000000 +0100
+++ system-tools-backends-2.10.2/debian/system-tools-backends.maintscript	2012-02-14 14:34:54.000000000 +0000
@@ -0,0 +1 @@
+mv_conffile /etc/dbus-1/system.d/system-tools-backends.conf /etc/dbus-1/system.d/org.freedesktop.SystemToolsBackends.conf 2.6.0-6.1
diff -Nru system-tools-backends-2.10.2/debian/system-tools-backends.postinst system-tools-backends-2.10.2/debian/system-tools-backends.postinst
--- system-tools-backends-2.10.2/debian/system-tools-backends.postinst	2011-10-22 16:03:13.000000000 +0100
+++ system-tools-backends-2.10.2/debian/system-tools-backends.postinst	1970-01-01 01:00:00.000000000 +0100
@@ -1,9 +0,0 @@
-#!/bin/sh
-set -e
-
-if dpkg-maintscript-helper supports mv_conffile; then
-  dpkg-maintscript-helper mv_conffile /etc/dbus-1/system.d/system-tools-backends.conf \
-    /etc/dbus-1/system.d/org.freedesktop.SystemToolsBackends.conf 2.6.0-6.1 -- "$@"
-fi
-
-#DEBHELPER#
diff -Nru system-tools-backends-2.10.2/debian/system-tools-backends.postrm system-tools-backends-2.10.2/debian/system-tools-backends.postrm
--- system-tools-backends-2.10.2/debian/system-tools-backends.postrm	2011-10-22 16:03:13.000000000 +0100
+++ system-tools-backends-2.10.2/debian/system-tools-backends.postrm	2012-02-14 14:35:09.000000000 +0000
@@ -2,11 +2,6 @@
 
 set -e
 
-if dpkg-maintscript-helper supports mv_conffile; then
-  dpkg-maintscript-helper mv_conffile /etc/dbus-1/system.d/system-tools-backends.conf \
-    /etc/dbus-1/system.d/org.freedesktop.SystemToolsBackends.conf 2.6.0-6.1 -- "$@"
-fi
-
 # Do not restart dbus on upgrades, only if we remove the package.
 if [ "$1" = "remove" ] ; then 
     if [ -x /etc/init.d/dbus ]; then
diff -Nru system-tools-backends-2.10.2/debian/system-tools-backends.preinst system-tools-backends-2.10.2/debian/system-tools-backends.preinst
--- system-tools-backends-2.10.2/debian/system-tools-backends.preinst	2011-10-22 16:03:13.000000000 +0100
+++ system-tools-backends-2.10.2/debian/system-tools-backends.preinst	2012-02-14 14:35:03.000000000 +0000
@@ -50,9 +50,4 @@
         ;;
 esac
 
-if dpkg-maintscript-helper supports mv_conffile; then
-  dpkg-maintscript-helper mv_conffile /etc/dbus-1/system.d/system-tools-backends.conf \
-    /etc/dbus-1/system.d/org.freedesktop.SystemToolsBackends.conf 2.6.0-6.1 -- "$@"
-fi
-
 #DEBHELPER#

Thanks,

-- 
Colin Watson                                       [cjwatson at ubuntu.com]






More information about the pkg-gnome-maintainers mailing list