The following commit has been merged in the master branch:
commit dc98261980767f258046f8a4c2e020fcdc92c8b6
Author: Guillem Jover <[email protected]>
Date: Tue Oct 12 21:16:33 2010 +0200
dpkg-divert: Use DPKG_MAINTSCRIPT_PACKAGE environment variable
Use it as package name on when no --package or --local options have
been specified.
diff --git a/debian/changelog b/debian/changelog
index 5b4c7ac..791ce33 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,8 @@ dpkg (1.16.0) UNRELEASED; urgency=low
[ Guillem Jover ]
* Fix realloc usage on compat scandir() implementation.
+ * Use DPKG_MAINTSCRIPT_PACKAGE environment variable as package name on
+ dpkg-divert when no --package or --local options have been specified.
[ Raphaƫl Hertzog ]
* Fail properly when debian/source/format is empty. Closes: #600854
diff --git a/man/dpkg-divert.8 b/man/dpkg-divert.8
index 4f7d2cb..58324df 100644
--- a/man/dpkg-divert.8
+++ b/man/dpkg-divert.8
@@ -1,4 +1,4 @@
-.TH dpkg\-divert 8 "2008-08-18" "Debian Project" "dpkg utilities"
+.TH dpkg\-divert 8 "2010-10-12" "Debian Project" "dpkg utilities"
.SH NAME
dpkg\-divert \- override a package's version of a file
.
@@ -109,6 +109,12 @@ To remove that diversion:
.HP
dpkg-divert \-\-package wibble \-\-rename \-\-remove /usr/bin/example
.
+.SH ENVIRONMENT
+.TP
+.B DPKG_MAINTSCRIPT_PACKAGE
+If set and the \fI\-\-local\fP and \fI\-\-package\fP options have not been
+specified, \fBdpkg\-divert\fP will use it as the package name.
+.
.SH FILES
.TP
.I /var/lib/dpkg/diversions
diff --git a/src/divertcmd.c b/src/divertcmd.c
index 25dc122..aeeb5e8 100644
--- a/src/divertcmd.c
+++ b/src/divertcmd.c
@@ -705,6 +705,7 @@ int
main(int argc, const char * const *argv)
{
jmp_buf ejbuf;
+ const char *env_pkgname;
int (*actionfunction)(const char *const *argv);
int ret;
@@ -715,6 +716,10 @@ main(int argc, const char * const *argv)
standard_startup(&ejbuf);
myopt(&argv, cmdinfos);
+ env_pkgname = getenv(MAINTSCRIPTPKGENVVAR);
+ if (!opt_pkgname && env_pkgname)
+ setpackage(NULL, env_pkgname);
+
if (!cipaction)
setaction(&cmdinfo_add, NULL);
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]