On Thu, Jul 23, 2015 at 05:53:50PM -0500, William Hubbs wrote: > All, > > Here is the improvement I mentioned in the earlier thread. > > golang-base.eclass contains the base functions that were in golang-build > but can be used separately from either golang-vcs or golang-build. > > golang-vcs and golang-build are also being updated to inherit > golang-base. > > Let me know what you think. > > William >
All of this was committed just before the council meeting today. Thanks, William > # 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 $ > > # @ECLASS: golang-build.eclass > # @MAINTAINER: > # William Hubbs <[email protected]> > # @BLURB: Eclass that provides base functions for Go packages. > # @DESCRIPTION: > # This eclass provides base functions for software written in the Go > # programming language; it also provides the build-time dependency on > # dev-lang/go. > > case "${EAPI:-0}" in > 5) > ;; > *) > die "${ECLASS}: Unsupported eapi (EAPI=${EAPI})" > ;; > esac > > if [[ -z ${_GOLANG_BASE} ]]; then > > _GOLANG_BASE=1 > > DEPEND=">=dev-lang/go-1.4.2:=" > STRIP_MASK="*.a" > > # @ECLASS-VARIABLE: EGO_PN > # @REQUIRED > # @DESCRIPTION: > # This is the import path for the go package to build. Please emerge > # dev-lang/go and read "go help importpath" for syntax. > # > # Example: > # @CODE > # EGO_PN=github.com/user/package > # @CODE > > # @FUNCTION: ego_pn_check > # @DESCRIPTION: > # Make sure EGO_PN has a value. > ego_pn_check() { > [[ -z "${EGO_PN}" ]] && > die "${ECLASS}.eclass: EGO_PN is not set" > 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_gopath > # @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} "$@" > > ego_pn_check > insinto "$(get_golibdir)" > insopts -m0644 -p # preserve timestamps for bug 551486 > doins -r pkg src > } > > fi > Index: golang-build.eclass > =================================================================== > RCS file: /var/cvsroot/gentoo-x86/eclass/golang-build.eclass,v > retrieving revision 1.5 > diff -u -B -r1.5 golang-build.eclass > --- golang-build.eclass 23 Jul 2015 15:42:26 -0000 1.5 > +++ golang-build.eclass 23 Jul 2015 22:41:13 -0000 > @@ -10,6 +10,8 @@ > # This eclass provides default src_compile, src_test and src_install > # functions for software written in the Go programming language. > > +inherit golang-base > + > case "${EAPI:-0}" in > 5) > ;; > @@ -24,9 +26,6 @@ > > _GOLANG_BUILD=1 > > -DEPEND=">=dev-lang/go-1.4.2:=" > -STRIP_MASK="*.a" > - > # @ECLASS-VARIABLE: EGO_PN > # @REQUIRED > # @DESCRIPTION: > @@ -38,49 +37,10 @@ > # EGO_PN=github.com/user/package > # @CODE > > -# @FUNCTION: _golang-build_setup > -# @INTERNAL > -# @DESCRIPTION: > -# Make sure EGO_PN has a value. > -_golang-build_setup() { > - [[ -z "${EGO_PN}" ]] && > - die "${ECLASS}.eclass: EGO_PN is not set" > - 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 > + ego_pn_check > set -- env GOPATH="${WORKDIR}/${P}:$(get_golibdir_gopath)" \ > go build -v -work -x "${EGO_PN}" > echo "$@" > @@ -90,7 +50,7 @@ > golang-build_src_install() { > debug-print-function ${FUNCNAME} "$@" > > - _golang-build_setup > + ego_pn_check > set -- env GOPATH="${WORKDIR}/${P}:$(get_golibdir_gopath)" \ > go install -v -work -x "${EGO_PN}" > echo "$@" > @@ -101,7 +61,7 @@ > golang-build_src_test() { > debug-print-function ${FUNCNAME} "$@" > > - _golang-build_setup > + ego_pn_check > set -- env GOPATH="${WORKDIR}/${P}:$(get_golibdir_gopath)" \ > go test -v -work -x "${EGO_PN}" > echo "$@" > Index: golang-vcs.eclass > =================================================================== > RCS file: /var/cvsroot/gentoo-x86/eclass/golang-vcs.eclass,v > retrieving revision 1.3 > diff -u -B -r1.3 golang-vcs.eclass > --- golang-vcs.eclass 23 Jun 2015 18:59:43 -0000 1.3 > +++ golang-vcs.eclass 23 Jul 2015 22:41:34 -0000 > @@ -10,7 +10,7 @@ > # This eclass is written to ease the maintenance of live ebuilds > # of software written in the Go programming language. > > -inherit eutils > +inherit eutils golang-base > > case "${EAPI:-0}" in > 5) > @@ -26,8 +26,6 @@ > > _GOLANG_VCS=1 > > -DEPEND=">=dev-lang/go-1.4.2" > - > # @ECLASS-VARIABLE: EGO_PN > # @REQUIRED > # @DESCRIPTION: > @@ -114,8 +112,7 @@ > _golang-vcs_fetch() { > debug-print-function ${FUNCNAME} "$@" > > - [[ -z ${EGO_PN} ]] && > - die "${ECLASS}: EGO_PN is not set" > + ego_pn_check > > if [[ -z ${EVCS_OFFLINE} ]]; then > [[ -n ${EVCS_UMASK} ]] && eumask_push ${EVCS_UMASK}
signature.asc
Description: Digital signature
