summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2015-06-14 15:27:23 +0200
committerGuillem Jover <guillem@debian.org>2016-10-31 04:05:43 +0100
commit9d7ba99cc3ff84fc553ed39da9d2e4f4008d35b6 (patch)
tree97ca6ffc51f6cf8393f0273d22c175bc0faf67f0
parent16847ec012a11435bec3872593ba3c7e5b9ff492 (diff)
downloaddpkg-9d7ba99cc3ff84fc553ed39da9d2e4f4008d35b6.tar.gz
arch: Internally represent architectures as quadruplets
This allows to detangle the libc used from the calling conventions.
-rw-r--r--Makefile.am3
-rw-r--r--data/abitable8
-rw-r--r--data/cputable4
-rw-r--r--data/ostable58
-rw-r--r--data/triplettable39
-rw-r--r--data/tupletable39
-rw-r--r--debian/changelog1
-rw-r--r--debian/control2
-rw-r--r--man/dpkg-architecture.man33
-rw-r--r--scripts/Dpkg/Arch.pm120
-rw-r--r--scripts/Dpkg/Path.pm4
-rw-r--r--scripts/Dpkg/Vendor/Debian.pm6
-rwxr-xr-xscripts/dpkg-architecture.pl9
-rw-r--r--scripts/t/Dpkg_Arch.t30
14 files changed, 191 insertions, 165 deletions
diff --git a/Makefile.am b/Makefile.am
index d474ddc79..5af7751b7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -23,7 +23,8 @@ dist_pkgdata_DATA = \
data/cputable \
data/ostable \
data/abitable \
- data/triplettable
+ data/tupletable \
+ $(nil)
EXTRA_DIST = \
.mailmap \
diff --git a/data/abitable b/data/abitable
index 134dfe836..18fa36700 100644
--- a/data/abitable
+++ b/data/abitable
@@ -1,13 +1,13 @@
-# Version=1.0
+# Version=2.0
#
# This file contains the table of arch ABI attribute overrides.
#
# If the ABI is not present here then the attribute information for a
-# Debian triplet matches the one on the cputable.
+# Debian arch tuple matches the one on the cputable.
#
# - Column 1 is the Debian name for the ABI.
# - Column 2 is the size (in bits) of the ABI pointers.
#
# <Debian name> <Bits>
-gnuabin32 32
-gnux32 32
+abin32 32
+x32 32
diff --git a/data/cputable b/data/cputable
index a066b0f2b..a2bd7d687 100644
--- a/data/cputable
+++ b/data/cputable
@@ -4,10 +4,10 @@
#
# Architecture names are formed as a combination of the system name
# (from ostable) and CPU name (from this table) after mapping from
-# the Debian triplet (from triplettable).
+# the Debian arch tuple (from tupletable).
#
# - Column 1 is the Debian name for the CPU, used to form the cpu part in
-# the Debian triplet.
+# the Debian arch tuple.
# - Column 2 is the GNU name for the CPU, used to output build, host and
# target variables in ‘dpkg-architecture’.
# - Column 3 is an extended regular expression used to match against the
diff --git a/data/ostable b/data/ostable
index 70cb663b8..09007da37 100644
--- a/data/ostable
+++ b/data/ostable
@@ -1,42 +1,42 @@
-# Version=1.0
+# Version=2.0
#
# This file contains the table of known operating system names.
#
# Architecture names are formed as a combination of the system name
# (from this table) and CPU name (from cputable) after mapping from
-# the Debian triplet (from triplettable).
+# the Debian arch tuple (from tupletable).
#
# - Column 1 is the Debian name for the system, used to form the system part
-# in the Debian triplet.
+# in the Debian arch tuple.
# - Column 2 is the GNU name for the system, used to output build, host and
# target variables in ‘dpkg-architecture’.
# - Column 3 is an extended regular expression used to match against the
# system part of the output of the GNU config.guess script.
#
# <Debian name> <GNU name> <config.guess regex>
-uclibceabi-linux linux-uclibceabi linux[^-]*-uclibceabi
-uclibc-linux linux-uclibc linux[^-]*-uclibc
-musleabihf-linux linux-musleabihf linux[^-]*-musleabihf
-musl-linux linux-musl linux[^-]*-musl
-gnueabihf-linux linux-gnueabihf linux[^-]*-gnueabihf
-gnueabi-linux linux-gnueabi linux[^-]*-gnueabi
-gnuabin32-linux linux-gnuabin32 linux[^-]*-gnuabin32
-gnuabi64-linux linux-gnuabi64 linux[^-]*-gnuabi64
-gnuspe-linux linux-gnuspe linux[^-]*-gnuspe
-gnux32-linux linux-gnux32 linux[^-]*-gnux32
-gnu-linux linux-gnu linux[^-]*(-gnu.*)?
-gnueabihf-kfreebsd kfreebsd-gnueabihf kfreebsd[^-]*-gnueabihf
-gnu-kfreebsd kfreebsd-gnu kfreebsd[^-]*(-gnu.*)?
-gnu-knetbsd knetbsd-gnu knetbsd[^-]*(-gnu.*)?
-gnu-kopensolaris kopensolaris-gnu kopensolaris[^-]*(-gnu.*)?
-gnu-hurd gnu gnu[^-]*
-bsd-darwin darwin darwin[^-]*
-bsd-dragonflybsd dragonflybsd dragonfly[^-]*
-bsd-freebsd freebsd freebsd[^-]*
-bsd-netbsd netbsd netbsd[^-]*
-bsd-openbsd openbsd openbsd[^-]*
-sysv-aix aix aix[^-]*
-sysv-solaris solaris solaris[^-]*
-uclibceabi-uclinux uclinux-uclibceabi uclinux[^-]*-uclibceabi
-uclibc-uclinux uclinux-uclibc uclinux[^-]*(-uclibc.*)?
-tos-mint mint mint[^-]*
+eabi-uclibc-linux linux-uclibceabi linux[^-]*-uclibceabi
+base-uclibc-linux linux-uclibc linux[^-]*-uclibc
+eabihf-musl-linux linux-musleabihf linux[^-]*-musleabihf
+base-musl-linux linux-musl linux[^-]*-musl
+eabihf-gnu-linux linux-gnueabihf linux[^-]*-gnueabihf
+eabi-gnu-linux linux-gnueabi linux[^-]*-gnueabi
+abin32-gnu-linux linux-gnuabin32 linux[^-]*-gnuabin32
+abi64-gnu-linux linux-gnuabi64 linux[^-]*-gnuabi64
+spe-gnu-linux linux-gnuspe linux[^-]*-gnuspe
+x32-gnu-linux linux-gnux32 linux[^-]*-gnux32
+base-gnu-linux linux-gnu linux[^-]*(-gnu.*)?
+eabihf-gnu-kfreebsd kfreebsd-gnueabihf kfreebsd[^-]*-gnueabihf
+base-gnu-kfreebsd kfreebsd-gnu kfreebsd[^-]*(-gnu.*)?
+base-gnu-knetbsd knetbsd-gnu knetbsd[^-]*(-gnu.*)?
+base-gnu-kopensolaris kopensolaris-gnu kopensolaris[^-]*(-gnu.*)?
+base-gnu-hurd gnu gnu[^-]*
+base-bsd-darwin darwin darwin[^-]*
+base-bsd-dragonflybsd dragonflybsd dragonfly[^-]*
+base-bsd-freebsd freebsd freebsd[^-]*
+base-bsd-netbsd netbsd netbsd[^-]*
+base-bsd-openbsd openbsd openbsd[^-]*
+base-sysv-aix aix aix[^-]*
+base-sysv-solaris solaris solaris[^-]*
+eabi-uclibc-uclinux uclinux-uclibceabi uclinux[^-]*-uclibceabi
+base-uclibc-uclinux uclinux-uclibc uclinux[^-]*(-uclibc.*)?
+base-tos-mint mint mint[^-]*
diff --git a/data/triplettable b/data/triplettable
deleted file mode 100644
index 3736ac0e2..000000000
--- a/data/triplettable
+++ /dev/null
@@ -1,39 +0,0 @@
-# Version=1.0
-#
-# Bidirectional mapping between a Debian triplet and a Debian arch.
-#
-# Supported variables: <cpu>
-#
-# <Debian triplet> <Debian arch>
-uclibceabi-linux-arm uclibc-linux-armel
-uclibc-linux-<cpu> uclibc-linux-<cpu>
-musleabihf-linux-arm musl-linux-armhf
-musl-linux-<cpu> musl-linux-<cpu>
-gnueabihf-linux-arm armhf
-gnueabi-linux-arm armel
-gnuabin32-linux-mips64r6el mipsn32r6el
-gnuabin32-linux-mips64r6 mipsn32r6
-gnuabin32-linux-mips64el mipsn32el
-gnuabin32-linux-mips64 mipsn32
-gnuabi64-linux-mips64r6el mips64r6el
-gnuabi64-linux-mips64r6 mips64r6
-gnuabi64-linux-mips64el mips64el
-gnuabi64-linux-mips64 mips64
-gnuspe-linux-powerpc powerpcspe
-gnux32-linux-amd64 x32
-gnu-linux-<cpu> <cpu>
-gnueabihf-kfreebsd-arm kfreebsd-armhf
-gnu-kfreebsd-<cpu> kfreebsd-<cpu>
-gnu-knetbsd-<cpu> knetbsd-<cpu>
-gnu-kopensolaris-<cpu> kopensolaris-<cpu>
-gnu-hurd-<cpu> hurd-<cpu>
-bsd-dragonflybsd-<cpu> dragonflybsd-<cpu>
-bsd-freebsd-<cpu> freebsd-<cpu>
-bsd-openbsd-<cpu> openbsd-<cpu>
-bsd-netbsd-<cpu> netbsd-<cpu>
-bsd-darwin-<cpu> darwin-<cpu>
-sysv-aix-<cpu> aix-<cpu>
-sysv-solaris-<cpu> solaris-<cpu>
-uclibceabi-uclinux-arm uclinux-armel
-uclibc-uclinux-<cpu> uclinux-<cpu>
-tos-mint-m68k mint-m68k
diff --git a/data/tupletable b/data/tupletable
new file mode 100644
index 000000000..2692f2d3a
--- /dev/null
+++ b/data/tupletable
@@ -0,0 +1,39 @@
+# Version=1.0
+#
+# Bidirectional mapping between a Debian arch tuple and a Debian arch name.
+#
+# Supported variables: <cpu>
+#
+# <Debian arch tuple> <Debian arch name>
+eabi-uclibc-linux-arm uclibc-linux-armel
+base-uclibc-linux-<cpu> uclibc-linux-<cpu>
+eabihf-musl-linux-arm musl-linux-armhf
+base-musl-linux-<cpu> musl-linux-<cpu>
+eabihf-gnu-linux-arm armhf
+eabi-gnu-linux-arm armel
+abin32-gnu-linux-mips64r6el mipsn32r6el
+abin32-gnu-linux-mips64r6 mipsn32r6
+abin32-gnu-linux-mips64el mipsn32el
+abin32-gnu-linux-mips64 mipsn32
+abi64-gnu-linux-mips64r6el mips64r6el
+abi64-gnu-linux-mips64r6 mips64r6
+abi64-gnu-linux-mips64el mips64el
+abi64-gnu-linux-mips64 mips64
+spe-gnu-linux-powerpc powerpcspe
+x32-gnu-linux-amd64 x32
+base-gnu-linux-<cpu> <cpu>
+eabihf-gnu-kfreebsd-arm kfreebsd-armhf
+base-gnu-kfreebsd-<cpu> kfreebsd-<cpu>
+base-gnu-knetbsd-<cpu> knetbsd-<cpu>
+base-gnu-kopensolaris-<cpu> kopensolaris-<cpu>
+base-gnu-hurd-<cpu> hurd-<cpu>
+base-bsd-dragonflybsd-<cpu> dragonflybsd-<cpu>
+base-bsd-freebsd-<cpu> freebsd-<cpu>
+base-bsd-openbsd-<cpu> openbsd-<cpu>
+base-bsd-netbsd-<cpu> netbsd-<cpu>
+base-bsd-darwin-<cpu> darwin-<cpu>
+base-sysv-aix-<cpu> aix-<cpu>
+base-sysv-solaris-<cpu> solaris-<cpu>
+eabi-uclibc-uclinux-arm uclinux-armel
+base-uclibc-uclinux-<cpu> uclinux-<cpu>
+base-tos-mint-m68k mint-m68k
diff --git a/debian/changelog b/debian/changelog
index 41e22a2a7..cf30d5bf3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -58,6 +58,7 @@ dpkg (1.18.11) UNRELEASED; urgency=medium
* Architecture support:
- Add support for AIX operating system.
- Add a version pseudo-field to the arch tables.
+ - Internally represent Debian architectures as quadruplets.
* Portability:
- Cast off_t variables to intmax_t when printing them with "%jd".
- Add missing <string.h> include in libdpkg.
diff --git a/debian/control b/debian/control
index f39b398fd..755a30a81 100644
--- a/debian/control
+++ b/debian/control
@@ -122,6 +122,8 @@ Multi-Arch: foreign
Depends:
${misc:Depends},
${perl:Depends},
+# Needed for arch tuples.
+ dpkg (>= 1.18.11),
Recommends:
# Used by Dpkg::File.
libfile-fcntllock-perl,
diff --git a/man/dpkg-architecture.man b/man/dpkg-architecture.man
index 0d3ced2f7..c3852f4b1 100644
--- a/man/dpkg-architecture.man
+++ b/man/dpkg-architecture.man
@@ -140,10 +140,27 @@ code for the target architecture.
.IP "Debian architecture" 4
The Debian architecture string, which specifies the binary tree in the
FTP archive. Examples: i386, sparc, hurd\-i386.
+.IP "Debian architecture tuple" 4
+A Debian architecture tuple is the fully qualified architecture with all its
+components spelled out.
+This differs with Debian architectures in that at least the \fIcpu\fP
+component does not embed the \fIabi\fP.
+The current tuple has the form \fIabi\fP\-\fIlibc\fP\-\fIos\fP\-\fIcpu\fP.
+Examples: base\-gnu\-linux\-amd64, eabihf\-musl\-linux\-arm.
.IP "Debian architecture wildcard" 4
-A Debian architecture wildcard is a special architecture string that will match
-any real architecture being part of it. The general form is <kernel>\-<cpu>.
-Examples: linux\-any, any\-i386, hurd\-any.
+A Debian architecture wildcard is a special architecture string that will
+match any real architecture being part of it.
+The general form is a Debian architecture tuple with four or less elements,
+and with at least one of them being \fBany\fP.
+Missing elements of the tuple are prefixed implicitly as \fBany\fP, and thus
+the following pairs are equivalent:
+.nf
+ \fBany\fP\-\fBany\fP\-\fBany\fP\-\fBany\fP = \fBany\fP
+ \fBany\fP\-\fBany\fP\-\fIos\fP\-\fBany\fP = \fIos\fP\-\fBany\fP
+ \fBany\fP\-\fIlibc\fP\-\fBany\fP\-\fBany\fP = \fIlibc\fP\-\fBany\fP\-\fBany\fP
+.fi
+Examples: linux\-any, any\-i386, hurd\-any, eabi\-any\-any\-arm,
+musl\-any\-any.
.IP "GNU system type" 4
An architecture specification string consisting of two parts separated by
a hyphen: cpu and system.
@@ -232,16 +249,16 @@ Format version 1.0 (since dpkg 1.13.2).
.TP
.I %PKGDATADIR%/ostable
Table of known operating system names and mapping to their GNU name.
-Format version 1.0 (since dpkg 1.13.2).
+Format version 2.0 (since dpkg 1.18.11).
.TP
-.I %PKGDATADIR%/triplettable
-Mapping between Debian architecture triplets and Debian architecture
+.I %PKGDATADIR%/tupletable
+Mapping between Debian architecture tuples and Debian architecture
names.
-Format version 1.0 (since dpkg 1.14.0).
+Format version 1.0 (since dpkg 1.18.11).
.TP
.I %PKGDATADIR%/abitable
Table of Debian architecture ABI attribute overrides.
-Format version 1.0 (since dpkg 1.16.3).
+Format version 2.0 (since dpkg 1.18.11).
.SS Packaging support
.TP
.I %PKGDATADIR%/architecture.mk
diff --git a/scripts/Dpkg/Arch.pm b/scripts/Dpkg/Arch.pm
index 972b21718..12c01abad 100644
--- a/scripts/Dpkg/Arch.pm
+++ b/scripts/Dpkg/Arch.pm
@@ -47,13 +47,13 @@ our @EXPORT_OK = qw(
debarch_is_concerned
debarch_to_cpuattrs
debarch_to_gnutriplet
- debarch_to_debtriplet
+ debarch_to_debtuple
debarch_to_multiarch
debarch_list_parse
- debtriplet_to_debarch
- debtriplet_to_gnutriplet
+ debtuple_to_debarch
+ debtuple_to_gnutriplet
gnutriplet_to_debarch
- gnutriplet_to_debtriplet
+ gnutriplet_to_debtuple
gnutriplet_to_multiarch
);
@@ -72,8 +72,8 @@ my (%cputable_re, %ostable_re);
my (%cpubits, %cpuendian);
my %abibits;
-my %debtriplet_to_debarch;
-my %debarch_to_debtriplet;
+my %debtuple_to_debarch;
+my %debarch_to_debtuple;
=head1 FUNCTIONS
@@ -163,11 +163,11 @@ sub get_raw_host_arch()
warning(g_('cannot determine CC system type, falling back to ' .
'default (native compilation)'));
} else {
- my (@host_archtriplet) = gnutriplet_to_debtriplet($host_gnu_type);
- $host_arch = debtriplet_to_debarch(@host_archtriplet);
+ my (@host_archtuple) = gnutriplet_to_debtuple($host_gnu_type);
+ $host_arch = debtuple_to_debarch(@host_archtuple);
if (defined $host_arch) {
- $host_gnu_type = debtriplet_to_gnutriplet(@host_archtriplet);
+ $host_gnu_type = debtuple_to_gnutriplet(@host_archtuple);
} else {
warning(g_('unknown CC system type %s, falling back to ' .
'default (native compilation)'), $host_gnu_type);
@@ -211,7 +211,7 @@ sub get_valid_arches()
foreach my $os (@os) {
foreach my $cpu (@cpu) {
- my $arch = debtriplet_to_debarch(split(/-/, $os, 2), $cpu);
+ my $arch = debtuple_to_debarch(split(/-/, $os, 3), $cpu);
push @arches, $arch if defined($arch);
}
}
@@ -272,47 +272,48 @@ sub _load_abitable()
});
}
-sub _load_triplettable()
+sub _load_tupletable()
{
_load_cputable();
- _load_table('triplettable', sub {
+ _load_table('tupletable', sub {
if (m/^(?!\#)(\S+)\s+(\S+)/) {
- my $debtriplet = $1;
+ my $debtuple = $1;
my $debarch = $2;
- if ($debtriplet =~ /<cpu>/) {
+ if ($debtuple =~ /<cpu>/) {
foreach my $_cpu (@cpu) {
- (my $dt = $debtriplet) =~ s/<cpu>/$_cpu/;
+ (my $dt = $debtuple) =~ s/<cpu>/$_cpu/;
(my $da = $debarch) =~ s/<cpu>/$_cpu/;
- next if exists $debarch_to_debtriplet{$da}
- or exists $debtriplet_to_debarch{$dt};
+ next if exists $debarch_to_debtuple{$da}
+ or exists $debtuple_to_debarch{$dt};
- $debarch_to_debtriplet{$da} = $dt;
- $debtriplet_to_debarch{$dt} = $da;
+ $debarch_to_debtuple{$da} = $dt;
+ $debtuple_to_debarch{$dt} = $da;
}
} else {
- $debarch_to_debtriplet{$2} = $1;
- $debtriplet_to_debarch{$1} = $2;
+ $debarch_to_debtuple{$2} = $1;
+ $debtuple_to_debarch{$1} = $2;
}
}
});
}
-sub debtriplet_to_gnutriplet(@)
+sub debtuple_to_gnutriplet(@)
{
- my ($abi, $os, $cpu) = @_;
+ my ($abi, $libc, $os, $cpu) = @_;
_load_cputable();
_load_ostable();
- return unless defined($abi) && defined($os) && defined($cpu) &&
- exists($cputable{$cpu}) && exists($ostable{"$abi-$os"});
- return join('-', $cputable{$cpu}, $ostable{"$abi-$os"});
+ return unless
+ defined $abi && defined $libc && defined $os && defined $cpu &&
+ exists $cputable{$cpu} && exists $ostable{"$abi-$libc-$os"};
+ return join('-', $cputable{$cpu}, $ostable{"$abi-$libc-$os"});
}
-sub gnutriplet_to_debtriplet($)
+sub gnutriplet_to_debtuple($)
{
my $gnu = shift;
return unless defined($gnu);
@@ -339,7 +340,7 @@ sub gnutriplet_to_debtriplet($)
}
return if !defined($cpu) || !defined($os);
- return (split(/-/, $os, 2), $cpu);
+ return (split(/-/, $os, 3), $cpu);
}
=item $multiarch = gnutriplet_to_multiarch($gnutriplet)
@@ -373,38 +374,38 @@ sub debarch_to_multiarch($)
return gnutriplet_to_multiarch(debarch_to_gnutriplet($arch));
}
-sub debtriplet_to_debarch(@)
+sub debtuple_to_debarch(@)
{
- my ($abi, $os, $cpu) = @_;
+ my ($abi, $libc, $os, $cpu) = @_;
- _load_triplettable();
+ _load_tupletable();
- if (!defined($abi) || !defined($os) || !defined($cpu)) {
+ if (!defined $abi || !defined $libc || !defined $os || !defined $cpu) {
return;
- } elsif (exists $debtriplet_to_debarch{"$abi-$os-$cpu"}) {
- return $debtriplet_to_debarch{"$abi-$os-$cpu"};
+ } elsif (exists $debtuple_to_debarch{"$abi-$libc-$os-$cpu"}) {
+ return $debtuple_to_debarch{"$abi-$libc-$os-$cpu"};
} else {
return;
}
}
-sub debarch_to_debtriplet($)
+sub debarch_to_debtuple($)
{
my $arch = shift;
return if not defined $arch;
- _load_triplettable();
+ _load_tupletable();
if ($arch =~ /^linux-([^-]*)/) {
# XXX: Might disappear in the future, not sure yet.
$arch = $1;
}
- my $triplet = $debarch_to_debtriplet{$arch};
+ my $tuple = $debarch_to_debtuple{$arch};
- if (defined($triplet)) {
- return split(/-/, $triplet, 3);
+ if (defined($tuple)) {
+ return split(/-/, $tuple, 4);
} else {
return;
}
@@ -420,7 +421,7 @@ sub debarch_to_gnutriplet($)
{
my $arch = shift;
- return debtriplet_to_gnutriplet(debarch_to_debtriplet($arch));
+ return debtuple_to_gnutriplet(debarch_to_debtuple($arch));
}
=item $arch = gnutriplet_to_debarch($gnutriplet)
@@ -433,31 +434,33 @@ sub gnutriplet_to_debarch($)
{
my $gnu = shift;
- return debtriplet_to_debarch(gnutriplet_to_debtriplet($gnu));
+ return debtuple_to_debarch(gnutriplet_to_debtuple($gnu));
}
-sub debwildcard_to_debtriplet($)
+sub debwildcard_to_debtuple($)
{
my $arch = shift;
my @tuple = split /-/, $arch, 3;
if (any { $_ eq 'any' } @tuple) {
- if (scalar @tuple == 3) {
+ if (scalar @tuple == 4) {
return @tuple;
- } elsif (scalar @tuple == 2) {
+ } elsif (scalar @tuple == 3) {
return ('any', @tuple);
+ } elsif (scalar @tuple == 2) {
+ return ('any', 'any', @tuple);
} else {
- return ('any', 'any', 'any');
+ return ('any', 'any', 'any', 'any');
}
} else {
- return debarch_to_debtriplet($arch);
+ return debarch_to_debtuple($arch);
}
}
sub debarch_to_cpuattrs($)
{
my $arch = shift;
- my ($abi, $os, $cpu) = debarch_to_debtriplet($arch);
+ my ($abi, $libc, $os, $cpu) = debarch_to_debtuple($arch);
if (defined($cpu)) {
_load_abitable();
@@ -481,12 +484,12 @@ sub debarch_eq($$)
return 1 if ($a eq $b);
- my @a = debarch_to_debtriplet($a);
- my @b = debarch_to_debtriplet($b);
+ my @a = debarch_to_debtuple($a);
+ my @b = debarch_to_debtuple($b);
- return 0 if scalar @a != 3 or scalar @b != 3;
+ return 0 if scalar @a != 4 or scalar @b != 4;
- return ($a[0] eq $b[0] && $a[1] eq $b[1] && $a[2] eq $b[2]);
+ return $a[0] eq $b[0] && $a[1] eq $b[1] && $a[2] eq $b[2] && $a[3] eq $b[3];
}
=item $bool = debarch_is($arch, $arch_wildcard)
@@ -502,14 +505,15 @@ sub debarch_is($$)
return 1 if ($alias eq $real or $alias eq 'any');
- my @real = debarch_to_debtriplet($real);
- my @alias = debwildcard_to_debtriplet($alias);
+ my @real = debarch_to_debtuple($real);
+ my @alias = debwildcard_to_debtuple($alias);
- return 0 if scalar @real != 3 or scalar @alias != 3;
+ return 0 if scalar @real != 4 or scalar @alias != 4;
if (($alias[0] eq $real[0] || $alias[0] eq 'any') &&
($alias[1] eq $real[1] || $alias[1] eq 'any') &&
- ($alias[2] eq $real[2] || $alias[2] eq 'any')) {
+ ($alias[2] eq $real[2] || $alias[2] eq 'any') &&
+ ($alias[3] eq $real[3] || $alias[3] eq 'any')) {
return 1;
}
@@ -528,10 +532,10 @@ sub debarch_is_wildcard($)
return 0 if $arch eq 'all';
- my @triplet = debwildcard_to_debtriplet($arch);
+ my @tuple = debwildcard_to_debtuple($arch);
- return 0 if scalar @triplet != 3;
- return 1 if any { $_ eq 'any' } @triplet;
+ return 0 if scalar @tuple != 4;
+ return 1 if any { $_ eq 'any' } @tuple;
return 0;
}
diff --git a/scripts/Dpkg/Path.pm b/scripts/Dpkg/Path.pm
index 6156f9863..f352cac35 100644
--- a/scripts/Dpkg/Path.pm
+++ b/scripts/Dpkg/Path.pm
@@ -36,7 +36,7 @@ use Exporter qw(import);
use File::Spec;
use Cwd qw(realpath);
-use Dpkg::Arch qw(get_host_arch debarch_to_debtriplet);
+use Dpkg::Arch qw(get_host_arch debarch_to_debtuple);
use Dpkg::IPC;
=encoding utf8
@@ -267,7 +267,7 @@ list if none of the files exists.
sub find_build_file($) {
my $base = shift;
my $host_arch = get_host_arch();
- my ($abi, $host_os, $cpu) = debarch_to_debtriplet($host_arch);
+ my ($abi, $libc, $host_os, $cpu) = debarch_to_debtuple($host_arch);
my @files;
foreach my $f ("$base.$host_arch", "$base.$host_os", "$base") {
push @files, $f if -f $f;
diff --git a/scripts/Dpkg/Vendor/Debian.pm b/scripts/Dpkg/Vendor/Debian.pm
index 4df26e1e3..560db2de8 100644
--- a/scripts/Dpkg/Vendor/Debian.pm
+++ b/scripts/Dpkg/Vendor/Debian.pm
@@ -29,7 +29,7 @@ use Dpkg::Gettext;
use Dpkg::ErrorHandling;
use Dpkg::Control::Types;
use Dpkg::BuildOptions;
-use Dpkg::Arch qw(get_host_arch debarch_to_debtriplet);
+use Dpkg::Arch qw(get_host_arch debarch_to_debtuple);
use parent qw(Dpkg::Vendor::Default);
@@ -269,9 +269,9 @@ sub _add_sanitize_flags {
sub _add_hardening_flags {
my ($self, $flags) = @_;
my $arch = get_host_arch();
- my ($abi, $os, $cpu) = debarch_to_debtriplet($arch);
+ my ($abi, $libc, $os, $cpu) = debarch_to_debtuple($arch);
- unless (defined $abi and defined $os and defined $cpu) {
+ unless (defined $abi and defined $libc and defined $os and defined $cpu) {
warning(g_("unknown host architecture '%s'"), $arch);
($abi, $os, $cpu) = ('', '', '');
}
diff --git a/scripts/dpkg-architecture.pl b/scripts/dpkg-architecture.pl
index 40c487eb1..fbde47237 100755
--- a/scripts/dpkg-architecture.pl
+++ b/scripts/dpkg-architecture.pl
@@ -28,7 +28,7 @@ use Dpkg::Getopt;
use Dpkg::ErrorHandling;
use Dpkg::Arch qw(get_raw_build_arch get_raw_host_arch get_host_gnu_type
debarch_to_cpuattrs
- get_valid_arches debarch_eq debarch_is debarch_to_debtriplet
+ get_valid_arches debarch_eq debarch_is debarch_to_debtuple
debarch_to_gnutriplet gnutriplet_to_debarch
debarch_to_multiarch);
@@ -233,6 +233,7 @@ while (@ARGV) {
my %v;
my $abi;
+my $libc;
#
# Set build variables
@@ -240,7 +241,7 @@ my $abi;
$v{DEB_BUILD_ARCH} = get_raw_build_arch()
if (action_needs(DEB_BUILD));
-($abi, $v{DEB_BUILD_ARCH_OS}, $v{DEB_BUILD_ARCH_CPU}) = debarch_to_debtriplet($v{DEB_BUILD_ARCH})
+($abi, $libc, $v{DEB_BUILD_ARCH_OS}, $v{DEB_BUILD_ARCH_CPU}) = debarch_to_debtuple($v{DEB_BUILD_ARCH})
if (action_needs(DEB_BUILD | DEB_ARCH_INFO));
($v{DEB_BUILD_ARCH_BITS}, $v{DEB_BUILD_ARCH_ENDIAN}) = debarch_to_cpuattrs($v{DEB_BUILD_ARCH})
if (action_needs(DEB_BUILD | DEB_ARCH_ATTR));
@@ -265,7 +266,7 @@ if (action_needs(DEB_BUILD | DEB_GNU_INFO)) {
$v{DEB_HOST_ARCH} = $req_host_arch || get_raw_host_arch()
if (action_needs(DEB_HOST));
-($abi, $v{DEB_HOST_ARCH_OS}, $v{DEB_HOST_ARCH_CPU}) = debarch_to_debtriplet($v{DEB_HOST_ARCH})
+($abi, $libc, $v{DEB_HOST_ARCH_OS}, $v{DEB_HOST_ARCH_CPU}) = debarch_to_debtuple($v{DEB_HOST_ARCH})
if (action_needs(DEB_HOST | DEB_ARCH_INFO));
($v{DEB_HOST_ARCH_BITS}, $v{DEB_HOST_ARCH_ENDIAN}) = debarch_to_cpuattrs($v{DEB_HOST_ARCH})
if (action_needs(DEB_HOST | DEB_ARCH_ATTR));
@@ -301,7 +302,7 @@ if (action_needs(DEB_HOST | DEB_GNU_INFO)) {
$v{DEB_TARGET_ARCH} = $req_target_arch || $req_host_arch || get_raw_host_arch()
if (action_needs(DEB_TARGET));
-($abi, $v{DEB_TARGET_ARCH_OS}, $v{DEB_TARGET_ARCH_CPU}) = debarch_to_debtriplet($v{DEB_TARGET_ARCH})
+($abi, $libc, $v{DEB_TARGET_ARCH_OS}, $v{DEB_TARGET_ARCH_CPU}) = debarch_to_debtuple($v{DEB_TARGET_ARCH})
if (action_needs(DEB_TARGET | DEB_ARCH_INFO));
($v{DEB_TARGET_ARCH_BITS}, $v{DEB_TARGET_ARCH_ENDIAN}) = debarch_to_cpuattrs($v{DEB_TARGET_ARCH})
if (action_needs(DEB_TARGET | DEB_ARCH_ATTR));
diff --git a/scripts/t/Dpkg_Arch.t b/scripts/t/Dpkg_Arch.t
index 8a2429633..321397a39 100644
--- a/scripts/t/Dpkg_Arch.t
+++ b/scripts/t/Dpkg_Arch.t
@@ -18,30 +18,30 @@ use warnings;
use Test::More tests => 64;
-use_ok('Dpkg::Arch', qw(debarch_to_debtriplet debarch_to_multiarch
+use_ok('Dpkg::Arch', qw(debarch_to_debtuple debarch_to_multiarch
debarch_eq debarch_is debarch_is_wildcard
debarch_is_illegal
debarch_to_cpuattrs
debarch_list_parse
- debtriplet_to_debarch gnutriplet_to_debarch
+ debtuple_to_debarch gnutriplet_to_debarch
get_host_gnu_type
get_valid_arches));
my @tuple_new;
my @tuple_ref;
-@tuple_new = debarch_to_debtriplet('unknown');
-is_deeply(\@tuple_new, [], 'unknown triplet');
+@tuple_new = debarch_to_debtuple('unknown');
+is_deeply(\@tuple_new, [], 'unknown tuple');
-@tuple_ref = qw(gnu linux amd64);
-@tuple_new = debarch_to_debtriplet('amd64');
-is_deeply(\@tuple_new, \@tuple_ref, 'valid triplet');
+@tuple_ref = qw(base gnu linux amd64);
+@tuple_new = debarch_to_debtuple('amd64');
+is_deeply(\@tuple_new, \@tuple_ref, 'valid tuple');
-@tuple_ref = qw(gnu linux amd64);
-@tuple_new = debarch_to_debtriplet('amd64');
-is_deeply(\@tuple_new, \@tuple_ref, 'valid triplet');
-@tuple_new = debarch_to_debtriplet('linux-amd64');
-is_deeply(\@tuple_new, \@tuple_ref, 'valid triplet');
+@tuple_ref = qw(base gnu linux amd64);
+@tuple_new = debarch_to_debtuple('amd64');
+is_deeply(\@tuple_new, \@tuple_ref, 'valid tuple');
+@tuple_new = debarch_to_debtuple('linux-amd64');
+is_deeply(\@tuple_new, \@tuple_ref, 'valid tuple');
is(debarch_to_multiarch('i386'), 'i386-linux-gnu',
'normalized i386 multiarch triplet');
@@ -112,9 +112,9 @@ ok($@, 'parse concatenated arches failed');
is(debarch_to_cpuattrs(undef), undef, 'undef cpu attrs');
is_deeply([ debarch_to_cpuattrs('amd64') ], [ qw(64 little) ], 'amd64 cpu attrs');
-is(debtriplet_to_debarch(undef, undef, undef), undef, 'undef debtriplet');
-is(debtriplet_to_debarch('gnu', 'linux', 'amd64'), 'amd64', 'known debtriplet');
-is(debtriplet_to_debarch('unknown', 'unknown', 'unknown'), undef, 'unknown debtriplet');
+is(debtuple_to_debarch(undef, undef, undef, undef), undef, 'undef debtuple');
+is(debtuple_to_debarch('base', 'gnu', 'linux', 'amd64'), 'amd64', 'known debtuple');
+is(debtuple_to_debarch('unknown', 'unknown', 'unknown', 'unknown'), undef, 'unknown debtuple');
is(gnutriplet_to_debarch(undef), undef, 'undef gnutriplet');
is(gnutriplet_to_debarch('unknown-unknown-unknown'), undef, 'unknown gnutriplet');