From: Simon Ruderich Date: Wed, 14 Aug 2013 14:54:38 +0000 (+0200) Subject: Fix buildd architecture detection. X-Git-Tag: 0.05~16 X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=22380d5ef99ff37e3c96070d65f01c34a8f0ba82;p=blhc%2Fblhc.git Fix buildd architecture detection. Only relevant if the chroot setup fails and dpkg-buildpackage is never run. --- diff --git a/MANIFEST b/MANIFEST index d7fa680..efbc65d 100644 --- 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 d113ec7..3e3d255 100644 --- 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. diff --git a/bin/blhc b/bin/blhc index 38d0834..9ed648a 100755 --- 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 index 0000000..7f1b342 --- /dev/null +++ b/t/logs/buildd-architecture @@ -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 index 0000000..9cd5ba6 --- /dev/null +++ b/t/logs/buildd-architecture-old @@ -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 diff --git a/t/logs/buildd-dpkg-dev b/t/logs/buildd-dpkg-dev index b90eb85..90863f1 100644 --- a/t/logs/buildd-dpkg-dev +++ b/t/logs/buildd-dpkg-dev @@ -1,4 +1,4 @@ -Architecture: i386 +Build Architecture: i386 Toolchain package versions: ... dpkg-dev_1.16.1.2 ... dpkg-buildpackage: source package test diff --git a/t/tests.t b/t/tests.t index ad7a262..20d323c 100644 --- 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'],