From: Simon Ruderich Date: Sat, 29 Sep 2012 12:39:43 +0000 (+0200) Subject: Detect architecture in old buildd logs which add an "is". X-Git-Tag: 0.04~5 X-Git-Url: https://ruderich.org/simon/gitweb/?p=blhc%2Fblhc.git;a=commitdiff_plain;h=287e6f3e56eeed74465bada187f9f4b18c07eb91 Detect architecture in old buildd logs which add an "is". E.g. dpkg-buildpackage: host architecture is ia64 --- diff --git a/MANIFEST b/MANIFEST index 1b2b03d..ff09898 100644 --- a/MANIFEST +++ b/MANIFEST @@ -19,6 +19,7 @@ t/logs/bad-cppflags t/logs/bad-ldflags t/logs/bad-library t/logs/bad-multiline +t/logs/buildd-architecture-old t/logs/buildd-dpkg-dev t/logs/buildd-dpkg-dev-missing t/logs/buildd-dpkg-dev-old diff --git a/bin/blhc b/bin/blhc index bfdcfc5..f2f0d6f 100755 --- a/bin/blhc +++ b/bin/blhc @@ -771,6 +771,13 @@ foreach my $file (@ARGV) { if (not $arch and index($line, 'dpkg-buildpackage: host architecture ') == 0) { $arch = substr $line, 37, -1; # -1 to ignore '\n' at the end + + # Old buildd logs use e.g. "host architecture is alpha", remove + # the "is", otherwise debarch_to_debtriplet() will not detect the + # architecture. + if (index($arch, 'is ') == 0) { + $arch = substr $arch, 3; + } } # Ignore compiler warnings for now. diff --git a/t/logs/buildd-architecture-old b/t/logs/buildd-architecture-old new file mode 100644 index 0000000..da7565c --- /dev/null +++ b/t/logs/buildd-architecture-old @@ -0,0 +1,8 @@ +dpkg-buildpackage: source package test +dpkg-buildpackage: host architecture is ia64 + +# Old buildd logs use "host architecture is ia64" (note the "is"). Detect the +# architecture correctly for those logs. + +gcc -D_FORTIFY_SOURCE=2 -g -O2 -fPIE -Wformat -Wformat-security -Werror=format-security -Wall -c test.c +gcc -fPIE -pie -o test test.o diff --git a/t/tests.t b/t/tests.t index 6b47757..f35e5ea 100644 --- a/t/tests.t +++ b/t/tests.t @@ -19,7 +19,7 @@ use strict; use warnings; -use Test::More tests => 202; +use Test::More tests => 204; sub is_blhc { @@ -830,6 +830,12 @@ LDFLAGS missing (-pie -Wl,-z,relro): gcc -fPIE -o test test.o '; +# architecture in older buildd logs + +is_blhc 'buildd-architecture-old', '', 0, + ''; + + # ignore architecture is_blhc ['arch-avr32', 'arch-i386', 'empty', 'arch-mipsel'],