Explorar o código

Add new variables, DEB_HOST_MULTIARCH and DEB_BUILD_MULTIARCH

Add new variables that return the "ideal" GNU triplet for each architecture
which should be used as the path component for library installation.

Signed-off-by: Guillem Jover <guillem@debian.org>
Steve Langasek %!s(int64=15) %!d(string=hai) anos
pai
achega
af3153d09a
Modificáronse 4 ficheiros con 41 adicións e 3 borrados
  1. 6 0
      debian/changelog
  2. 6 0
      man/dpkg-architecture.1
  3. 21 1
      scripts/Dpkg/Arch.pm
  4. 8 2
      scripts/dpkg-architecture.pl

+ 6 - 0
debian/changelog

@@ -93,6 +93,12 @@ dpkg (1.16.0) UNRELEASED; urgency=low
   * Clarify that an up-to-date dpkg only needs to be unpacked for
     dpkg-maintscript-helper to work.
 
+  [ Steve Langasek ]
+  * Add new variables to dpkg-architecture, 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.
+
   [ Updated programs translations ]
   * German (Sven Joachim).
   * Portuguese (Miguel Figueiredo).

+ 6 - 0
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_HOST_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

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

+ 8 - 2
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);
 }