]> err.no Git - dpkg/commitdiff
Dpkg::Arch: Make get_host_arch and get_build_arch read from the environment
authorGuillem Jover <guillem@debian.org>
Fri, 23 Nov 2007 02:42:25 +0000 (04:42 +0200)
committerGuillem Jover <guillem@debian.org>
Fri, 23 Nov 2007 04:53:27 +0000 (06:53 +0200)
All scripts calling get_host_arch are expected to support getting the
value overriden by the environment when cross building. Except for
dpkg-architecture, which needs more fine grained control, and calls
directly the get_raw_ functions.

ChangeLog
debian/changelog
scripts/Dpkg/Arch.pm
scripts/dpkg-architecture.pl

index 7c950e1a9b6fe725aeefc472e4103a069fb13f05..18c52e3b11f0a7567ce44256ea73fa00d20173e4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2007-11-23  Guillem Jover  <guillem@debian.org>
+
+       * scripts/Dpkg/Arch.pm (get_build_arch): Rename to ...
+       (get_raw_build_arch): ... this.
+       (get_build_arch): New function.
+       (get_host_arch): Rename to ...
+       (get_raw_host_arch): ... this. Use get_raw_build_arch instead of
+       get_build_arch.
+       (get_host_arch): New function.
+       (@EXPORT_OK): Add get_raw_build_arch and get_raw_host_arch.
+       * scripts/dpkg-architecture.pl: Import get_raw_build_arch and
+       get_raw_host_arch instead of get_build_arch and get_host_arch.
+       Fix all callers.
+
 2007-11-23  Guillem Jover  <guillem@debian.org>
 
        * scripts/dpkg-architecture.pl (%env): Rename to ...
index 5b3a911e973300175616cfd06551322a74826f5a..25584a065426b5de2ce668a974cef687a248a2d2 100644 (file)
@@ -17,6 +17,8 @@ dpkg (1.14.10) UNRELEASED; urgency=low
 
   [ Guillem Jover ]
   * Add support for Package-Type in dpkg-name.
+  * Restore cross compilation support by honouring the environment host and
+    arch variables to override the default values on the dpkg-dev scripts.
 
   [ Updated man pages translations ]
   * Swedish (Peter Karlsson)
index 080ee59182d45bc8b19a5eda130e797f52337bf2..3cf0a9424556a455ea3a39c94ad81a094fc5ed08 100644 (file)
@@ -5,7 +5,8 @@ use warnings;
 
 use Exporter;
 our @ISA = qw(Exporter);
-our @EXPORT_OK = qw(get_build_arch get_host_arch get_gcc_host_gnu_type
+our @EXPORT_OK = qw(get_raw_build_arch get_raw_host_arch
+                    get_build_arch get_host_arch get_gcc_host_gnu_type
                     get_valid_arches debarch_eq debarch_is
                     debarch_to_gnutriplet gnutriplet_to_debarch
                     debtriplet_to_gnutriplet gnutriplet_to_debtriplet
@@ -27,7 +28,7 @@ my %debarch_to_debtriplet;
     my $host_arch;
     my $gcc_host_gnu_type;
 
-    sub get_build_arch()
+    sub get_raw_build_arch()
     {
        return $build_arch if defined $build_arch;
 
@@ -39,6 +40,11 @@ my %debarch_to_debtriplet;
        return $build_arch;
     }
 
+    sub get_build_arch()
+    {
+       return $ENV{DEB_BUILD_ARCH} || get_raw_build_arch();
+    }
+
     sub get_gcc_host_gnu_type()
     {
        return $gcc_host_gnu_type if defined $gcc_host_gnu_type;
@@ -53,7 +59,7 @@ my %debarch_to_debtriplet;
        return $gcc_host_gnu_type;
     }
 
-    sub get_host_arch()
+    sub get_raw_host_arch()
     {
        return $host_arch if defined $host_arch;
 
@@ -77,11 +83,16 @@ my %debarch_to_debtriplet;
 
        if (!defined($host_arch)) {
            # Switch to native compilation.
-           $host_arch = get_build_arch();
+           $host_arch = get_raw_build_arch();
        }
 
        return $host_arch;
     }
+
+    sub get_host_arch()
+    {
+       return $ENV{DEB_HOST_ARCH} || get_raw_host_arch();
+    }
 }
 
 sub get_valid_arches()
index 4cd6cba565d90f6370cf2baf163e2b9b98022b72..90e96c40059956efac890dd944f8a6dbde6e8264 100755 (executable)
@@ -25,7 +25,7 @@ use warnings;
 use Dpkg;
 use Dpkg::Gettext;
 use Dpkg::ErrorHandling qw(warning syserr usageerr);
-use Dpkg::Arch qw(get_build_arch get_host_arch get_gcc_host_gnu_type
+use Dpkg::Arch qw(get_raw_build_arch get_raw_host_arch get_gcc_host_gnu_type
                   get_valid_arches debarch_eq debarch_is debarch_to_debtriplet
                   debarch_to_gnutriplet gnutriplet_to_debarch);
 
@@ -130,10 +130,10 @@ my @ordered = qw(DEB_BUILD_ARCH DEB_BUILD_ARCH_OS DEB_BUILD_ARCH_CPU
                  DEB_HOST_ARCH DEB_HOST_ARCH_OS DEB_HOST_ARCH_CPU
                  DEB_HOST_GNU_CPU DEB_HOST_GNU_SYSTEM DEB_HOST_GNU_TYPE);
 
-$v{DEB_BUILD_ARCH} = get_build_arch();
+$v{DEB_BUILD_ARCH} = get_raw_build_arch();
 $v{DEB_BUILD_GNU_TYPE} = debarch_to_gnutriplet($v{DEB_BUILD_ARCH});
 
-$v{DEB_HOST_ARCH} = get_host_arch();
+$v{DEB_HOST_ARCH} = get_raw_host_arch();
 $v{DEB_HOST_GNU_TYPE} = debarch_to_gnutriplet($v{DEB_HOST_ARCH});
 
 # Set user values: