Explorar o código

dpkg-maintscript-helper: improve behaviour in “Multi-Arch: same” packages

Improve dpkg-maintscript-helper to automatically add the architecture
qualifier when it auto-detects the package name in the environment.

Document the requirement to add the architecture qualifier for such
packages in the manual page.
Raphaël Hertzog %!s(int64=13) %!d(string=hai) anos
pai
achega
0e4b6fb5b8
Modificáronse 3 ficheiros con 15 adicións e 10 borrados
  1. 3 0
      debian/changelog
  2. 8 6
      man/dpkg-maintscript-helper.1
  3. 4 4
      scripts/dpkg-maintscript-helper.sh

+ 3 - 0
debian/changelog

@@ -138,6 +138,9 @@ dpkg (1.17.0) UNRELEASED; urgency=low
   * Fix dpkg-maintscript-helper rm_conffile and mv_conffile to do nothing
     when the conffile is no longer owned by the current (or named) package.
     Thanks to Steve Langasek for the patch. Closes: #716948
+  * Improve dpkg-maintscript-helper behaviour in “Multi-Arch: same” packages
+    by arch-qualifying package names read from the environment. Also add
+    a warning about this potential problem in the manual page.
 
   [ Updated programs translations ]
   * Fix typo in Spanish translation of update-alternatives.

+ 8 - 6
man/dpkg-maintscript-helper.1

@@ -88,9 +88,10 @@ modifying the maintainer scripts to clean up the obsolete file,
 now preparing, not the first version of the package that lacked the
 conffile.
 .P
-\fIpackage\fP is the package name. If empty or omitted, the
-\fBDPKG_MAINTSCRIPT_PACKAGE\fP environment variable (as set by \fBdpkg\fP)
-will be used.
+\fIpackage\fP is the package name. When the package is "Multi-Arch: same",
+this parameter must include the architecture qualifier. If empty or
+omitted, the \fBDPKG_MAINTSCRIPT_PACKAGE\fP environment variable (as set
+by \fBdpkg\fP) will be used.
 .P
 All the parameters of the maintainer scripts have to be forwarded to the
 program after \fB\-\-\fP.
@@ -128,9 +129,10 @@ should trigger the rename of the conffile (see the notes for
 is empty or omitted, then the operation is tried on every upgrade (note: it's
 safer to give the version and have the operation tried only once).
 .P
-\fIpackage\fP is the package name. If empty or omitted, the
-\fBDPKG_MAINTSCRIPT_PACKAGE\fP environment variable (as set by \fBdpkg\fP)
-will be used.
+\fIpackage\fP is the package name. When the package is "Multi-Arch: same",
+this parameter must include the architecture qualifier. If empty or
+omitted, the \fBDPKG_MAINTSCRIPT_PACKAGE\fP environment variable (as set
+by \fBdpkg\fP) will be used.
 .P
 All the parameters of the maintainer scripts have to be forwarded to the
 program after \fB\-\-\fP.

+ 4 - 4
scripts/dpkg-maintscript-helper.sh

@@ -32,10 +32,10 @@ rm_conffile() {
 	local PACKAGE="$3"
 	if [ "$LASTVERSION" = "--" ]; then
 		LASTVERSION=""
-		PACKAGE="$DPKG_MAINTSCRIPT_PACKAGE"
+		PACKAGE="$DPKG_MAINTSCRIPT_PACKAGE${DPKG_MAINTSCRIPT_ARCH:+:$DPKG_MAINTSCRIPT_ARCH}"
 	fi
 	if [ "$PACKAGE" = "--" -o -z "$PACKAGE" ]; then
-		PACKAGE="$DPKG_MAINTSCRIPT_PACKAGE"
+		PACKAGE="$DPKG_MAINTSCRIPT_PACKAGE${DPKG_MAINTSCRIPT_ARCH:+:$DPKG_MAINTSCRIPT_ARCH}"
 	fi
 	# Skip remaining parameters up to --
 	while [ "$1" != "--" -a $# -gt 0 ]; do shift; done
@@ -139,10 +139,10 @@ mv_conffile() {
 	local PACKAGE="$4"
 	if [ "$LASTVERSION" = "--" ]; then
 		LASTVERSION=""
-		PACKAGE="$DPKG_MAINTSCRIPT_PACKAGE"
+		PACKAGE="$DPKG_MAINTSCRIPT_PACKAGE${DPKG_MAINTSCRIPT_ARCH:+:$DPKG_MAINTSCRIPT_ARCH}"
 	fi
 	if [ "$PACKAGE" = "--" -o -z "$PACKAGE" ]; then
-		PACKAGE="$DPKG_MAINTSCRIPT_PACKAGE"
+		PACKAGE="$DPKG_MAINTSCRIPT_PACKAGE${DPKG_MAINTSCRIPT_ARCH:+:$DPKG_MAINTSCRIPT_ARCH}"
 	fi
 	# Skip remaining parameters up to --
 	while [ "$1" != "--" -a $# -gt 0 ]; do shift; done