Hello,
Since the line indicating the start of a build step and the line
displaying the build command might not be adjacent due to parallel
build, it should be enough to look up to a number of lines equal to the
number of parallel jobs instead of just the next. The attached patch
should do just this; I have tested it on an affected build log [1],
adding and removing interleaved lines, and it seems to work OK.

[1]
http://buildd.debian.org/status/fetch.php?pkg=odil&arch=armel&ver=0.6.0-1&stamp=1463169438

Cheers,
-- 
Julien
diff --git a/bin/blhc b/bin/blhc
index 6817a85..ecc9d65 100755
--- a/bin/blhc
+++ b/bin/blhc
@@ -714,6 +714,9 @@ foreach my $file (@ARGV) {
     # for performance reasons.
     my $ada = 0;
 
+    # Number of parallel jobs, for buildd logs.
+    my $parallel = 1;
+
     while (my $line = <$fh>) {
         # Detect architecture automatically unless overridden. For buildd logs
         # only, doesn't use the dpkg-buildpackage header. Necessary to ignore
@@ -807,6 +810,10 @@ foreach my $file (@ARGV) {
             }
         }
 
+        if ($line =~ /^DEB_BUILD_OPTIONS=parallel=(\d+)$/) {
+            $parallel = $1;
+        }
+
         # We skip over unimportant lines at the beginning of the log to
         # prevent false positives.
         last if index($line, 'dpkg-buildpackage: ') == 0;
@@ -1091,9 +1098,16 @@ LINE:
         }
 
         my $skip = 0;
-        if ($input_nonverbose[$i]
-                and is_non_verbose_build($line, $input[$i + 1], \$skip)) {
-            if (not $option_buildd) {
+        # Parallel jobs might get lines order mixed up look up to $parallel
+        if ($input_nonverbose[$i]) {
+            my $is_non_verbose = 1;
+            for (my $offset = 0; $offset < $parallel; $offset++) {
+                if (not is_non_verbose_build($line, $input[$i + $offset], 
\$skip)) {
+                    $is_non_verbose = 0;
+                }
+            }
+
+            if ($is_non_verbose and not $option_buildd) {
                 error_non_verbose_build($line);
                 $exit |= $exit_code{non_verbose_build};
             } else {

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to