From 287e6f3e56eeed74465bada187f9f4b18c07eb91 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Sat, 29 Sep 2012 14:39:43 +0200 Subject: [PATCH] Detect architecture in old buildd logs which add an "is". E.g. dpkg-buildpackage: host architecture is ia64 --- MANIFEST | 1 + bin/blhc | 7 +++++++ t/logs/buildd-architecture-old | 8 ++++++++ t/tests.t | 8 +++++++- 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 t/logs/buildd-architecture-old 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'], -- 2.45.2