* [gentoo-dev] [PATCH 0/2] go-module.eclass cleanups
@ 2021-05-21 15:45 William Hubbs
2021-05-21 15:45 ` [gentoo-dev] [PATCH 1/2] go-module.eclass: fix GOPROXY export William Hubbs
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: William Hubbs @ 2021-05-21 15:45 UTC (permalink / raw
To: gentoo-dev; +Cc: robbat2, zmedico, William Hubbs
This is an improvement to my previous patch. It is a patch series now
because there are two separate changes:
- GOPROXY is exported in go-module_set_globals since it is not needed if
EGO_SUM is not set in the ebuild.
- go-module_setup_proxy is added. This function sets up the go proxy
directory so that dependencies can be read from it.
William Hubbs (2):
go-module.eclass: fix GOPROXY export
go-module.eclass: add go-module_setup_proxy function
eclass/go-module.eclass | 47 +++++++++++++++++++++++++++++++++++++++--
1 file changed, 45 insertions(+), 2 deletions(-)
--
2.26.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* [gentoo-dev] [PATCH 1/2] go-module.eclass: fix GOPROXY export
2021-05-21 15:45 [gentoo-dev] [PATCH 0/2] go-module.eclass cleanups William Hubbs
@ 2021-05-21 15:45 ` William Hubbs
2021-05-21 15:45 ` [gentoo-dev] [PATCH 2/2] go-module.eclass: add go-module_setup_proxy function William Hubbs
2021-05-25 18:31 ` [gentoo-dev] Re: [PATCH 0/2] go-module.eclass cleanups Zac Medico
2 siblings, 0 replies; 5+ messages in thread
From: William Hubbs @ 2021-05-21 15:45 UTC (permalink / raw
To: gentoo-dev; +Cc: robbat2, zmedico, William Hubbs
This variable should be exported in the go-module_set_globals function
since it is not needed unless EGO_SUM is used.
Signed-off-by: William Hubbs <williamh@gentoo.org>
---
eclass/go-module.eclass | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/eclass/go-module.eclass b/eclass/go-module.eclass
index c9a7ab12eaf..9d64ad48b43 100644
--- a/eclass/go-module.eclass
+++ b/eclass/go-module.eclass
@@ -232,6 +232,9 @@ go-module_set_globals() {
readonly EGO_SUM_SRC_URI
readonly _GOMODULE_GOSUM_REVERSE_MAP
+ # export the GOPROXY setting
+ export GOPROXY="file://${T}/go-proxy"
+
# Set the guard that we are safe
_GO_MODULE_SET_GLOBALS_CALLED=1
}
@@ -268,7 +271,7 @@ _go-module_src_unpack_gosum() {
die "go-module_set_globals must be called in global scope"
fi
- local goproxy_dir="${T}/go-proxy"
+ local goproxy_dir="${GOPROXY/file:\/\//}"
mkdir -p "${goproxy_dir}" || die
# For each Golang module distfile, look up where it's supposed to go, and
@@ -293,7 +296,6 @@ _go-module_src_unpack_gosum() {
unpack "$f"
fi
done
- export GOPROXY="file://${goproxy_dir}"
# Validate the gosum now
_go-module_src_unpack_verify_gosum
--
2.26.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [gentoo-dev] [PATCH 2/2] go-module.eclass: add go-module_setup_proxy function
2021-05-21 15:45 [gentoo-dev] [PATCH 0/2] go-module.eclass cleanups William Hubbs
2021-05-21 15:45 ` [gentoo-dev] [PATCH 1/2] go-module.eclass: fix GOPROXY export William Hubbs
@ 2021-05-21 15:45 ` William Hubbs
2021-05-25 18:31 ` [gentoo-dev] Re: [PATCH 0/2] go-module.eclass cleanups Zac Medico
2 siblings, 0 replies; 5+ messages in thread
From: William Hubbs @ 2021-05-21 15:45 UTC (permalink / raw
To: gentoo-dev; +Cc: robbat2, zmedico, William Hubbs
This function is to be used in an ebuild that uses EGO_SUM and defines
src_unpack.
Signed-off-by: William Hubbs <williamh@gentoo.org>
---
eclass/go-module.eclass | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/eclass/go-module.eclass b/eclass/go-module.eclass
index 9d64ad48b43..c11895944cd 100644
--- a/eclass/go-module.eclass
+++ b/eclass/go-module.eclass
@@ -239,6 +239,47 @@ go-module_set_globals() {
_GO_MODULE_SET_GLOBALS_CALLED=1
}
+# @FUNCTION: go-module_setup_proxy
+# @DESCRIPTION:
+# If your ebuild redefines src_unpack and uses EGO_SUM you need to call
+# this function in src_unpack.
+# It sets up the go module proxy in the appropriate location.
+go-module_setup_proxy() {
+ # shellcheck disable=SC2120
+ debug-print-function "${FUNCNAME}" "$@"
+
+ if [[ ! ${_GO_MODULE_SET_GLOBALS_CALLED} ]]; then
+ die "go-module_set_globals must be called in global scope"
+ fi
+
+ local goproxy_dir="${GOPROXY/file:\/\//}"
+ mkdir -p "${goproxy_dir}" || die
+
+ # For each Golang module distfile, look up where it's supposed to go and
+ # symlink it into place.
+ local f
+ local goproxy_mod_dir
+ for f in ${A}; do
+ goproxy_mod_path="${_GOMODULE_GOSUM_REVERSE_MAP["${f}"]}"
+ if [[ -n "${goproxy_mod_path}" ]]; then
+ debug-print-function "Populating go proxy for ${goproxy_mod_path}"
+ # Build symlink hierarchy
+ goproxy_mod_dir=$( dirname "${goproxy_dir}"/"${goproxy_mod_path}" )
+ mkdir -p "${goproxy_mod_dir}" || die
+ ln -sf "${DISTDIR}"/"${f}" "${goproxy_dir}/${goproxy_mod_path}" ||
+ die "Failed to ln"
+ local v=${goproxy_mod_path}
+ v="${v%.mod}"
+ v="${v%.zip}"
+ v="${v//*\/}"
+ _go-module_gosum_synthesize_files "${goproxy_mod_dir}" "${v}"
+ fi
+ done
+
+ # Validate the gosum now
+ _go-module_src_unpack_verify_gosum
+}
+
# @FUNCTION: go-module_src_unpack
# @DESCRIPTION:
# If EGO_SUM is set, unpack the base tarball(s) and set up the
--
2.26.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [gentoo-dev] Re: [PATCH 0/2] go-module.eclass cleanups
2021-05-21 15:45 [gentoo-dev] [PATCH 0/2] go-module.eclass cleanups William Hubbs
2021-05-21 15:45 ` [gentoo-dev] [PATCH 1/2] go-module.eclass: fix GOPROXY export William Hubbs
2021-05-21 15:45 ` [gentoo-dev] [PATCH 2/2] go-module.eclass: add go-module_setup_proxy function William Hubbs
@ 2021-05-25 18:31 ` Zac Medico
2021-05-26 0:43 ` William Hubbs
2 siblings, 1 reply; 5+ messages in thread
From: Zac Medico @ 2021-05-25 18:31 UTC (permalink / raw
To: William Hubbs, gentoo-dev; +Cc: robbat2, zmedico
[-- Attachment #1.1: Type: text/plain, Size: 738 bytes --]
On 5/21/21 8:45 AM, William Hubbs wrote:
> This is an improvement to my previous patch. It is a patch series now
> because there are two separate changes:
>
> - GOPROXY is exported in go-module_set_globals since it is not needed if
> EGO_SUM is not set in the ebuild.
>
> - go-module_setup_proxy is added. This function sets up the go proxy
> directory so that dependencies can be read from it.
>
> William Hubbs (2):
> go-module.eclass: fix GOPROXY export
> go-module.eclass: add go-module_setup_proxy function
>
> eclass/go-module.eclass | 47 +++++++++++++++++++++++++++++++++++++++--
> 1 file changed, 45 insertions(+), 2 deletions(-)
>
This series looks great to me! Thank you!
--
Thanks,
Zac
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 981 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [gentoo-dev] Re: [PATCH 0/2] go-module.eclass cleanups
2021-05-25 18:31 ` [gentoo-dev] Re: [PATCH 0/2] go-module.eclass cleanups Zac Medico
@ 2021-05-26 0:43 ` William Hubbs
0 siblings, 0 replies; 5+ messages in thread
From: William Hubbs @ 2021-05-26 0:43 UTC (permalink / raw
To: gentoo-dev; +Cc: robbat2, zmedico
[-- Attachment #1: Type: text/plain, Size: 867 bytes --]
On Tue, May 25, 2021 at 11:31:17AM -0700, Zac Medico wrote:
> On 5/21/21 8:45 AM, William Hubbs wrote:
> > This is an improvement to my previous patch. It is a patch series now
> > because there are two separate changes:
> >
> > - GOPROXY is exported in go-module_set_globals since it is not needed if
> > EGO_SUM is not set in the ebuild.
> >
> > - go-module_setup_proxy is added. This function sets up the go proxy
> > directory so that dependencies can be read from it.
> >
> > William Hubbs (2):
> > go-module.eclass: fix GOPROXY export
> > go-module.eclass: add go-module_setup_proxy function
> >
> > eclass/go-module.eclass | 47 +++++++++++++++++++++++++++++++++++++++--
> > 1 file changed, 45 insertions(+), 2 deletions(-)
> >
>
> This series looks great to me! Thank you!
This series is committed.
Thanks,
William
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-05-26 0:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-21 15:45 [gentoo-dev] [PATCH 0/2] go-module.eclass cleanups William Hubbs
2021-05-21 15:45 ` [gentoo-dev] [PATCH 1/2] go-module.eclass: fix GOPROXY export William Hubbs
2021-05-21 15:45 ` [gentoo-dev] [PATCH 2/2] go-module.eclass: add go-module_setup_proxy function William Hubbs
2021-05-25 18:31 ` [gentoo-dev] Re: [PATCH 0/2] go-module.eclass cleanups Zac Medico
2021-05-26 0:43 ` William Hubbs
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox