[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[PATCH] Add new variables, DEB_HOST_MULTIARCH and DEB_BUILD_MULTIARCH



Ok, here's an updated version of the patch:
 - drops the bidirectionality assumption (lets us handle both i486 and i686
   in a single implementation)
 - drops the table in favor of a simple in-lined implementation.

For my part I don't yet see a consensus around a single triplet that armhf
will be able to use as both GNU triplet and multiarch triplet, so I think
there's still a possibility that armhf will need to be added here as well;
but we can certainly cross that bridge when we come to it, as armhf support
hasn't yet landed in dpkg at all.

Can this patch be queued for dpkg 1.16.0?  It would be good to have this
land in the archive ASAP, so that we can start patching the other libraries
(dpkg multi-arch: same support is not a prerequisite for that).


Add new variables that return the "ideal" GNU triplet for each architecture
which should be used as the path component for library installation.
---
 debian/changelog             |    5 +++++
 man/dpkg-architecture.1      |    6 ++++++
 scripts/Dpkg/Arch.pm         |   22 +++++++++++++++++++++-
 scripts/dpkg-architecture.pl |   10 ++++++++--
 4 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 9f23d32..5cbb06f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -103,6 +103,11 @@ dpkg (1.16.0) UNRELEASED; urgency=low
   [ Updated dselect translations ]
   * Spanish (Javier Fernandez-Sanguino).
 
+  [ Steve Langasek ]
+  * add new variables, DEB_HOST_MULTIARCH and DEB_BUILD_MULTIARCH, that
+    return the "ideal" GNU triplet for each architecture which should be
+    used as the path component for library installation.
+
  -- Guillem Jover <guillem@debian.org>  Thu, 29 Jul 2010 11:00:22 +0200
 
 dpkg (1.15.8.10) unstable; urgency=low
diff --git a/man/dpkg-architecture.1 b/man/dpkg-architecture.1
index 4ca309e..3176d1b 100644
--- a/man/dpkg-architecture.1
+++ b/man/dpkg-architecture.1
@@ -115,6 +115,9 @@ The \s-1CPU\s0 part of \s-1DEB_BUILD_GNU_TYPE\s0.
 The System part of \s-1DEB_BUILD_GNU_TYPE\s0.
 .IP "\s-1DEB_BUILD_GNU_TYPE\s0" 4
 The \s-1GNU\s0 system type of the build machine.
+.IP "\s-1DEB_BUILD_MULTIARCH\s0" 4
+The clarified \s-1GNU\s0 system type of the build machine, used for filesystem
+paths.
 .IP "\s-1DEB_HOST_ARCH\s0" 4
 The Debian architecture of the host machine.
 .IP "\s-1DEB_HOST_ARCH_OS\s0" 4
@@ -131,6 +134,9 @@ The \s-1CPU\s0 part of \s-1DEB_HOST_GNU_TYPE\s0.
 The System part of \s-1DEB_HOST_GNU_TYPE\s0.
 .IP "\s-1DEB_HOST_GNU_TYPE\s0" 4
 The \s-1GNU\s0 system type of the host machine.
+.IP "\s-1DEB_BUILD_MULTIARCH\s0" 4
+The clarified \s-1GNU\s0 system type of the host machine, used for filesystem
+paths.
 .
 .SH "DEBIAN/RULES"
 The environment variables set by \fBdpkg\-architecture\fP are passed to
diff --git a/scripts/Dpkg/Arch.pm b/scripts/Dpkg/Arch.pm
index da72345..df02ace 100644
--- a/scripts/Dpkg/Arch.pm
+++ b/scripts/Dpkg/Arch.pm
@@ -25,7 +25,8 @@ our @EXPORT_OK = qw(get_raw_build_arch get_raw_host_arch
                     debarch_to_cpuattrs
                     debarch_to_gnutriplet gnutriplet_to_debarch
                     debtriplet_to_gnutriplet gnutriplet_to_debtriplet
-                    debtriplet_to_debarch debarch_to_debtriplet);
+                    debtriplet_to_debarch debarch_to_debtriplet
+                    gnutriplet_to_multiarch debarch_to_multiarch);
 
 use Dpkg;
 use Dpkg::Gettext;
