public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] golang-vcs.eclass updates
@ 2015-06-17 18:01 William Hubbs
  2015-06-18 15:23 ` William Hubbs
  0 siblings, 1 reply; 4+ messages in thread
From: William Hubbs @ 2015-06-17 18:01 UTC (permalink / raw
  To: gentoo development


[-- Attachment #1.1: Type: text/plain, Size: 331 bytes --]

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


[-- Attachment #1.2: golang-vcs.eclass.patch --]
[-- Type: text/x-diff, Size: 2036 bytes --]

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 #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-dev] golang-vcs.eclass updates
  2015-06-17 18:01 [gentoo-dev] golang-vcs.eclass updates William Hubbs
@ 2015-06-18 15:23 ` William Hubbs
  0 siblings, 0 replies; 4+ messages in thread
From: William Hubbs @ 2015-06-18 15:23 UTC (permalink / raw
  To: gentoo development

[-- Attachment #1: Type: text/plain, Size: 29 bytes --]

This is committed.

William


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [gentoo-dev] golang-vcs.eclass updates
@ 2015-06-22 22:36 William Hubbs
  2015-06-23 18:26 ` William Hubbs
  0 siblings, 1 reply; 4+ messages in thread
From: William Hubbs @ 2015-06-22 22:36 UTC (permalink / raw
  To: gentoo development


[-- Attachment #1.1: Type: text/plain, Size: 322 bytes --]

All,

here are more non-api-breaking updates to golang-vcs.eclass:

1. The GOPATH environment variable is now passed directly to the
commands that need it.
2. The correct directory of source files is copied to the correct
location under ${S}.

I'll post this as a patch since the eclass is in the tree.

Thanks,

William


[-- Attachment #1.2: golang-vcs.eclass.patch --]
[-- Type: text/x-diff, Size: 2812 bytes --]

Index: golang-vcs.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/golang-vcs.eclass,v
retrieving revision 1.2
diff -u -B -r1.2 golang-vcs.eclass
--- golang-vcs.eclass	18 Jun 2015 15:19:04 -0000	1.2
+++ golang-vcs.eclass	22 Jun 2015 22:12:37 -0000
@@ -50,7 +50,7 @@
 #
 # Example:
 # @CODE
-# EGO_PN="github.com/user/repository/package"
+# EGO_PN="github.com/user/repository/..."
 # EGO_SRC="github.com/user/repository"
 # @CODE
 
@@ -79,7 +79,7 @@
 # @FUNCTION: _golang-vcs_env_setup
 # @INTERNAL
 # @DESCRIPTION:
-# Create EGO_STORE_DIR if necessary and set GOPATH.
+# Create EGO_STORE_DIR if necessary.
 _golang-vcs_env_setup() {
 	debug-print-function ${FUNCNAME} "$@"
 
@@ -96,7 +96,6 @@
 	fi
 
 	addwrite "${EGO_STORE_DIR}"
-	export GOPATH="${EGO_STORE_DIR}"
 
 	[[ -n ${EVCS_UMASK} ]] && eumask_pop
 	mkdir -p "${WORKDIR}/${P}/src" ||
@@ -118,32 +117,26 @@
 	[[ -z ${EGO_PN} ]] &&
 		die "${ECLASS}: EGO_PN is not set"
 
-	if [[ -n ${EVCS_OFFLINE} ]]; then
-		export GOPATH="${WORKDIR}/${P}:${GOPATH}"
-		return 0
-	fi
-
-	[[ -n ${EVCS_UMASK} ]] && eumask_push ${EVCS_UMASK}
+	if [[ -z ${EVCS_OFFLINE} ]]; then
+		[[ -n ${EVCS_UMASK} ]] && eumask_push ${EVCS_UMASK}
 
-	set -- go get -d -t -u -v -x "${EGO_PN}"
-	echo "$@"
-	"$@" || die
-	# The above dies if you pass repositories in EGO_PN instead of
-	# packages, e.g. golang.org/x/tools instead of golang.org/x/tools/cmd/vet.
-	# This is being discussed in the following upstream issue:
-	# https://github.com/golang/go/issues/11090
-	# I am hoping this will be fixed so "go get -d" is successful if
-	# downloading the top level repository is successful.
+		set -- env GOPATH="${EGO_STORE_DIR}" go get -d -t -u -v -x "${EGO_PN}"
+		echo "$@"
+		"$@" || die
+		# The above dies if you pass repositories in EGO_PN instead of
+		# packages, e.g. golang.org/x/tools instead of golang.org/x/tools/cmd/vet.
+		# This is being discussed in the following upstream issue:
+		# https://github.com/golang/go/issues/11090
 
-	[[ -n ${EVCS_UMASK} ]] && eumask_pop
-	export GOPATH="${WORKDIR}/${P}:${EGO_STORE_DIR}"
-	set -- mkdir -p "${WORKDIR}/${P}/src/${EGO_SRC}"
+		[[ -n ${EVCS_UMASK} ]] && eumask_pop
+	fi
+	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}"
+	"$@" || die "Unable to create ${WORKDIR}/${P}/src"
+	set -- cp -r	"${EGO_STORE_DIR}/src/${EGO_SRC}" \
+		"${WORKDIR}/${P}/src/${EGO_SRC%/*}"
 	echo "$@"
-	$@ || die "Unable to copy sources to ${WORKDIR}/${P}"
+	"$@" || die "Unable to copy sources to ${WORKDIR}/${P}"
 	return 0
 }
 

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-dev] golang-vcs.eclass updates
  2015-06-22 22:36 William Hubbs
@ 2015-06-23 18:26 ` William Hubbs
  0 siblings, 0 replies; 4+ messages in thread
From: William Hubbs @ 2015-06-23 18:26 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 476 bytes --]

On Mon, Jun 22, 2015 at 05:36:16PM -0500, William Hubbs wrote:
> All,
> 
> here are more non-api-breaking updates to golang-vcs.eclass:
> 
> 1. The GOPATH environment variable is now passed directly to the
> commands that need it.
> 2. The correct directory of source files is copied to the correct
> location under ${S}.
> 
> I'll post this as a patch since the eclass is in the tree.
> 
> Thanks,
> 
> William
> 

This is being committed now.

William


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-06-23 18:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-17 18:01 [gentoo-dev] golang-vcs.eclass updates William Hubbs
2015-06-18 15:23 ` William Hubbs
  -- strict thread matches above, loose matches on Subject: below --
2015-06-22 22:36 William Hubbs
2015-06-23 18:26 ` William Hubbs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox