williamh    15/07/23 15:42:26

  Modified:             ChangeLog golang-build.eclass
  Log:
  Add functions to retrieve Go library paths and install Go packages.

Revision  Changes    Path
1.1726               eclass/ChangeLog

file : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.1726&view=markup
plain: 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.1726&content-type=text/plain
diff : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?r1=1.1725&r2=1.1726

Index: ChangeLog
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v
retrieving revision 1.1725
retrieving revision 1.1726
diff -u -r1.1725 -r1.1726
--- ChangeLog   22 Jul 2015 12:47:40 -0000      1.1725
+++ ChangeLog   23 Jul 2015 15:42:26 -0000      1.1726
@@ -1,6 +1,9 @@
 # ChangeLog for eclass directory
 # Copyright 1999-2015 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1725 2015/07/22 
12:47:40 kensington Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1726 2015/07/23 
15:42:26 williamh Exp $
+
+  23 Jul 2015; William Hubbs <willi...@gentoo.org> golang-build.eclass:
+  Add functions to retrieve Go library paths and install Go packages.
 
   22 Jul 2015; Michael Palimaka <kensing...@gentoo.org> kde4-meta.eclass:
   Fix oldpim unpack by Andreas Sturmlechner <andreas.sturmlech...@gmail.com>



1.5                  eclass/golang-build.eclass

file : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/golang-build.eclass?rev=1.5&view=markup
plain: 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/golang-build.eclass?rev=1.5&content-type=text/plain
diff : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/golang-build.eclass?r1=1.4&r2=1.5

Index: golang-build.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/golang-build.eclass,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- golang-build.eclass 6 Jul 2015 16:48:21 -0000       1.4
+++ golang-build.eclass 23 Jul 2015 15:42:26 -0000      1.5
@@ -1,6 +1,6 @@
 # Copyright 1999-2015 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/golang-build.eclass,v 1.4 2015/07/06 
16:48:21 williamh Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/golang-build.eclass,v 1.5 2015/07/23 
15:42:26 williamh Exp $
 
 # @ECLASS: golang-build.eclass
 # @MAINTAINER:
@@ -48,11 +48,40 @@
        return 0
 }
 
+# @FUNCTION: get_golibdir
+# @DESCRIPTION:
+# Return the non-prefixed library directory where Go packages
+# should be installed
+get_golibdir() {
+       echo /usr/lib/go-gentoo
+}
+
+# @FUNCTION: get_golibdir
+# @DESCRIPTION:
+# Return the library directory where Go packages should be installed
+# This is the prefixed version which should be included in GOPATH
+get_golibdir_gopath() {
+       echo "${EPREFIX}$(get_golibdir)"
+}
+
+# @FUNCTION: golang_install_pkgs
+# @DESCRIPTION:
+# Install Go packages.
+# This function assumes that $cwd is a Go workspace.
+golang_install_pkgs() {
+       debug-print-function ${FUNCNAME} "$@"
+
+       _golang-build_setup
+       insinto "$(get_golibdir)"
+       insopts -m0644 -p # preserve timestamps for bug 551486
+       doins -r pkg src
+}
+
 golang-build_src_compile() {
        debug-print-function ${FUNCNAME} "$@"
 
        _golang-build_setup
-       set -- env GOPATH="${WORKDIR}/${P}:${EPREFIX}/usr/lib/go-gentoo" \
+       set -- env GOPATH="${WORKDIR}/${P}:$(get_golibdir_gopath)" \
                go build -v -work -x "${EGO_PN}"
        echo "$@"
        "$@" || die
@@ -62,20 +91,18 @@
        debug-print-function ${FUNCNAME} "$@"
 
        _golang-build_setup
-       set -- env GOPATH="${WORKDIR}/${P}:${EPREFIX}/usr/lib/go-gentoo" \
+       set -- env GOPATH="${WORKDIR}/${P}:$(get_golibdir_gopath)" \
                go install -v -work -x "${EGO_PN}"
        echo "$@"
        "$@" || die
-       insinto /usr/lib/go-gentoo
-       insopts -m0644 -p # preserve timestamps for bug 551486
-       doins -r pkg src
+       golang_install_pkgs
 }
 
 golang-build_src_test() {
        debug-print-function ${FUNCNAME} "$@"
 
        _golang-build_setup
-       set -- env GOPATH="${WORKDIR}/${P}:${EPREFIX}/usr/lib/go-gentoo" \
+       set -- env GOPATH="${WORKDIR}/${P}:$(get_golibdir_gopath)" \
                go test -v -work -x "${EGO_PN}"
        echo "$@"
        "$@" || die




Reply via email to