diff options
author | Guillem Jover <guillem@debian.org> | 2012-04-16 14:04:16 +0200 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2012-04-18 10:44:27 +0200 |
commit | ad0cb5d13dc92e52f0a877b9af9839d04721a209 (patch) | |
tree | 919092d884a42c78a15a252ee1e8e4d2f53a5e3e | |
parent | 01d00afaa426101553a226e60fdd7c64b98267ac (diff) | |
download | dpkg-ad0cb5d13dc92e52f0a877b9af9839d04721a209.tar.gz |
Dpkg::Arch: Add support for arch ABI attribute overrides
For architectures where the ABI changes some attributes, like MIPS n32
or AMD64 x32, the architecture bits do not match the ones from the cpu,
so we need to override them.
-rw-r--r-- | Makefile.am | 6 | ||||
-rw-r--r-- | abitable | 9 | ||||
-rw-r--r-- | debian/changelog | 1 | ||||
-rw-r--r-- | scripts/Dpkg/Arch.pm | 32 |
4 files changed, 46 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am index a916f1da8..78a4f5ed0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -18,7 +18,11 @@ SUBDIRS = \ ACLOCAL_AMFLAGS = -I m4 -dist_pkgdata_DATA = cputable ostable triplettable +dist_pkgdata_DATA = \ + cputable \ + ostable \ + abitable \ + triplettable EXTRA_DIST = \ .mailmap \ diff --git a/abitable b/abitable new file mode 100644 index 000000000..57198954a --- /dev/null +++ b/abitable @@ -0,0 +1,9 @@ +# 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. +# +# Column 1 is the Debian name for the ABI. +# Column 2 is the size (in bits) of the ABI integers/pointers. +# +# <Debian name> <Bits> diff --git a/debian/changelog b/debian/changelog index a2993128f..40ed2650d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -27,6 +27,7 @@ dpkg (1.16.3) UNRELEASED; urgency=low current locale (although this was only affecting the old deb format). * Ignore the minor format version number for deb-split format, unifying the behaviour with the deb format. + * Add support for an abitable containing arch attribute overrides. [ Helge Kreutzmann ] * Fix a typo in man/dpkg-buildflags.1. diff --git a/scripts/Dpkg/Arch.pm b/scripts/Dpkg/Arch.pm index 858e0fb9a..72fe2d9cf 100644 --- a/scripts/Dpkg/Arch.pm +++ b/scripts/Dpkg/Arch.pm @@ -28,6 +28,7 @@ our @EXPORT_OK = qw(get_raw_build_arch get_raw_host_arch debtriplet_to_debarch debarch_to_debtriplet gnutriplet_to_multiarch debarch_to_multiarch); +use POSIX qw(:errno_h); use Dpkg; use Dpkg::Gettext; use Dpkg::ErrorHandling; @@ -36,6 +37,7 @@ my (@cpu, @os); my (%cputable, %ostable); my (%cputable_re, %ostable_re); my (%cpubits, %cpuendian); +my %abibits; my %debtriplet_to_debarch; my %debarch_to_debtriplet; @@ -169,6 +171,32 @@ sub read_ostable close OSTABLE; } +my $abitable_loaded = 0; +sub abitable_load() +{ + return if ($abitable_loaded); + + local $_; + local $/ = "\n"; + + # Because the abitable is only for override information, do not fail if + # it does not exist, as that will only mean the other tables do not have + # an entry needing to be overridden. This way we do not require a newer + # dpkg by libdpkg-perl. + if (open ABITABLE, "$pkgdatadir/abitable") { + while (<ABITABLE>) { + if (m/^(?!\#)(\S+)\s+(\S+)/) { + $abibits{$1} = $2; + } + } + close ABITABLE; + } elsif ($! != ENOENT) { + syserr(_g("cannot open %s"), "abitable"); + } + + $abitable_loaded = 1; +} + sub read_triplettable() { read_cputable() if (!@cpu); @@ -336,7 +364,9 @@ sub debarch_to_cpuattrs($) my ($abi, $os, $cpu) = debarch_to_debtriplet($arch); if (defined($cpu)) { - return ($cpubits{$cpu}, $cpuendian{$cpu}); + abitable_load(); + + return ($abibits{$abi} || $cpubits{$cpu}, $cpuendian{$cpu}); } else { return undef; } |