Package: dpkg
Version: 1.15.4.1

The dpkg determines the architecture in which it's in from a build time constant. This makes things difficult if we use host's dpkg to operate on packages non-native to host, for example, with scratchbox2.

It would be nice if dpkg would read DEB_HOST_ARCH for example to user a chance to override this if needed.

Patch included.

diff -Nur dpkg-1.15.4.1+maemo2+0m6/src/main.c dpkg-1.15.4.1+maemo2.1/src/main.c
--- dpkg-1.15.4.1+maemo2+0m6/src/main.c	2009-11-11 21:45:25.000000000 +0200
+++ dpkg-1.15.4.1+maemo2.1/src/main.c	2009-11-16 14:39:59.000000000 +0200
@@ -155,7 +155,8 @@
 }
 
 const char thisname[]= "dpkg";
-const char architecture[]= ARCHITECTURE;
+const char buildarchitecture[]= ARCHITECTURE;
+char *architecture = NULL;
 const char printforhelp[]= N_(
 "Type dpkg --help for help about installing and deinstalling packages [*];\n"
 "Use `dselect' or `aptitude' for user-friendly package management;\n"
@@ -694,6 +695,9 @@
   jmp_buf ejbuf;
   static void (*actionfunction)(const char *const *argv);
 
+  architecture = getenv("DEB_HOST_ARCH");
+  if (!architecture) architecture = buildarchitecture;
+
   setlocale(LC_ALL, "");
   bindtextdomain(PACKAGE, LOCALEDIR);
   textdomain(PACKAGE);
diff -Nur dpkg-1.15.4.1+maemo2+0m6/src/main.h dpkg-1.15.4.1+maemo2.1/src/main.h
--- dpkg-1.15.4.1+maemo2+0m6/src/main.h	2009-11-11 21:45:25.000000000 +0200
+++ dpkg-1.15.4.1+maemo2.1/src/main.h	2009-11-16 14:39:15.000000000 +0200
@@ -131,7 +131,8 @@
 extern const char *admindir;
 extern const char *instdir;
 extern struct pkginqueue *ignoredependss;
-extern const char architecture[];
+extern const char buildarchitecture[];
+extern char *architecture;
 
 struct invoke_hook {
 	struct invoke_hook *next;

Reply via email to