Package: libgphoto2-2
Version: 2.4.11-4
Severity: normal
Tags: patch
User: ubuntu-de...@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
libgphoto2-2.  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; Ubuntu's
last LTS release didn't have a sufficient version of dpkg for that which
is why I care.  However, the current implementation in Debian is in fact
buggy anyway due to the use of an undefined PACKAGE variable in the
preinst, so I'm filing this at Severity: normal.

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 preinst entirely.  Here's a
patch.  If you don't apply this for 2.4.11-5, then please adjust the
relevant lines in debian/libgphoto2-2.maintscript to match the last
version before the one where you apply it.

  * 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.
  * Bump a few of the dpkg-maintscript-helper versions because PACKAGE was
    left undefined in the old preinst code and thus some of the old
    conffiles would never have actually been removed.

diff -Nru libgphoto2-2.4.11/debian/libgphoto2-2.maintscript 
libgphoto2-2.4.11/debian/libgphoto2-2.maintscript
--- libgphoto2-2.4.11/debian/libgphoto2-2.maintscript   1970-01-01 
01:00:00.000000000 +0100
+++ libgphoto2-2.4.11/debian/libgphoto2-2.maintscript   2012-02-13 
16:43:16.000000000 +0000
@@ -0,0 +1,6 @@
+rm_conffile /etc/udev/libgphoto2.rules 2.4.11-4
+rm_conffile /etc/udev/rules.d/025_libgphoto2.rules 2.4.10.1-5
+rm_conffile /etc/hotplug/usb/libgphoto2.usermap 2.4.11-4
+rm_conffile /etc/udev/libgphoto2_generic_ptp_support.rules 2.4.10.1-5
+rm_conffile /etc/udev/rules.d/025_libgphoto2.rules 2.4.11-4
+rm_conffile /etc/udev/rules.d/020_libgphoto2_generic-ptp_support.rules 
2.4.10.1-5
diff -Nru libgphoto2-2.4.11/debian/libgphoto2-2.postinst 
libgphoto2-2.4.11/debian/libgphoto2-2.postinst
--- libgphoto2-2.4.11/debian/libgphoto2-2.postinst      2012-01-12 
08:37:57.000000000 +0000
+++ libgphoto2-2.4.11/debian/libgphoto2-2.postinst      2012-02-13 
16:43:32.000000000 +0000
@@ -11,18 +11,6 @@
        rm -f 
/usr/share/hal/fdi/information/10freedesktop/10-camera-$PACKAGE.fdi
        rm -f /usr/share/hal/fdi/information/20thirdparty/$PACKAGE.fdi
        rm -f 
/usr/share/hal/fdi/information/10freedesktop/10-camera-$PACKAGE-device.fdi
-
-       # properly remove old config files
-       for f in \
-               /etc/udev/$PACKAGE.rules \
-               /etc/udev/rules.d/025_libgphoto2.rules \
-               /etc/hotplug/usb/$PACKAGE.usermap \
-               /etc/udev/libgphoto2_generic_ptp_support.rules \
-               /etc/udev/rules.d/025_$PACKAGE.rules \
-               /etc/udev/rules.d/020_libgphoto2_generic-ptp_support.rules
-       do
-               dpkg-maintscript-helper rm_conffile $f 2.4.10.1-5 -- "$@"
-       done
        ;;
 
     abort-upgrade|abort-remove|abort-deconfigure)
diff -Nru libgphoto2-2.4.11/debian/libgphoto2-2.postrm 
libgphoto2-2.4.11/debian/libgphoto2-2.postrm
--- libgphoto2-2.4.11/debian/libgphoto2-2.postrm        2012-01-12 
08:37:57.000000000 +0000
+++ libgphoto2-2.4.11/debian/libgphoto2-2.postrm        2012-02-13 
16:43:47.000000000 +0000
@@ -11,21 +11,7 @@
        rm -f 
/usr/share/hal/fdi/information/10freedesktop/10-camera-$PACKAGE-device.fdi || 
true
        ;;
 
-       purge)
-               # properly remove old config files
-               for f in \
-                       /etc/udev/$PACKAGE.rules \
-                       /etc/udev/rules.d/025_libgphoto2.rules \
-                       /etc/hotplug/usb/$PACKAGE.usermap \
-                       /etc/udev/libgphoto2_generic_ptp_support.rules \
-                       /etc/udev/rules.d/025_$PACKAGE.rules \
-                       
/etc/udev/rules.d/020_libgphoto2_generic-ptp_support.rules
-               do
-                       dpkg-maintscript-helper rm_conffile $f 2.4.10.1-5 -- 
"$@"
-               done
-       ;;
-
-    disappear|upgrade|failed-upgrade|abort-install|abort-upgrade)
+    purge|disappear|upgrade|failed-upgrade|abort-install|abort-upgrade)
        ;;
 
     *)
diff -Nru libgphoto2-2.4.11/debian/libgphoto2-2.preinst 
libgphoto2-2.4.11/debian/libgphoto2-2.preinst
--- libgphoto2-2.4.11/debian/libgphoto2-2.preinst       2012-01-12 
08:37:57.000000000 +0000
+++ libgphoto2-2.4.11/debian/libgphoto2-2.preinst       1970-01-01 
01:00:00.000000000 +0100
@@ -1,32 +0,0 @@
-#!/bin/sh
-
-set -e
-
-case "$1" in
-       install|upgrade)
-               # properly remove old config files
-               for f in \
-                       /etc/udev/$PACKAGE.rules \
-                       /etc/udev/rules.d/025_libgphoto2.rules \
-                       /etc/hotplug/usb/$PACKAGE.usermap \
-                       /etc/udev/libgphoto2_generic_ptp_support.rules \
-                       /etc/udev/rules.d/025_$PACKAGE.rules \
-                       
/etc/udev/rules.d/020_libgphoto2_generic-ptp_support.rules
-               do
-                       dpkg-maintscript-helper rm_conffile $f 2.4.10.1-5 -- 
"$@"
-               done
-       ;;
-
-       abort-upgrade)
-       ;;
-
-       *)
-               echo "preinst called with unknown argument \`$1'" >&2
-               exit 1
-       ;;
-
-esac
-
-#DEBHELPER#
-
-exit 0

Thanks,

-- 
Colin Watson                                       [cjwat...@ubuntu.com]



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

Reply via email to