[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#659867: libreoffice-common: use Pre-Depends rather than 'dpkg-maintscript-helper supports' guards



Package: libreoffice-common
Version: 1:3.4.5-2
Severity: wishlist
Tags: patch
User: ubuntu-devel@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
libreoffice-common.  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.)

Since you no longer support lenny backports according to the changelog,
it would be simpler to just use a Pre-Depends and drop the conditionals.
That would also guarantee doing the right thing on direct upgrades from
Ubuntu lucid to precise.  Here's a patch against git master:

diff --git a/control b/control
index a30c7b2..7f65915 100644
--- a/control
+++ b/control
@@ -103,6 +103,7 @@ Description: office productivity suite -- arch-dependent files
 
 Package: libreoffice-common
 Architecture: all
+Pre-Depends: dpkg (>= 1.15.7.2~)
 Depends: libreoffice-style-default | libreoffice-style, ${misc:Depends}, ure
 Suggests: libreoffice-style-hicontrast, libreoffice-style-tango, libreoffice-style-crystal, libreoffice-style-oxygen
 Recommends: xfonts-mathml, ${textcat-data-recommends}
diff --git a/control.in b/control.in
index 10a58f2..5a76314 100644
--- a/control.in
+++ b/control.in
@@ -203,6 +203,7 @@ Description: office productivity suite -- arch-dependent files
 
 Package: libreofficeVER-common
 Architecture: all
+Pre-Depends: dpkg (>= 1.15.7.2~)
 Depends: libreofficeVER-style-default | libreofficeVER-style,
  ${misc:Depends},
  ure
diff --git a/libreoffice-common.postinst.in b/libreoffice-common.postinst.in
index a7f181d..1f546c0 100644
--- a/libreoffice-common.postinst.in
+++ b/libreoffice-common.postinst.in
@@ -19,18 +19,14 @@ if [ "$1" = "triggered" ]; then
 fi
 
 if [ "$1" = "configure" ]; then
-	if dpkg-maintscript-helper supports rm_conffile; then
-		dpkg-maintscript-helper rm_conffile "/etc/bash_completion.d/ooffice.sh" 1:3.3.0~rc4-2 libreoffice-common -- "$@"
-	fi
+	dpkg-maintscript-helper rm_conffile "/etc/bash_completion.d/ooffice.sh" 1:3.3.0~rc4-2 libreoffice-common -- "$@"
  
-	if dpkg-maintscript-helper supports mv_conffile; then
-		dpkg-maintscript-helper mv_conffile \
-			"/etc/openoffice/psprint.conf" "/etc/libreoffice/psprint.conf" "" libreoffice-common -- "$@"
-		dpkg-maintscript-helper mv_conffile \
-			"/etc/openoffice/sofficerc" "/etc/libreoffice/sofficerc" "" libreoffice-common -- "$@"
-		dpkg-maintscript-helper mv_conffile \
-			"/etc/openoffice/soffice.sh" "/etc/libreoffice/soffice.sh" "" libreoffice-common -- "$@"
-	fi
+	dpkg-maintscript-helper mv_conffile \
+		"/etc/openoffice/psprint.conf" "/etc/libreoffice/psprint.conf" "" libreoffice-common -- "$@"
+	dpkg-maintscript-helper mv_conffile \
+		"/etc/openoffice/sofficerc" "/etc/libreoffice/sofficerc" "" libreoffice-common -- "$@"
+	dpkg-maintscript-helper mv_conffile \
+		"/etc/openoffice/soffice.sh" "/etc/libreoffice/soffice.sh" "" libreoffice-common -- "$@"
 
 	# try to remove, hopefully empty now
 	rmdir /etc/openoffice 2>/dev/null || true
diff --git a/libreoffice-common.postrm.in b/libreoffice-common.postrm.in
index c9bed36..65ba2f9 100644
--- a/libreoffice-common.postrm.in
+++ b/libreoffice-common.postrm.in
@@ -6,17 +6,14 @@ set -e
 
 case "$1" in
 	remove|abort-install|abort-upgrade)
-		if dpkg-maintscript-helper supports rm_conffile; then
-			dpkg-maintscript-helper rm_conffile "/etc/bash_completion.d/ooffice.sh" 1:3.3.0~rc4-2 libreoffice-common -- "$@"
-		fi
+		dpkg-maintscript-helper rm_conffile "/etc/bash_completion.d/ooffice.sh" 1:3.3.0~rc4-2 libreoffice-common -- "$@"
 
