From: Simon Ruderich <simon@ruderich.org>
Date: Thu, 22 Mar 2012 00:08:13 +0000 (+0100)
Subject: Ignore unimportant lines at the end of the buildd log.
X-Git-Tag: 0.01~78
X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=7e0037c0788371d6911d2dae5e919bd1b963aedb;p=blhc%2Fblhc.git

Ignore unimportant lines at the end of the buildd log.
---

diff --git a/MANIFEST b/MANIFEST
index 7aaca6e..6a79d89 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -16,6 +16,7 @@ t/logs/bad-library
 t/logs/bad-multiline
 t/logs/buildd-dpkg-dev
 t/logs/buildd-dpkg-dev-old
+t/logs/buildd-package-details
 t/logs/c++
 t/logs/cc
 t/logs/configure
diff --git a/bin/blhc b/bin/blhc
index 3839ec9..e602106 100755
--- a/bin/blhc
+++ b/bin/blhc
@@ -370,6 +370,10 @@ while (my $line = <>) {
     # false positives.
     $start = 1 if $line =~ /^dpkg-buildpackage:/;
     next if not $start;
+    # And stop at the end of the build log. Package details (reported by the
+    # buildd logs) are not important for us. This also prevents false
+    # positives.
+    last if $line =~ /^Build finished at \d{8}-\d{4}$/;
 
     # Detect architecture automatically unless overridden.
     if (not $option_arch
diff --git a/t/logs/buildd-package-details b/t/logs/buildd-package-details
new file mode 100644
index 0000000..0af7396
--- /dev/null
+++ b/t/logs/buildd-package-details
@@ -0,0 +1,16 @@
+Toolchain package versions: ... dpkg-dev_1.16.1.2 ...
+dpkg-buildpackage: source package test
+
+gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.c
+gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.c
+gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-c.c
+gcc -g -O3 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-d.c
+gcc -Wl,-z,relro -o test test-a.o test-b.o test-c.o -ltest
+
+Build finished at 20120308-1648
+# Everything after this is ignored.
+
+gcc -g -O2 -c test-a.c
+gcc -g -O2 -c test-b.c
+gcc -g -O2 -c test-c.c
+gcc -o test test-a.o test-b.o test-c.o -ltest
diff --git a/t/tests.t b/t/tests.t
index 51bdf3a..ff9e3ed 100644
--- a/t/tests.t
+++ b/t/tests.t
@@ -19,7 +19,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 84;
+use Test::More tests => 86;
 
 
 sub is_blhc {
@@ -543,6 +543,9 @@ LDFLAGS missing (-Wl,-z,relro): gcc -o test test.o `dpkg-buildflags --get CFLAGS
 
 # buildd support
 
+is_blhc 'buildd-package-details', '--buildd', 0,
+        '';
+
 is_blhc 'buildd-dpkg-dev', '--buildd', 8,
         'CFLAGS missing (-fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security): gcc -g -O2 -c test-a.c
 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -g -O2 -c test-a.c