summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Hubbs <williamh@gentoo.org>2015-06-18 15:19:04 +0000
committerWilliam Hubbs <williamh@gentoo.org>2015-06-18 15:19:04 +0000
commit9eeb2d556e41454fb387415b1fd77b5c21288dea (patch)
tree39cc0403782dc769b1501809e1d8e02feb52e3a5 /eclass/golang-vcs.eclass
parent[QA] Remove old ebuild with dependency on removed emul-linux-x86-* packages, ... (diff)
downloadgentoo-2-9eeb2d556e41454fb387415b1fd77b5c21288dea.tar.gz
gentoo-2-9eeb2d556e41454fb387415b1fd77b5c21288dea.tar.bz2
gentoo-2-9eeb2d556e41454fb387415b1fd77b5c21288dea.zip
golang-vcs.eclass:
Add the EGO_SRC variable for repositories that contain multiple Go packages. Change references from ${S} to ${WORKDIR}/${P} to match other eclasses. Copy the appropriate sources to${WORKDIR}/${P}.
Diffstat (limited to 'eclass/golang-vcs.eclass')
-rw-r--r--eclass/golang-vcs.eclass35
1 files changed, 30 insertions, 5 deletions
diff --git a/eclass/golang-vcs.eclass b/eclass/golang-vcs.eclass
index d3364ffc9371..0f3c38123846 100644
--- a/eclass/golang-vcs.eclass
+++ b/eclass/golang-vcs.eclass
@@ -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-vcs.eclass,v 1.1 2015/06/16 21:40:51 williamh Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/golang-vcs.eclass,v 1.2 2015/06/18 15:19:04 williamh Exp $
# @ECLASS: golang-vcs.eclass
# @MAINTAINER:
@@ -40,6 +40,20 @@ DEPEND=">=dev-lang/go-1.4.2"
# EGO_PN="github.com/user1/package1 github.com/user2/package2"
# @CODE
+# @ECLASS-VARIABLE: EGO_SRC
+# @DESCRIPTION:
+# This is the Go upstream repository which will be copied to
+# ${WORKDIR}/${P}.
+# If it isn't set, it defaults to the first word of ${EGO_PN}.
+# This should be set if you are retrieving a repository that includes
+# multiple packages, e.g. golang.org/x/tools.
+#
+# Example:
+# @CODE
+# EGO_PN="github.com/user/repository/package"
+# EGO_SRC="github.com/user/repository"
+# @CODE
+
# @ECLASS-VARIABLE: EGO_STORE_DIR
# @DESCRIPTION:
# Storage directory for Go sources.
@@ -85,8 +99,12 @@ _golang-vcs_env_setup() {
export GOPATH="${EGO_STORE_DIR}"
[[ -n ${EVCS_UMASK} ]] && eumask_pop
- mkdir -p "${S}" ||
- die "${ECLASS}: unable to create ${S}"
+ mkdir -p "${WORKDIR}/${P}/src" ||
+ die "${ECLASS}: unable to create ${WORKDIR}/${P}"
+ if [ -z "${EGO_SRC}" ]; then
+ set -- ${EGO_PN}
+ EGO_SRC="$1"
+ fi
return 0
}
@@ -101,7 +119,7 @@ _golang-vcs_fetch() {
die "${ECLASS}: EGO_PN is not set"
if [[ -n ${EVCS_OFFLINE} ]]; then
- export GOPATH="${S}:${GOPATH}"
+ export GOPATH="${WORKDIR}/${P}:${GOPATH}"
return 0
fi
@@ -118,7 +136,14 @@ _golang-vcs_fetch() {
# downloading the top level repository is successful.
[[ -n ${EVCS_UMASK} ]] && eumask_pop
- export GOPATH="${S}:${EGO_STORE_DIR}"
+ export GOPATH="${WORKDIR}/${P}:${EGO_STORE_DIR}"
+ set -- mkdir -p "${WORKDIR}/${P}/src/${EGO_SRC}"
+ echo "$@"
+ "$@" || die "Unable to create ${WORKDIR}/${P}/src/${EGO_SRC}"
+ set -- cp -r "${EGO_STORE_DIR}/src/${EGO_SRC}/*" \
+ "${WORKDIR}/${P}/src/${EGO_SRC}"
+ echo "$@"
+ $@ || die "Unable to copy sources to ${WORKDIR}/${P}"
return 0
}