From 5bba87ced3180480ea9d147b300517b79ac15136 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Sat, 7 Jul 2012 02:22:26 +0200 Subject: [PATCH] Use index() in a few more places. --- bin/blhc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bin/blhc b/bin/blhc index 22ebd6f..57ea000 100755 --- a/bin/blhc +++ b/bin/blhc @@ -641,8 +641,8 @@ 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 $line =~ /^Architecture: (.+)$/) { - $arch = $1; + if (not $arch and 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 @@ -713,12 +713,13 @@ foreach my $file (@ARGV) { # 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}$/; + last if index($line, 'Build finished at ') == 0 + and $line =~ /^Build finished at \d{8}-\d{4}$/; # Detect architecture automatically unless overridden. if (not $arch - and $line =~ /^dpkg-buildpackage: host architecture (.+)$/) { - $arch = $1; + and index($line, 'dpkg-buildpackage: host architecture ') == 0) { + $arch = substr $line, 37, -1; # -1 to ignore '\n' at the end } # Ignore compiler warnings for now. -- 2.45.2