Ubuntu Pastebin

Paste from mwhudson at Wed, 30 Mar 2016 23:27:45 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
diff --git a/debian/changelog b/debian/changelog
index 5a7b1f9..d92b257 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+dh-golang (1.12ubuntu1) xenial; urgency=medium
+
+  * Follow /usr/bin/go symlink when computing Built-Using. (LP: #1564124)
+
+ -- Michael Hudson-Doyle <michael.hudson@canonical.com>  Thu, 31 Mar 2016 11:42:07 +1300
+
 dh-golang (1.12) unstable; urgency=medium
 
   [ Hilko Bengen ]
diff --git a/script/dh_golang b/script/dh_golang
index fad7998..9b8dec9 100755
--- a/script/dh_golang
+++ b/script/dh_golang
@@ -110,6 +110,15 @@ if (defined($build_depends) && $build_depends ne '') {
     my $golang_deps = join(' ', grep { /^golang-/ }
                                 map { flatten($_) }
                                 $deps->get_deps());
+    # If the build depends contains a package that comes from golang-defaults
+    # (usually 'golang-go' but possibly just 'golang'), report the owner of
+    # where /usr/bin/go in Built-Using as well.
+    my $source_deps = `dpkg-query -f='\${source:Package} ' -W $golang_deps`;
+    if ($source_deps =~ /\bgolang-defaults\b/) {
+        if (my $golang_go_dep = `dpkg-query --search \$(readlink -f /usr/bin/go) 2>/dev/null | cut -d: -f1`) {
+            $golang_deps .= " $golang_go_dep";
+        }
+    }
     if ($golang_deps ne '') {
         $built_using = `dpkg-query -f='\${source:Package} (= \${source:Version}), ' -W $golang_deps`;
     }
Download as text