From 77d8bf6fd0a0d4c971a0f1ad636d27d6699d8e53 Mon Sep 17 00:00:00 2001
From: Guillem Jover <guillem@debian.org>
Date: Fri, 24 Jul 2015 06:23:51 +0200
Subject: [PATCH] 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.

Signed-off-by: Guillem Jover <guillem@debian.org>
---
 Debian/Debhelper/Dh_Lib.pm | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/Debian/Debhelper/Dh_Lib.pm b/Debian/Debhelper/Dh_Lib.pm
index 387f90a..756820b 100644
--- a/Debian/Debhelper/Dh_Lib.pm
+++ b/Debian/Debhelper/Dh_Lib.pm
@@ -9,6 +9,7 @@ use strict;
 use warnings;
 
 use Exporter;
+use Dpkg::Arch qw(debarch_is);
 use vars qw(@ISA @EXPORT %dh);
 @ISA=qw(Exporter);
 @EXPORT=qw(&init &doit &doit_noerror &complex_doit &verbose_print &error
@@ -800,17 +801,10 @@ 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};
 			}
-			elsif (system("dpkg-architecture", "-a$arch", "-i$a") == 0) {
+			elsif (debarch_is($arch, $a) == 0) {
 				return $knownsame{$arch}{$a}=1;
 			}
 			else {
-- 
2.5.0.rc2.392.g76e840b

