[Pkg-golang-commits] [golang-defaults] 12/27: symlinks need to be different on gccgo platform!

Michael Hudson-Doyle mwhudson-guest at moszumanska.debian.org
Wed Jul 19 21:48:38 UTC 2017


This is an automated email from the git hooks/post-receive script.

mwhudson-guest pushed a commit to tag debian/2%1.6-1ubuntu3
in repository golang-defaults.

commit 8ba803df825249ef5f31138d386e78dddf456f80
Author: Michael Hudson-Doyle <michael.hudson at canonical.com>
Date:   Wed Mar 9 15:42:20 2016 +1300

    symlinks need to be different on gccgo platform!
---
 debian/golang-go.links.gccgo                       |  3 ++
 .../{golang-go.links => golang-go.links.golang-go} |  0
 debian/helpers/getgoarches.pl                      | 32 ++++++++++++++++++++++
 debian/rules                                       | 18 ++++++++++++
 4 files changed, 53 insertions(+)

diff --git a/debian/golang-go.links.gccgo b/debian/golang-go.links.gccgo
new file mode 100755
index 0000000..fab5a5a
--- /dev/null
+++ b/debian/golang-go.links.gccgo
@@ -0,0 +1,3 @@
+#!/usr/bin/dh-exec
+usr/bin/go-6 usr/bin/go
+usr/bin/gofmt-6 usr/bin/gofmt
diff --git a/debian/golang-go.links b/debian/golang-go.links.golang-go
similarity index 100%
rename from debian/golang-go.links
rename to debian/golang-go.links.golang-go
diff --git a/debian/helpers/getgoarches.pl b/debian/helpers/getgoarches.pl
new file mode 100755
index 0000000..9ba62e6
--- /dev/null
+++ b/debian/helpers/getgoarches.pl
@@ -0,0 +1,32 @@
+#!/usr/bin/perl
+
+# Extract list of golang architectures by looking at dependencies in control
+# This is completely ridiculous, yes.
+
+package main;
+
+use warnings;
+use strict;
+
+use Dpkg::Control::Info;
+use Dpkg::Deps;
+use Dpkg::Substvars;
+
+my $control = Dpkg::Control::Info->new();
+my $p = $control->get_pkg_by_name("golang-go");
+
+my $s = Dpkg::Substvars->new();
+$s->set("golang:GOVER", "GOVER");
+$s->set("source:Version", "1.0");
+$s->set("misc:Depends", "");
+$p->apply_substvars($s);
+my $d = deps_parse($p->{depends});
+
+deps_iterate($d, sub {
+    my $x = shift;
+    if (defined($x->{package}) && $x->{package} eq "golang-GOVER-go") {
+        printf("%s\n", join(" ", @{$x->{arches}}));
+        return 0;
+    }
+    return 1;
+});
diff --git a/debian/rules b/debian/rules
index 53e0bc5..9a04ac1 100755
--- a/debian/rules
+++ b/debian/rules
@@ -2,9 +2,27 @@
 # -*- makefile -*-
 
 export GOVER := $(shell debian/helpers/getver.pl)
+golang_archs = $(shell debian/helpers/getgoarches.pl)
+
+IS_GOLANG_ARCH := true
+ifeq (,$(filter $(DEB_HOST_ARCH),$(golang_archs)))
+        IS_GOLANG_ARCH := false
+endif
 
 %:
 	dh $@
 
+override_dh_clean:
+	dh_clean
+	rm -f debian/golang-go.links
+
+override_dh_prep:
+	dh_clean
+ifeq (true, $(IS_GOLANG_ARCH))
+	cp debian/golang-go.links.golang-go debian/golang-go.links
+else
+	cp debian/golang-go.links.gccgo debian/golang-go.links
+endif
+
 override_dh_gencontrol:
 	dh_gencontrol -- -Vgolang:GOVER=$(GOVER)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-golang/golang-defaults.git



More information about the pkg-golang-commits mailing list