From f0ae7b1580cd26bcf44dc5b780f1c2e081314479 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Thu, 12 Apr 2012 01:09:44 +0200 Subject: [PATCH] Also use buildd's "Architecture" header to detect architecture. --- bin/blhc | 9 +++++++++ t/logs/buildd-dpkg-dev | 1 + t/tests.t | 5 ++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/bin/blhc b/bin/blhc index e3b83d9..5e8e018 100755 --- a/bin/blhc +++ b/bin/blhc @@ -535,6 +535,15 @@ foreach my $file (@ARGV) { my $harden_pie = $option_pie; # defaults to 0 while (my $line = <$fh>) { + # Detect architecture automatically unless overridden. For buildd logs + # only, doesn't use the dpkg-buildpackage header. Necessary to ignore + # build logs which aren't built (wrong architecture, build error, + # etc.). + if (not $arch + and $line =~ /^Architecture: (.+)$/) { + $arch = $1; + } + # dpkg-buildflags only provides hardening flags since 1.16.1, don't # check for hardening flags in buildd mode if an older dpkg-dev is # used. Default flags (-g -O2) are still checked. diff --git a/t/logs/buildd-dpkg-dev b/t/logs/buildd-dpkg-dev index 4cc32a5..b90eb85 100644 --- a/t/logs/buildd-dpkg-dev +++ b/t/logs/buildd-dpkg-dev @@ -1,3 +1,4 @@ +Architecture: i386 Toolchain package versions: ... dpkg-dev_1.16.1.2 ... dpkg-buildpackage: source package test diff --git a/t/tests.t b/t/tests.t index 1f83fa0..cfe2f9d 100644 --- a/t/tests.t +++ b/t/tests.t @@ -19,7 +19,7 @@ use strict; use warnings; -use Test::More tests => 134; +use Test::More tests => 136; sub is_blhc { @@ -648,6 +648,9 @@ is_blhc ['arch-avr32', 'arch-i386', 'empty', 'arch-mipsel'], . "ignoring architecture 'mipsel'\n" ; +is_blhc 'buildd-dpkg-dev', '--ignore-arch i386', 0, + "ignoring architecture 'i386'\n"; + # debian -- 2.45.2