-		if dpkg-maintscript-helper supports mv_conffile; then
-			dpkg-maintscript-helper mv_conffile \
-				"/etc/openoffice/psprint.conf" "/etc/libreoffice/psprint.conf" "" libreoffice-common -- "$@"
-			dpkg-maintscript-helper mv_conffile \
-				"/etc/openoffice/sofficerc" "/etc/libreoffice/sofficerc" "" libreoffice-common -- "$@"
-			dpkg-maintscript-helper mv_conffile \
-				"/etc/openoffice/soffice.sh" "/etc/libreoffice/soffice.sh" "" libreoffice-common -- "$@"
+		dpkg-maintscript-helper mv_conffile \
+			"/etc/openoffice/psprint.conf" "/etc/libreoffice/psprint.conf" "" libreoffice-common -- "$@"
+		dpkg-maintscript-helper mv_conffile \
+			"/etc/openoffice/sofficerc" "/etc/libreoffice/sofficerc" "" libreoffice-common -- "$@"
+		dpkg-maintscript-helper mv_conffile \
+			"/etc/openoffice/soffice.sh" "/etc/libreoffice/soffice.sh" "" libreoffice-common -- "$@"
 		rm -rf /`echo @OOBRANDDIR@ | sed -e s,usr/,var/,g`/share/prereg/bundled
 		rmdir /`echo @OOBRANDDIR@ | sed -e s,usr/,var/,g`/share/prereg/ || true
 		rmdir /`echo @OOBRANDDIR@ | sed -e s,usr/,var/,g`/share/ || true
@@ -26,7 +23,6 @@ case "$1" in
 		rmdir /`echo @OOBASISDIR@ | sed -e s,usr/,var/,g` || true
 		# and try to remove /@OOBRANDDIR@ itself
 		rmdir /`echo @OOBRANDDIR@ | sed -e s,usr/,var/,g` || true
-	fi
 	;;
 esac
 
diff --git a/libreoffice-common.preinst.in b/libreoffice-common.preinst.in
index 5a46257..b95651b 100755
--- a/libreoffice-common.preinst.in
+++ b/libreoffice-common.preinst.in
@@ -17,9 +17,7 @@ case "$1" in install|upgrade)
 		fi
 	fi
 
-	if dpkg-maintscript-helper supports rm_conffile; then
-		dpkg-maintscript-helper rm_conffile "/etc/bash_completion.d/ooffice.sh" 1:3.3.0~rc4-2 libreoffice-common -- "$@"
-	fi
+	dpkg-maintscript-helper rm_conffile "/etc/bash_completion.d/ooffice.sh" 1:3.3.0~rc4-2 libreoffice-common -- "$@"
         if [ -n "$2" ] && dpkg --compare-versions "$2" lt "1:3.3.0-3"; then
 		if [ -d /share ]; then
 			rm -f /share/config/javasettingsunopkginstall.xml
@@ -68,14 +66,12 @@ case "$1" in install|upgrade)
 		fi
 	fi
 
-	if dpkg-maintscript-helper supports mv_conffile; then
-		dpkg-maintscript-helper mv_conffile \
-			"/etc/openoffice/psprint.conf" "/etc/libreoffice/psprint.conf" "" libreoffice-common -- "$@"
-		dpkg-maintscript-helper mv_conffile \
-			"/etc/openoffice/sofficerc" "/etc/libreoffice/sofficerc" "" libreoffice-common -- "$@"
-		dpkg-maintscript-helper mv_conffile \
-			"/etc/openoffice/soffice.sh" "/etc/libreoffice/soffice.sh" "" libreoffice-common -- "$@"
-	fi
+	dpkg-maintscript-helper mv_conffile \
+		"/etc/openoffice/psprint.conf" "/etc/libreoffice/psprint.conf" "" libreoffice-common -- "$@"
+	dpkg-maintscript-helper mv_conffile \
+		"/etc/openoffice/sofficerc" "/etc/libreoffice/sofficerc" "" libreoffice-common -- "$@"
+	dpkg-maintscript-helper mv_conffile \
+		"/etc/openoffice/soffice.sh" "/etc/libreoffice/soffice.sh" "" libreoffice-common -- "$@"
 	;;
 esac
 

Thanks,

-- 
Colin Watson                                       [cjwatson@ubuntu.com]



Reply to: