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

Bug#854493: pkgkde-symbolshelper: support new 64bit architectures such as tilegx, mips64r6, mips64r6el, riscv64, etc. generically



Package: pkg-kde-tools
Version: 0.15.24
Tags: patch
User: helmutg@debian.org
Usertags: rebootstrap

While bootstrapping tilegx, I noticed that the symbols helper keeps a
mapping from architecture names to sizes that needs updating for every
single new architecture. That's sad, because it is busywork added to the
bootstrap process. Rather than extending the patterns, let me propose
fixing part of the issue generically. A number of the patterns
essentially distinguish 32bit architectures from 64bit architectures.
Rather than keeping such a list here, we can reuse an existing list from
dpkg and thus eliminate the need for updating. That's what the attached
patch does. It might not be the best perl style, but that's about as
much perl as I know and it actually works.

There are two other noteworthy approaches to solving the problem.

1) Keep curating those patterns and add tilegx. (Sounds annoying to me.)
2) Completely remove the type/size information from the source and
   compute it at build time instead. A simple autoconf project is able
   to determine the sizes of relevant types (even during cross builds)
   and it could generate a data file that could be consulted by the
   helper. Choosing this approach would mean that, the symbols helper
   never needs an update again (except for adding more types) and it
   never is wrong.

Option 2 is beyond my perl knowledge, so I went for the simple part and
made the 32bit/64bit checks just work in the attached patch.

Any update that fixes the type code for tilegx' size_t should close this
bug report.

