From: hazen2215 <hazen2215@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] [RFC] optionally set GOPROXY, GOSUMDB when building go packages
Date: Sat, 06 Jul 2024 17:52:29 +0200 [thread overview]
Message-ID: <20240706155229.567FA290B7@inbox.vuxu.org> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-43668@inbox.vuxu.org>
[-- Attachment #1: Type: text/plain, Size: 1529 bytes --]
There is an updated pull request by hazen2215 against master on the void-packages repository
https://github.com/hazen2215/void-packages XBPS_GOPROXY
https://github.com/void-linux/void-packages/pull/43668
[RFC] optionally set GOPROXY, GOSUMDB when building go packages
<!-- Uncomment relevant sections and delete options which are not applicable -->
<!-- #### Testing the changes -->
- I tested the changes in this PR: **YES**
This will allow xbps-src to set environment variable `GOPROXY` and `GOSUMDB` when building go packages.
When `GOPROXY` is set to `direct`, it pulls modules from source repositories like github and `git` and `mercurial` needs to be in `hostmakedepends`.
<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->
<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
- aarch64-musl
- armv7l
- armv6l-musl
-->
A patch file from https://github.com/void-linux/void-packages/pull/43668.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-XBPS_GOPROXY-43668.patch --]
[-- Type: text/x-diff, Size: 2640 bytes --]
From cac46be56ff65fade8ca2ed58678215a836413da Mon Sep 17 00:00:00 2001
From: hazen2215 <haz@disroot.org>
Date: Sat, 29 Apr 2023 17:33:50 +0900
Subject: [PATCH] xbps-src: optionally set GOPROXY, GOSUMDB when building go
packages.
---
common/environment/build-style/go.sh | 8 ++++++--
etc/defaults.conf | 11 +++++++++++
xbps-src | 2 +-
3 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/common/environment/build-style/go.sh b/common/environment/build-style/go.sh
index 223bba83ff11b4..6ed9188d8e442a 100644
--- a/common/environment/build-style/go.sh
+++ b/common/environment/build-style/go.sh
@@ -17,6 +17,10 @@ else
fi
fi
+case "$XBPS_GOPROXY" in
+ *direct*) hostmakedepends+=" chroot-git mercurial" ;;
+esac
+
case "$XBPS_TARGET_MACHINE" in
aarch64*) export GOARCH=arm64;;
armv5*) export GOARCH=arm; export GOARM=5;;
@@ -41,8 +45,8 @@ export CGO_LDFLAGS="$LDFLAGS"
export CGO_ENABLED="${CGO_ENABLED:-1}"
export GO111MODULE=auto
export GOTOOLCHAIN="${GOTOOLCHAIN:-local}"
-export GOPROXY="https://proxy.golang.org,direct"
-export GOSUMDB="sum.golang.org"
+export GOPROXY="${XBPS_GOPROXY:-https://proxy.golang.org,direct}"
+export GOSUMDB="${XBPS_GOSUMDB:-sum.golang.org}"
case "$XBPS_TARGET_MACHINE" in
*-musl) export GOCACHE="${XBPS_HOSTDIR}/gocache-muslc" ;;
diff --git a/etc/defaults.conf b/etc/defaults.conf
index f70e4ea3d0067e..2a8cf14d6adacf 100644
--- a/etc/defaults.conf
+++ b/etc/defaults.conf
@@ -165,3 +165,14 @@ XBPS_SUCMD="sudo /bin/sh -c"
# This can also be set or exported as a regular environment variable.
#
#XBPS_UPDATE_CHECK_VERBOSE=yes
+
+# [OPTIONAL]
+# Set the environment variable 'GOPROXY' when building go packages.
+# When set to 'direct', will download modules directly from source repositories
+#XBPS_GOPROXY=direct
+
+# [OPTIONAL]
+# Set the environment variable 'GOSUMDB' when building go packages.
+# When set to 'off', will disable querying for module checksum which is
+# undefined in go.sum.
+#XBPS_GOSUMDB=off
diff --git a/xbps-src b/xbps-src
index f8c21b3b92738d..d852536f051a26 100755
--- a/xbps-src
+++ b/xbps-src
@@ -696,7 +696,7 @@ export XBPS_SHUTILSDIR XBPS_CROSSPFDIR XBPS_TRIGGERSDIR \
XBPS_LIBEXECDIR XBPS_DISTDIR XBPS_DISTFILES_MIRROR XBPS_ALLOW_RESTRICTED \
XBPS_USE_GIT_COMMIT_DATE XBPS_PKG_COMPTYPE XBPS_REPO_COMPTYPE \
XBPS_BUILDHELPERDIR XBPS_USE_BUILD_MTIME XBPS_BUILD_ENVIRONMENT \
- XBPS_PRESERVE_PKGS XBPS_IGNORE_BROKENNESS
+ XBPS_PRESERVE_PKGS XBPS_IGNORE_BROKENNESS XBPS_GOPROXY XBPS_GOSUMDB
for i in REPOSITORY DESTDIR BUILDDIR SRCDISTDIR; do
eval val="\$XBPS_$i"
next prev parent reply other threads:[~2024-07-06 15:52 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-29 9:16 [PR PATCH] " hazen2215
2023-04-29 9:18 ` classabbyamp
2023-04-29 9:21 ` classabbyamp
2023-04-29 9:33 ` [PR PATCH] [Updated] " hazen2215
2023-04-29 9:49 ` hazen2215
2023-04-29 9:49 ` hazen2215
2023-04-29 9:49 ` hazen2215
2023-04-29 9:50 ` hazen2215
2023-04-29 9:50 ` hazen2215
2023-04-29 9:52 ` hazen2215
2023-04-29 10:15 ` classabbyamp
2023-04-29 11:03 ` ahesford
2023-04-29 11:07 ` hazen2215
2023-04-29 11:20 ` hazen2215
2023-07-29 1:48 ` github-actions
2023-07-29 3:22 ` [PR PATCH] [Updated] " hazen2215
2023-08-23 22:17 ` hazen2215
2023-11-22 1:47 ` github-actions
2023-11-22 2:47 ` [PR PATCH] [Updated] " hazen2215
2024-01-05 1:57 ` hazen2215
2024-04-05 1:45 ` github-actions
2024-04-05 2:34 ` [PR PATCH] [Updated] " hazen2215
2024-07-05 1:49 ` github-actions
2024-07-06 11:10 ` [PR PATCH] [Updated] " hazen2215
2024-07-06 15:34 ` [PR REVIEW] " classabbyamp
2024-07-06 15:52 ` hazen2215 [this message]
2024-07-06 15:58 ` hazen2215
2024-10-05 1:58 ` github-actions
2024-10-05 9:28 ` [PR PATCH] [Updated] " hazen2215
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240706155229.567FA290B7@inbox.vuxu.org \
--to=hazen2215@users.noreply.github.com \
--cc=ml@inbox.vuxu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).