[Pkg-xfce-devel] Bug#659887: xfce4-panel: use dh_installdeb maintscript support

Colin Watson cjwatson at ubuntu.com
Tue Feb 14 15:02:28 UTC 2012


Package: xfce4-panel
Version: 4.8.6-2
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 xfce4-panel.
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 (quite possibly the postinst can go as well since ldconfig is
now handled by triggers, but that's a separate issue).  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 xfce4-panel-4.8.6/debian/xfce4-panel.maintscript xfce4-panel-4.8.6/debian/xfce4-panel.maintscript
--- xfce4-panel-4.8.6/debian/xfce4-panel.maintscript	1970-01-01 01:00:00.000000000 +0100
+++ xfce4-panel-4.8.6/debian/xfce4-panel.maintscript	2012-02-14 14:55:57.000000000 +0000
@@ -0,0 +1,7 @@
+rm_conffile /etc/xdg/xfce4/panel/clock-14.rc 4.7.0
+rm_conffile /etc/xdg/xfce4/panel/launcher-10.rc 4.7.0
+rm_conffile /etc/xdg/xfce4/panel/launcher-7.rc 4.7.0
+rm_conffile /etc/xdg/xfce4/panel/launcher-9.rc 4.7.0
+rm_conffile /etc/xdg/xfce4/panel/panels.xml 4.7.0
+rm_conffile /etc/xdg/xfce4/panel/systray-4.rc 4.7.0
+rm_conffile /etc/xdg/xfce4/panel/xfce4-menu-5.rc 4.7.0
diff -Nru xfce4-panel-4.8.6/debian/xfce4-panel.postinst xfce4-panel-4.8.6/debian/xfce4-panel.postinst
--- xfce4-panel-4.8.6/debian/xfce4-panel.postinst	2011-03-31 09:57:51.000000000 +0100
+++ xfce4-panel-4.8.6/debian/xfce4-panel.postinst	2012-02-14 14:56:13.000000000 +0000
@@ -2,25 +2,6 @@
 
 set -e
 
-LASTVER="4.7.0" 
-
-if dpkg-maintscript-helper supports rm_conffile; then
-  dpkg-maintscript-helper rm_conffile \
-    /etc/xdg/xfce4/panel/clock-14.rc "$LASTVER" -- "$@"
-  dpkg-maintscript-helper rm_conffile \
-    /etc/xdg/xfce4/panel/launcher-10.rc "$LASTVER" -- "$@"
-  dpkg-maintscript-helper rm_conffile \
-    /etc/xdg/xfce4/panel/launcher-7.rc "$LASTVER" -- "$@"
-  dpkg-maintscript-helper rm_conffile \
-    /etc/xdg/xfce4/panel/launcher-9.rc "$LASTVER" -- "$@"
-  dpkg-maintscript-helper rm_conffile \
-    /etc/xdg/xfce4/panel/panels.xml "$LASTVER" -- "$@"
-  dpkg-maintscript-helper rm_conffile \
-    /etc/xdg/xfce4/panel/systray-4.rc "$LASTVER" -- "$@"
-  dpkg-maintscript-helper rm_conffile \
-    /etc/xdg/xfce4/panel/xfce4-menu-5.rc "$LASTVER" -- "$@"
-fi
-
 if [ "$1" = "configure" ]; then
 	# Run ldconfig to update shared library system
 	ldconfig
diff -Nru xfce4-panel-4.8.6/debian/xfce4-panel.postrm xfce4-panel-4.8.6/debian/xfce4-panel.postrm
--- xfce4-panel-4.8.6/debian/xfce4-panel.postrm	2011-03-30 18:19:09.000000000 +0100
+++ xfce4-panel-4.8.6/debian/xfce4-panel.postrm	1970-01-01 01:00:00.000000000 +0100
@@ -1,24 +0,0 @@
-#!/bin/sh
-
-set -e
-
-LASTVER="4.7.0" 
-
-if dpkg-maintscript-helper supports rm_conffile; then
-  dpkg-maintscript-helper rm_conffile \
-    /etc/xdg/xfce4/panel/clock-14.rc "$LASTVER" -- "$@"
-  dpkg-maintscript-helper rm_conffile \
-    /etc/xdg/xfce4/panel/launcher-10.rc "$LASTVER" -- "$@"
-  dpkg-maintscript-helper rm_conffile \
-    /etc/xdg/xfce4/panel/launcher-7.rc "$LASTVER" -- "$@"
-  dpkg-maintscript-helper rm_conffile \
-    /etc/xdg/xfce4/panel/launcher-9.rc "$LASTVER" -- "$@"
-  dpkg-maintscript-helper rm_conffile \
-    /etc/xdg/xfce4/panel/panels.xml "$LASTVER" -- "$@"
-  dpkg-maintscript-helper rm_conffile \
-    /etc/xdg/xfce4/panel/systray-4.rc "$LASTVER" -- "$@"
-  dpkg-maintscript-helper rm_conffile \
-    /etc/xdg/xfce4/panel/xfce4-menu-5.rc "$LASTVER" -- "$@"
-fi
-
-#DEBHELPER#
diff -Nru xfce4-panel-4.8.6/debian/xfce4-panel.preinst xfce4-panel-4.8.6/debian/xfce4-panel.preinst
--- xfce4-panel-4.8.6/debian/xfce4-panel.preinst	2011-03-31 09:57:51.000000000 +0100
+++ xfce4-panel-4.8.6/debian/xfce4-panel.preinst	1970-01-01 01:00:00.000000000 +0100
@@ -1,24 +0,0 @@
-#!/bin/sh
-
-set -e
-
-LASTVER="4.7.0" 
-
-if dpkg-maintscript-helper supports rm_conffile; then
-  dpkg-maintscript-helper rm_conffile \
-    /etc/xdg/xfce4/panel/clock-14.rc "$LASTVER" -- "$@"
-  dpkg-maintscript-helper rm_conffile \
-    /etc/xdg/xfce4/panel/launcher-10.rc "$LASTVER" -- "$@"
-  dpkg-maintscript-helper rm_conffile \
-    /etc/xdg/xfce4/panel/launcher-7.rc "$LASTVER" -- "$@"
-  dpkg-maintscript-helper rm_conffile \
-    /etc/xdg/xfce4/panel/launcher-9.rc "$LASTVER" -- "$@"
-  dpkg-maintscript-helper rm_conffile \
-    /etc/xdg/xfce4/panel/panels.xml "$LASTVER" -- "$@"
-  dpkg-maintscript-helper rm_conffile \
-    /etc/xdg/xfce4/panel/systray-4.rc "$LASTVER" -- "$@"
-  dpkg-maintscript-helper rm_conffile \
-    /etc/xdg/xfce4/panel/xfce4-menu-5.rc "$LASTVER" -- "$@"
-fi
-
-#DEBHELPER#

Thanks,

-- 
Colin Watson                                       [cjwatson at ubuntu.com]





More information about the Pkg-xfce-devel mailing list