Folks,

there are a couple of changes I need to make to golang-vcs.eclass.

This change adds a feature that is needed for repositories with multiple
packages (specifically the EGO_SRC variable),
changes references from ${S} to ${WORKDIR}/${P} to match other eclasses
and copies the appropriate sources to${WORKDIR}/${P}.

William

Index: golang-vcs.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/golang-vcs.eclass,v
retrieving revision 1.1
diff -u -B -r1.1 golang-vcs.eclass
--- golang-vcs.eclass	16 Jun 2015 21:40:51 -0000	1.1
+++ golang-vcs.eclass	17 Jun 2015 17:48:58 -0000
@@ -40,6 +40,20 @@
 # 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 @@
 	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 @@
 		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 @@
 	# 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
 }
 

Attachment: signature.asc
Description: Digital signature

Reply via email to