Helmut
diff --minimal -Nru pkg-kde-tools-0.15.24/debian/changelog pkg-kde-tools-0.15.24+nmu1/debian/changelog
--- pkg-kde-tools-0.15.24/debian/changelog	2016-10-19 20:33:01.000000000 +0200
+++ pkg-kde-tools-0.15.24+nmu1/debian/changelog	2017-02-07 11:15:41.000000000 +0100
@@ -1,3 +1,10 @@
+pkg-kde-tools (0.15.24+nmu1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Make bit-depenedent type substitutions work generically (Closes: #-1)
+
+ -- Helmut Grohne <helmut@subdivi.de>  Tue, 07 Feb 2017 11:15:41 +0100
+
 pkg-kde-tools (0.15.24) unstable; urgency=medium
 
   * pkgkde-symbolshelper: Do not pass stderr handle to Dpkg::IPC::spawn,
diff --minimal -Nru pkg-kde-tools-0.15.24/perllib/Debian/PkgKde/SymbolsHelper/Substs/TypeSubst.pm pkg-kde-tools-0.15.24+nmu1/perllib/Debian/PkgKde/SymbolsHelper/Substs/TypeSubst.pm
--- pkg-kde-tools-0.15.24/perllib/Debian/PkgKde/SymbolsHelper/Substs/TypeSubst.pm	2016-06-23 21:24:06.000000000 +0200
+++ pkg-kde-tools-0.15.24+nmu1/perllib/Debian/PkgKde/SymbolsHelper/Substs/TypeSubst.pm	2017-02-07 11:15:41.000000000 +0100
@@ -150,6 +150,7 @@
 use strict;
 use warnings;
 use base 'Debian::PkgKde::SymbolsHelper::Substs::TypeSubst';
+use Dpkg::Arch qw(debarch_to_cpuattrs);
 
 sub new {
     my $class = shift;
@@ -161,7 +162,8 @@
 
 sub _expand {
     my ($self, $arch) = @_;
-    return ($arch =~ /^(amd64|kfreebsd-amd64|ia64|alpha|s390|s390x|sparc64|ppc64|ppc64el|mips64|mips64el|arm64)$/) ? 'm' : 'j';
+    my ($bits, $endian) = debarch_to_cpuattrs($arch);
+    return $bits == 64 ? 'm' : 'j';
 }
 
 package Debian::PkgKde::SymbolsHelper::Substs::TypeSubst::ssize_t;
@@ -169,6 +171,7 @@
 use strict;
 use warnings;
 use base 'Debian::PkgKde::SymbolsHelper::Substs::TypeSubst';
+use Dpkg::Arch qw(debarch_to_cpuattrs);
 
 sub new {
     my $class = shift;
@@ -180,7 +183,8 @@
 
 sub _expand {
     my ($self, $arch) = @_;
-    return ($arch =~ /^(amd64|kfreebsd-amd64|ia64|alpha|s390|s390x|sparc64|ppc64|ppc64el|mips64|mips64el|arm64)$/) ? 'l' : 'i';
+    my ($bits, $endian) = debarch_to_cpuattrs($arch);
+    return $bits == 64 ? 'l' : 'i';
 }
 
 package Debian::PkgKde::SymbolsHelper::Substs::TypeSubst::int64_t;
@@ -188,6 +192,7 @@
 use strict;
 use warnings;
 use base 'Debian::PkgKde::SymbolsHelper::Substs::TypeSubst';
+use Dpkg::Arch qw(debarch_to_cpuattrs);
 
 sub new {
     my $class = shift;
@@ -199,7 +204,8 @@
 
 sub _expand {
     my ($self, $arch) = @_;
-    return ($arch =~ /^(amd64|kfreebsd-amd64|ia64|alpha|s390x|sparc64|ppc64|ppc64el|mips64|mips64el|arm64)$/) ? 'l' : 'x';
+    my ($bits, $endian) = debarch_to_cpuattrs($arch);
+    return $bits == 64 ? 'l' : 'x';
 }
 
 package Debian::PkgKde::SymbolsHelper::Substs::TypeSubst::uint64_t;
@@ -207,6 +213,7 @@
 use strict;
 use warnings;
 use base 'Debian::PkgKde::SymbolsHelper::Substs::TypeSubst';
+use Dpkg::Arch qw(debarch_to_cpuattrs);
 
 sub new {
     my $class = shift;
@@ -218,7 +225,8 @@
 
 sub _expand {
     my ($self, $arch) = @_;
-    return ($arch =~ /^(amd64|kfreebsd-amd64|ia64|alpha|s390x|sparc64|ppc64|ppc64el|mips64|mips64el|arm64)$/) ? 'm' : 'y';
+    my ($bits, $endian) = debarch_to_cpuattrs($arch);
+    return $bits == 64 ? 'm' : 'y';
 }
 
 package Debian::PkgKde::SymbolsHelper::Substs::TypeSubst::qptrdiff;
@@ -226,6 +234,7 @@
 use strict;
 use warnings;
 use base 'Debian::PkgKde::SymbolsHelper::Substs::TypeSubst';
+use Dpkg::Arch qw(debarch_to_cpuattrs);
 
 sub new {
     my $class = shift;
@@ -237,7 +246,8 @@
 
 sub _expand {
     my ($self, $arch) = @_;
-    return ($arch =~ /^(amd64|kfreebsd-amd64|ia64|alpha|s390x|sparc64|ppc64|ppc64el|mips64|mips64el|arm64)$/) ? 'x' : 'i';
+    my ($bits, $endian) = debarch_to_cpuattrs($arch);
+    return $bits == 64 ? 'x' : 'i';
 }
 
 package Debian::PkgKde::SymbolsHelper::Substs::TypeSubst::quintptr;
@@ -245,6 +255,7 @@
 use strict;
 use warnings;
 use base 'Debian::PkgKde::SymbolsHelper::Substs::TypeSubst';
+use Dpkg::Arch qw(debarch_to_cpuattrs);
 
 sub new {
     my $class = shift;
@@ -256,7 +267,8 @@
 
 sub _expand {
     my ($self, $arch) = @_;
-    return ($arch =~ /^(amd64|kfreebsd-amd64|ia64|alpha|s390x|sparc64|ppc64|ppc64el|mips64|mips64el|arm64)$/) ? 'y' : 'j';
+    my ($bits, $endian) = debarch_to_cpuattrs($arch);
+    return $bits == 64 ? 'y' : 'j';
 }
 
 package Debian::PkgKde::SymbolsHelper::Substs::TypeSubst::intptr_t;
@@ -264,6 +276,7 @@
 use strict;
 use warnings;
 use base 'Debian::PkgKde::SymbolsHelper::Substs::TypeSubst';
+use Dpkg::Arch qw(debarch_to_cpuattrs);
 
 sub new {
     my $class = shift;
@@ -275,7 +288,8 @@
 
 sub _expand {
     my ($self, $arch) = @_;
-    return ($arch =~ /^(amd64|kfreebsd-amd64|ia64|alpha|s390x|sparc64|ppc64|ppc64el|mips64|mips64el|arm64)$/) ? 'l' : 'i';
+    my ($bits, $endian) = debarch_to_cpuattrs($arch);
+    return $bits == 64 ? 'l' : 'i';
 }
 
 package Debian::PkgKde::SymbolsHelper::Substs::TypeSubst::qreal;

Reply to: