Bug#841074: dh-golang: Do not emit misc:Built-Using substvar for arch:all packages

2017-06-20 Thread Michael Stapelberg
control: tags -1 pending

Hi Guillem,

Guillem Jover  writes:
> This helper generates a misc:Built-Using substvar for all involved
> packages, but that seems wrong for packages that do not statically
> embed any Go modules when building, in case they are -dev packages
> that just include Go source code.
>
> Attached a patch that does that. Or is there any arch:all package
> which ends up embedding other modules, which would make this
> assumption wrong?

Sounds good, applied the patch.

-- 
Best regards,
Michael



Bug#841074: dh-golang: Do not emit misc:Built-Using substvar for arch:all packages

2016-10-17 Thread Guillem Jover
Package: dh-golang
Version: 1.19
Severity: normal
Tags: patch

Hi!

This helper generates a misc:Built-Using substvar for all involved
packages, but that seems wrong for packages that do not statically
embed any Go modules when building, in case they are -dev packages
that just include Go source code.

Attached a patch that does that. Or is there any arch:all package
which ends up embedding other modules, which would make this
assumption wrong?

Thanks,
Guillem
From 359074d2c5936e792e3ea672f4c3f5f65e2c0250 Mon Sep 17 00:00:00 2001
From: Guillem Jover 
Date: Mon, 17 Oct 2016 14:21:31 +0200
Subject: [PATCH] Do not emit misc:Built-Using substvars for arch:all packages

These modules do not statically embed other Go modules, as they do not
get compiled. Emitting the substvar makes dpkg-gencontrol emit a warning
which incites maintainers to wrongly add the field.
---
 script/dh_golang | 5 +
 1 file changed, 5 insertions(+)

diff --git a/script/dh_golang b/script/dh_golang
index 4c4e09d..a098497 100755
--- a/script/dh_golang
+++ b/script/dh_golang
@@ -85,6 +85,11 @@ rmtree($tmpdir);
 # If there is an easier way to have a universal misc:Built-Using on all binary
 # packages, I am happy to merge your patch :).
 foreach my $package (@{$dh{DOPACKAGES}}) {
+# Skip adding the misc:Built-Using substvar if the package is
+# architecture independent, as those should not end up embeddeding
+# other Go modules.
+next if package_arch($package) eq 'all';
+
 addsubstvar($package, "misc:Built-Using", $built_using);
 }
 
-- 
2.9.3