The following commit has been merged in the master branch:
commit 06b7239212a27ea8f38599b6743d88d40b9cdd0e
Author: Guillem Jover <[email protected]>
Date:   Sat Aug 22 02:11:14 2009 +0200

    Set DPKG_MAINTSCRIPT_ARCH env var with the .deb architecture
    
    This allows maintainer scripts to know which architecture the package
    got built for.

diff --git a/debian/changelog b/debian/changelog
index 82bcec0..e24b5cc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -33,6 +33,8 @@ dpkg (1.15.4) UNRELEASED; urgency=low
   * Stop macthing sparc64-*-* GNU triplets with sparc Debian architecture.
   * Add support for config.d style directories in dpkg and dselect,
     (/etc/dpkg/dpkg.cfg.d and /etc/dpkg/dselect.cfg.d respectively).
+  * Define DPKG_MAINTSCRIPT_ARCH on the maintainer script environment to the
+    architecture the package got built for.
 
   [ Raphael Hertzog ]
   * Replace install-info by a wrapper around GNU's install-info. The wrapper
diff --git a/lib/dpkg/dpkg.h b/lib/dpkg/dpkg.h
index 1399fc6..a53a6a4 100644
--- a/lib/dpkg/dpkg.h
+++ b/lib/dpkg/dpkg.h
@@ -88,6 +88,7 @@ DPKG_BEGIN_DECLS
 #define MAXUPDATES         250
 
 #define MAINTSCRIPTPKGENVVAR "DPKG_MAINTSCRIPT_PACKAGE"
+#define MAINTSCRIPTARCHENVVAR "DPKG_MAINTSCRIPT_ARCH"
 #define MAINTSCRIPTDPKGENVVAR "DPKG_RUNNING_VERSION"
 
 #define NOJOBCTRLSTOPENV    "DPKG_NO_TSTP"
diff --git a/man/dpkg.1 b/man/dpkg.1
index 7c47593..fa24be1 100644
--- a/man/dpkg.1
+++ b/man/dpkg.1
@@ -609,6 +609,10 @@ The program \fBdpkg\fP will execute when starting a new 
shell.
 .B COLUMNS
 Sets the number of columns \fBdpkg\fP should use when displaying formatted
 text. Currently only used by \-l.
+.TP
+.B DPKG_MAINTSCRIPT_ARCH
+Defined by \fBdpkg\fP on the maintainer script environment to the
+architecture the package got built for.
 .
 .SH EXAMPLES
 To list packages related to the editor \fBvi\fP(1):
diff --git a/src/help.c b/src/help.c
index c824175..3184b40 100644
--- a/src/help.c
+++ b/src/help.c
@@ -267,6 +267,7 @@ do_script(struct pkginfo *pkg, struct pkginfoperfile *pif,
     scriptexec= preexecscript(scriptpath,(char * const *)narglist);
     narglist[0]= scriptexec;
     if (setenv(MAINTSCRIPTPKGENVVAR, pkg->name, 1) ||
+        setenv(MAINTSCRIPTARCHENVVAR, pif->architecture, 1) ||
         setenv(MAINTSCRIPTDPKGENVVAR, PACKAGE_VERSION, 1))
       ohshite(_("unable to setenv for maintainer script"));
     execv(scriptexec,(char * const *)narglist);

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to