From: Christian Lindeberg <christli@axis.com>
To: <openembedded-core@lists.openembedded.org>
Subject: [PATCH v2] go-mod.bbclass: Set GO_MOD_CACHE_DIR
Date: Fri, 13 Sep 2024 09:29:58 +0200 [thread overview]
Message-ID: <20240913072958.2099199-1-christli@axis.com> (raw)
From: Christian Lindeberg <christian.lindeberg@axis.com>
Set the GO_MOD_CACHE_DIR variable and move the location of the module
cache to enable the use of the go module fetchers for downloading and
unpacking module dependencies to the module cache.
Also, clean out the module cache before unpacking.
Signed-off-by: Christian Lindeberg <christian.lindeberg@axis.com>
---
Changes in V2:
- Fix assumption on S regarding the number of directory levels below
WORKDIR. Suggested by Peter Kjellerstedt.
meta/classes-recipe/go-mod.bbclass | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/meta/classes-recipe/go-mod.bbclass b/meta/classes-recipe/go-mod.bbclass
index ca3a690d05..2083d7f2d1 100644
--- a/meta/classes-recipe/go-mod.bbclass
+++ b/meta/classes-recipe/go-mod.bbclass
@@ -22,9 +22,9 @@ GOBUILDFLAGS:append = " -modcacherw"
inherit go
+export GOMODCACHE = "${S}/pkg/mod"
+GO_MOD_CACHE_DIR = "${@os.path.relpath(d.getVar('GOMODCACHE'), d.getVar('WORKDIR'))}"
+do_unpack[cleandirs] += "${GOMODCACHE}"
+
GO_WORKDIR ?= "${GO_IMPORT}"
do_compile[dirs] += "${B}/src/${GO_WORKDIR}"
-
-export GOMODCACHE = "${B}/.mod"
-
-do_compile[cleandirs] += "${B}/.mod"
--
2.39.2
reply other threads:[~2024-09-13 7:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20240913072958.2099199-1-christli@axis.com \
--to=christli@axis.com \
--cc=openembedded-core@lists.openembedded.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