On 1 May 2016 at 22:41, Michael Hudson-Doyle <[email protected]> wrote: > Package: dh-golang > Version: 1.12ubuntu1 > Severity: important > > Dear Maintainer, > > dh_golang can fail when compiling with gccgo because in this case it's > possible > for go list to report no dependencies at all. Patch coming as soon as I get a > bug number :-) > > Cheers, > mwh > > -- System Information: > Debian Release: stretch/sid > APT prefers xenial-updates > APT policy: (500, 'xenial-updates'), (500, 'xenial-security'), (500, > 'xenial'), (100, 'xenial-backports') > Architecture: amd64 (x86_64) > Foreign Architectures: i386 > > Kernel: Linux 4.4.0-21-generic (SMP w/4 CPU cores) > Locale: LANG=en_NZ.UTF-8, LC_CTYPE=en_NZ.UTF-8 (charmap=UTF-8) > Shell: /bin/sh linked to /bin/dash > Init: systemd (via /run/systemd/system) > > Versions of packages dh-golang depends on: > ii debhelper 9.20160115ubuntu3 > ii dpkg 1.18.4ubuntu1 > ii libdpkg-perl 1.18.4ubuntu1 > ii perl 5.22.1-9 > > dh-golang recommends no packages. > > dh-golang suggests no packages. > > -- no debconf information
From 7cbd70481b99429e1da20b84c94df214ddacede5 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle <[email protected]> Date: Sun, 1 May 2016 22:50:00 +1200 Subject: [PATCH] Yet another corner case in dh_golang, this one only shows up with gccgo. (Closes: 823136)
--- debian/changelog | 7 +++++++ script/dh_golang | 19 ++++++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/debian/changelog b/debian/changelog index c943d98..b1d9f76 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +dh-golang (1.17) UNRELEASED; urgency=medium + + * Yet another corner case in dh_golang, this one only shows up with gccgo. + (Closes: 823136) + + -- Michael Hudson-Doyle <[email protected]> Sun, 01 May 2016 22:28:04 +1200 + dh-golang (1.16) unstable; urgency=medium [ Michael Hudson-Doyle ] diff --git a/script/dh_golang b/script/dh_golang index d39523b..bcf5432 100755 --- a/script/dh_golang +++ b/script/dh_golang @@ -51,6 +51,10 @@ system("go list -f \"$tmpl\" @targets > $tmpdir/godeps") == 0 system("sort -u $tmpdir/godeps | xargs go list -f '{{ .Dir }}' > $tmpdir/godirs") == 0 or die "go list of dependencies failed with code $?, $!"; +# It's possible for a Go package to report no dependencies at all when compiling +# with gccgo. Avoid calling dpkg-query --search with no arguments in this case. +my $at_least_one; + open(my $inp, "<", "$tmpdir/godirs"); open(my $outp, ">", "$tmpdir/realgodirs"); while (<$inp>) { @@ -58,18 +62,23 @@ while (<$inp>) { my $realpath = realpath($_); # godirs will include the directories of the package being built, so exclude them. if ($realpath !~ /^\Q$bs->{cwd}\E/) { + $at_least_one = 1; printf $outp "%s\n", $realpath; } } close($inp); close($outp); -system("cat $tmpdir/realgodirs | xargs dpkg-query --search > $tmpdir/pkgs") == 0 - or die "dpkg-query --search failed with code $?, $!"; +my $built_using; + +if ($at_least_one) { + system("cat $tmpdir/realgodirs | xargs dpkg-query --search > $tmpdir/pkgs") == 0 + or die "dpkg-query --search failed with code $?, $!"; -my $built_using = `cut -d: -f1 $tmpdir/pkgs | sort -u | xargs dpkg-query -f='\${source:Package} (= \${source:Version}), ' -W`; -if ($? != 0) { - die "dpkg-query -W failed with code $?, $!"; + $built_using = `cut -d: -f1 $tmpdir/pkgs | sort -u | xargs dpkg-query -f='\${source:Package} (= \${source:Version}), ' -W`; + if ($? != 0) { + die "dpkg-query -W failed with code $?, $!"; + } } # If there is an easier way to have a universal misc:Built-Using on all binary -- 2.7.4