@@ -237,6 +238,25 @@ sub gnutriplet_to_debtriplet($)
     return (split(/-/, $os, 2), $cpu);
 }
 
+sub gnutriplet_to_multiarch($)
+{
+    my ($gnu) = @_;
+    my ($cpu,$cdr) = split('-',$gnu,2);
+
+    if ($cpu =~ /^i[456]86$/) {
+	return "i386-$cdr";
+    } else {
+	return $gnu;
+    }
+}
+
+sub debarch_to_multiarch($)
+{
+    my ($arch) = @_;
+
+    return gnutriplet_to_multiarch(debarch_to_gnutriplet($arch));
+}
+
 sub debtriplet_to_debarch(@)
 {
     read_triplettable() if (!%debtriplet_to_debarch);
diff --git a/scripts/dpkg-architecture.pl b/scripts/dpkg-architecture.pl
index 40b680e..e030827 100755
--- a/scripts/dpkg-architecture.pl
+++ b/scripts/dpkg-architecture.pl
@@ -27,7 +27,8 @@ use Dpkg::ErrorHandling;
 use Dpkg::Arch qw(get_raw_build_arch get_raw_host_arch get_gcc_host_gnu_type
                   debarch_to_cpuattrs
                   get_valid_arches debarch_eq debarch_is debarch_to_debtriplet
-                  debarch_to_gnutriplet gnutriplet_to_debarch);
+                  debarch_to_gnutriplet gnutriplet_to_debarch
+                  debarch_to_multiarch);
 
 textdomain("dpkg-dev");
 
@@ -127,9 +128,11 @@ my %v;
 my @ordered = qw(DEB_BUILD_ARCH DEB_BUILD_ARCH_OS DEB_BUILD_ARCH_CPU
                  DEB_BUILD_ARCH_BITS DEB_BUILD_ARCH_ENDIAN
                  DEB_BUILD_GNU_CPU DEB_BUILD_GNU_SYSTEM DEB_BUILD_GNU_TYPE
+                 DEB_BUILD_MULTIARCH
                  DEB_HOST_ARCH DEB_HOST_ARCH_OS DEB_HOST_ARCH_CPU
                  DEB_HOST_ARCH_BITS DEB_HOST_ARCH_ENDIAN
-                 DEB_HOST_GNU_CPU DEB_HOST_GNU_SYSTEM DEB_HOST_GNU_TYPE);
+                 DEB_HOST_GNU_CPU DEB_HOST_GNU_SYSTEM DEB_HOST_GNU_TYPE
+                 DEB_HOST_MULTIARCH);
 
 $v{DEB_BUILD_ARCH} = get_raw_build_arch();
 $v{DEB_BUILD_GNU_TYPE} = debarch_to_gnutriplet($v{DEB_BUILD_ARCH});
@@ -190,6 +193,9 @@ my $abi;
 ($v{DEB_HOST_ARCH_BITS}, $v{DEB_HOST_ARCH_ENDIAN}) = debarch_to_cpuattrs($v{DEB_HOST_ARCH});
 ($v{DEB_BUILD_ARCH_BITS}, $v{DEB_BUILD_ARCH_ENDIAN}) = debarch_to_cpuattrs($v{DEB_BUILD_ARCH});
 
+$v{DEB_BUILD_MULTIARCH} = debarch_to_multiarch($v{DEB_BUILD_ARCH});
+$v{DEB_HOST_MULTIARCH} = debarch_to_multiarch($v{DEB_HOST_ARCH});
+
 for my $k (@ordered) {
     $v{$k} = $ENV{$k} if (defined ($ENV{$k}) && !$force);
 }
-- 
1.7.1


Reply to: