[debhelper-devel] [debhelper] 01/01: Dh_Lib: Use Dpkg::Arch::debarch_is insted of calling dpkg-architecture
Niels Thykier
nthykier at moszumanska.debian.org
Sun Jul 26 09:48:10 UTC 2015
This is an automated email from the git hooks/post-receive script.
nthykier pushed a commit to branch master
in repository debhelper.
commit 6a0a402856765372a5d16376b38879e13feea287
Author: Guillem Jover <guillem at debian.org>
Date: Fri Jul 24 06:23:51 2015 +0200
Dh_Lib: Use Dpkg::Arch::debarch_is insted of calling dpkg-architecture
This should give a speed boost, as we avoid having to execute the
script, load and parse the architecture tables, and possibly
initialize the expensive architecture variables (if they are not
already present on the environment) on each check.
[nthykier: Lazy load Dpkg::Arch and fix inverted boolean check]
Signed-off-by: Guillem Jover <guillem at debian.org>
Signed-off-by: Niels Thykier <niels at thykier.net>
---
Debian/Debhelper/Dh_Lib.pm | 14 +++++---------
debian/changelog | 4 ++++
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/Debian/Debhelper/Dh_Lib.pm b/Debian/Debhelper/Dh_Lib.pm
index 3585791..348144e 100644
--- a/Debian/Debhelper/Dh_Lib.pm
+++ b/Debian/Debhelper/Dh_Lib.pm
@@ -799,17 +799,13 @@ sub buildos {
my @archlist=split(/\s+/,shift);
foreach my $a (@archlist) {
- # Avoid expensive dpkg-architecture call to compare
- # with a simple architecture name. "linux-any" and
- # other architecture wildcards are (currently)
- # always hypenated.
- if ($a !~ /-/) {
- return 1 if $arch eq $a;
- }
- elsif (exists $knownsame{$arch}{$a}) {
+ if (exists $knownsame{$arch}{$a}) {
return 1 if $knownsame{$arch}{$a};
+ next;
}
- elsif (system("dpkg-architecture", "-a$arch", "-i$a") == 0) {
+
+ require Dpkg::Arch;
+ if (Dpkg::Arch::debarch_is($arch, $a)) {
return $knownsame{$arch}{$a}=1;
}
else {
diff --git a/debian/changelog b/debian/changelog
index 9cf8f1c..76bfb0f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -16,6 +16,10 @@ debhelper (9.20150629) UNRELEASED; urgency=medium
if present. (Closes: #793440)
* Dh_Buildsystems.pm/Dh_Lib.pm: Import Exporter's import
subroutine rather than adding Exporter to @ISA.
+ * Dh_Lib.pm: Use Dpkg::Arch's debarch_is rather than running
+ dpkg-architecture to determine if an architecture matches
+ a wildcard. Heavily based on a patch from Guillem Jover.
+ (Closes: #793443)
-- Niels Thykier <niels at thykier.net> Sun, 28 Jun 2015 15:08:19 +0200
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debhelper/debhelper.git
More information about the debhelper-devel
mailing list