Переглянути джерело

Set DPKG_MAINTSCRIPT_ARCH env var with the .deb architecture

This allows maintainer scripts to know which architecture the package
got built for.
Guillem Jover 17 роки тому
батько
коміт
06b7239212
4 змінених файлів з 8 додано та 0 видалено
  1. 2 0
      debian/changelog
  2. 1 0
      lib/dpkg/dpkg.h
  3. 4 0
      man/dpkg.1
  4. 1 0
      src/help.c

+ 2 - 0
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

+ 1 - 0
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"

+ 4 - 0
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):

+ 1 - 0
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);