Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/2] package/go: set GOCACHE for download post-process
@ 2023-01-16 10:50 Peter Korsgaard
  2023-01-16 10:50 ` [Buildroot] [PATCH 2/2] package/go: explicitly set GOMODCACHE Peter Korsgaard
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Peter Korsgaard @ 2023-01-16 10:50 UTC (permalink / raw)
  To: buildroot; +Cc: Anisse Astier

The go mod vendor call in support/download/go-post-process accesses the go
cache, so pass GOCACHE= in the environment to ensure our cache directory is
used.

The go cache defaults to ~/.cache/go-build if not set, so this fixes builds
where that location (or GOCACHE if set in the environment) is not writable:

rm -rf ~/.cache/go-build
chmod -w ~/.cache
make docker-compose-source
..
failed to initialize build cache at /home/peko/.cache/go-build: mkdir /home/peko/.cache/go-build: permission denied
make[1]: *** [package/pkg-generic.mk:189: /home/peko/source/buildroot/output/build/docker-compose-2.14.0/.stamp_downloaded] Error 1

We use two different cache directories for target and host builds, but the
download/vendoring should be independent of the architecture, so use the
target variant even for host-only packages for simplicity.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
---
 package/go/go.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/go/go.mk b/package/go/go.mk
index d3ed07f03b..c4f72d403c 100644
--- a/package/go/go.mk
+++ b/package/go/go.mk
@@ -25,6 +25,7 @@ HOST_GO_COMMON_ENV = \
 	GOFLAGS=-mod=vendor \
 	GOROOT="$(HOST_GO_ROOT)" \
 	GOPATH="$(HOST_GO_GOPATH)" \
+	GOCACHE="$(HOST_GO_TARGET_CACHE)" \
 	GOPROXY=off \
 	PATH=$(BR_PATH) \
 	GOBIN= \
@@ -75,7 +76,6 @@ HOST_GO_TARGET_ENV = \
 	$(HOST_GO_COMMON_ENV) \
 	GOOS="linux" \
 	GOARCH=$(GO_GOARCH) \
-	GOCACHE="$(HOST_GO_TARGET_CACHE)" \
 	CC="$(TARGET_CC)" \
 	CXX="$(TARGET_CXX)" \
 	CGO_CFLAGS="$(TARGET_CFLAGS)" \
-- 
2.30.2

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2023-01-17  9:27 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-16 10:50 [Buildroot] [PATCH 1/2] package/go: set GOCACHE for download post-process Peter Korsgaard
2023-01-16 10:50 ` [Buildroot] [PATCH 2/2] package/go: explicitly set GOMODCACHE Peter Korsgaard
2023-01-16 20:30   ` Yann E. MORIN
2023-01-16 20:52     ` Peter Korsgaard
2023-01-16 20:38   ` Christian Stewart via buildroot
2023-01-16 20:55     ` Peter Korsgaard
2023-01-16 21:35       ` Christian Stewart via buildroot
2023-01-17  9:27   ` Peter Korsgaard
2023-01-16 20:26 ` [Buildroot] [PATCH 1/2] package/go: set GOCACHE for download post-process Yann E. MORIN
2023-01-16 20:36 ` Christian Stewart via buildroot
2023-01-16 20:56   ` Peter Korsgaard
2023-01-17  9:27 ` Peter Korsgaard

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