]> ruderich.org/simon Gitweb - blhc/blhc.git/commitdiff
Fix buildd architecture detection.
authorSimon Ruderich <simon@ruderich.org>
Wed, 14 Aug 2013 14:54:38 +0000 (16:54 +0200)
committerSimon Ruderich <simon@ruderich.org>
Wed, 14 Aug 2013 14:54:38 +0000 (16:54 +0200)
Only relevant if the chroot setup fails and dpkg-buildpackage is never
run.

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

index d7fa680e156d827ecf21a02beff6989a2879d9c7..efbc65db2b182843f8b53f57b81a4ad6943c9820 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -19,6 +19,8 @@ t/logs/bad-cppflags
 t/logs/bad-ldflags
 t/logs/bad-library
 t/logs/bad-multiline
+t/logs/buildd-architecture
+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/NEWS b/NEWS
index d113ec772c163ad2161e45449a66e0f1df05b7d4..3e3d2555ea450931bf5ca888aba641eb04ac8cc9 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,8 @@ Version 0.XX
   Geyer.
 - Fix detection of build dependencies for buildd logs (Debian bug #719656),
   reported by Nicolas Boulenguez.
+- Fix buildd architecture detection. Only relevant if the chroot setup fails
+  and dpkg-buildpackage is never run; therefore a minor issue.
 
 - Sync architecture specific hardening support with dpkg 1.17.1.
 
index 38d0834cd4c1ddc37b70602cf0d186f64fc769ae..9ed648aa1a7be09fabffa22514b7cabb35a87166 100755 (executable)
--- a/bin/blhc
+++ b/bin/blhc
@@ -688,8 +688,13 @@ foreach my $file (@ARGV) {
         # 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 index($line, 'Architecture: ') == 0) {
-            $arch = substr $line, 14, -1; # -1 to ignore '\n' at the end
+        if (not $arch) {
+            if (index($line, 'Build Architecture: ') == 0) {
+                $arch = substr $line, 20, -1; # -1 to ignore '\n' at the end
+            # For old logs (sbuild << 0.63.0-1).
+            } elsif (index($line, 'Architecture: ') == 0) {
+                $arch = substr $line, 14, -1; # -1 to ignore '\n' at the end
+            }
         }
 
         # dpkg-buildflags only provides hardening flags since 1.16.1, don't
diff --git a/t/logs/buildd-architecture b/t/logs/buildd-architecture
new file mode 100644 (file)
index 0000000..7f1b342
--- /dev/null
@@ -0,0 +1,4 @@
+Build Architecture: mipsel
+dpkg-buildpackage: source package test
+
+gcc -g -O2 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test.c
diff --git a/t/logs/buildd-architecture-old b/t/logs/buildd-architecture-old
new file mode 100644 (file)
index 0000000..9cd5ba6
--- /dev/null
@@ -0,0 +1,6 @@
+# Old logs used Architecture instead of Build Architecture (sbuild <<
+# 0.63.0-1).
+Architecture: mipsel
+dpkg-buildpackage: source package test
+
+gcc -g -O2 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test.c
index b90eb853a8a0546bb470de786408631575ec229e..90863f1a6b9ec2a9466d3229f1e5261139ccaa64 100644 (file)
@@ -1,4 +1,4 @@
-Architecture: i386
+Build Architecture: i386
 Toolchain package versions: ... dpkg-dev_1.16.1.2 ...
 dpkg-buildpackage: source package test
 
index ad7a2620880075c1f2cbd02893387b33366f93f5..20d323cc142ff03ef39c997abec5e29148bb2e0b 100644 (file)
--- a/t/tests.t
+++ b/t/tests.t
@@ -19,7 +19,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 208;
+use Test::More tests => 212;
 
 
 sub is_blhc {
@@ -840,6 +840,12 @@ is_blhc 'dpkg-buildpackage-architecture-old', '', 0,
         '';
 
 
+# correct architecture detection
+
+is_blhc 'buildd-architecture',     '', 0, '';
+is_blhc 'buildd-architecture-old', '', 0, '';
+
+
 # ignore architecture
 
 is_blhc ['arch-avr32', 'arch-i386', 'empty', 'arch-mipsel'],