Detect architecture in old buildd logs which add an "is".
authorSimon Ruderich <simon@ruderich.org>
Sat, 29 Sep 2012 12:39:43 +0000 (14:39 +0200)
committerSimon Ruderich <simon@ruderich.org>
Sat, 29 Sep 2012 12:39:43 +0000 (14:39 +0200)
E.g. dpkg-buildpackage: host architecture is ia64

MANIFEST
bin/blhc
t/logs/buildd-architecture-old [new file with mode: 0644]
t/tests.t

index 1b2b03ddc90f18fdf344f19a59706127232515a8..ff0989861faa573a062d429c38f24700e7a45ced 100644 (file)
--- 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
index bfdcfc575ee7642ae81fff9faf6c86c2ae62dcc0..f2f0d6f1253055d81c918f23ca64670c37826b51 100755 (executable)
--- 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 (file)
index 0000000..da7565c
--- /dev/null
@@ -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
index 6b47757e391015aab12e5833c1a5c338cf1727fc..f35e5eac4bd73a18cccd354354098da9a55ca2e4 100644 (file)
--- 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'],