From: Simon Ruderich Date: Sat, 7 Jul 2012 00:22:26 +0000 (+0200) Subject: Use index() in a few more places. X-Git-Tag: 0.04~16 X-Git-Url: https://ruderich.org/simon/gitweb/?p=blhc%2Fblhc.git;a=commitdiff_plain;h=5bba87ced3180480ea9d147b300517b79ac15136 Use index() in a few more places. --- 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.