Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] [RFC] optionally set GOPROXY, GOSUMDB when building go packages
@ 2023-04-29  9:16 hazen2215
  2023-04-29  9:18 ` classabbyamp
                   ` (20 more replies)
  0 siblings, 21 replies; 22+ messages in thread
From: hazen2215 @ 2023-04-29  9:16 UTC (permalink / raw)
  To: ml

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

There is a new 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**|**briefly**|**NO**

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` 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: 2513 bytes --]

From fe5f4dc95fc947ae0119ff7d62058c1341d7db54 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 |  6 ++++++
 etc/defaults.conf                    | 11 +++++++++++
 xbps-src                             |  2 +-
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/common/environment/build-style/go.sh b/common/environment/build-style/go.sh
index 68f88c6dbee8..be12a172c52c 100644
--- a/common/environment/build-style/go.sh
+++ b/common/environment/build-style/go.sh
@@ -17,6 +17,10 @@ else
 	fi
 fi
 
+if [ "$XBPS_GOPROXY" = direct ]; then
+	hostmakedepends+=" git"
+fi
+
 case "$XBPS_TARGET_MACHINE" in
 	aarch64*) export GOARCH=arm64;;
 	armv5*) export GOARCH=arm; export GOARM=5;;
@@ -39,6 +43,8 @@ export CGO_CXXFLAGS="$CXXFLAGS"
 export CGO_LDFLAGS="$LDFLAGS"
 export CGO_ENABLED="${CGO_ENABLED:-1}"
 export GO111MODULE=auto
+export GOPROXY="$XBPS_GOPROXY"
+export GOSUMDB="$XBPS_GOSUMDB"
 case "$XBPS_TARGET_MACHINE" in
 	*-musl) export GOCACHE="${XBPS_HOSTDIR}/gocache-muslc" ;;
 	*)	export GOCACHE="${XBPS_HOSTDIR}/gocache-glibc" ;;
diff --git a/etc/defaults.conf b/etc/defaults.conf
index f70e4ea3d006..2a8cf14d6ada 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 cdb5f8c6d643..96c7562a5798 100755
--- a/xbps-src
+++ b/xbps-src
@@ -665,7 +665,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"

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

end of thread, other threads:[~2024-04-05  2:34 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-29  9:16 [PR PATCH] [RFC] optionally set GOPROXY, GOSUMDB when building go packages 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

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).