Bug#556637: dpkg: support for getting architecture from DEB_HOST_ARCH

2011-03-24 Thread Raphael Hertzog
tag 556637 - patch
thanks

On Tue, 17 Nov 2009, Jussi Hakala wrote:
 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.

I would rather not let the user mess up with the architecture...

With multi-arch dpkg can accept non-native architectures with a new
option (--foreign-architecture=foo). It seems to me that it should solve
this problem.

Can you verify it?

You can find a multi-archified dpkg here:
git clone git://git.debian.org/~hertzog/dpkg.git -b pu/multiarch/full

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Follow my Debian News ▶ http://RaphaelHertzog.com (English)
  ▶ http://RaphaelHertzog.fr (Français)



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#556637: dpkg: support for getting architecture from DEB_HOST_ARCH

2009-11-17 Thread Jussi Hakala

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.0 +0200
+++ dpkg-1.15.4.1+maemo2.1/src/main.c	2009-11-16 14:39:59.0 +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.0 +0200
+++ dpkg-1.15.4.1+maemo2.1/src/main.h	2009-11-16 14:39:15.0 +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;