From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38DC7FA3724 for ; Fri, 13 Sep 2024 07:52:39 +0000 (UTC) Subject: Re: [PATCH] go-mod.bbclass: Set GO_MOD_CACHE_DIR To: openembedded-core@lists.openembedded.org From: "Christian Lindeberg" X-Originating-Location: =?UTF-8?B?THVuZCwgU2vDpW5lIENvdW50eSwgU0U=?= (195.60.68.152) X-Originating-Platform: Linux Chrome 127 User-Agent: GROUPS.IO Web Poster MIME-Version: 1.0 Date: Fri, 13 Sep 2024 00:52:28 -0700 References: In-Reply-To: Message-ID: <14967.1726213948941593452@lists.openembedded.org> Content-Type: multipart/alternative; boundary="yuEmruagyHGmmYle3li9" List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 13 Sep 2024 07:52:39 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/204473 --yuEmruagyHGmmYle3li9 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Thu, Sep 12, 2024 at 07:01 PM, Jose Quaresma wrote: >=20 > Hi Christian, >=20 > Christian Lindeberg via lists.openembedded.org ( > http://lists.openembedded.org ) > escreveu (quinta, 12/09/2024 =C3=A0(s) 15:30): >=20 >> From: Christian Lindeberg < christian.lindeberg@axis.com > >>=20 >> 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 module >> dependencies. >> Also, clean out the module cache before unpacking. >>=20 >> Signed-off-by: Christian Lindeberg < christian.lindeberg@axis.com > >> --- >> meta/classes-recipe/go-mod.bbclass | 8 ++++---- >> 1 file changed, 4 insertions(+), 4 deletions(-) >>=20 >> diff --git a/meta/classes-recipe/go-mod.bbclass >> b/meta/classes-recipe/go-mod.bbclass >> index ca3a690d05..71a6712c47 100644 >> --- a/meta/classes-recipe/go-mod.bbclass >> +++ b/meta/classes-recipe/go-mod.bbclass >> @@ -22,9 +22,9 @@ GOBUILDFLAGS:append =3D " -modcacherw" >>=20 >> inherit go >>=20 >> +GO_MOD_CACHE_DIR ?=3D "${@os.path.join(os.path.basename(d.getVar('S')), >> 'pkg/mod')}" >> +export GOMODCACHE =3D "${@os.path.join(os.path.dirname(d.getVar('S')), >> d.getVar('GO_MOD_CACHE_DIR'))}" >=20 >=20 > Using the default [1] bitbake=C2=A0S =3D "${WORKDIR}/${BP}" config, I thi= nk this > will be equal=C2=A0to: >=20 > GO_MOD_CACHE_DIR ?=3D "${BP}/pkg/mod" > export GOMODCACHE =3D "${WORKDIR}/${BP}/pkg/mod" >=20 > in the end this can be written as: >=20 > export GOMODCACHE=C2=A0?=3D "${S}/pkg/mod" >=20 > Is it correct or am I seeing something wrong? >=20 Correct, I sent a new version with this and the suggestion from Peter Kjell= erstedt. Thanks, Christian >=20 >=20 > [1] https://github.com/openembedded/openembedded-core/blob/40d2fbece1c2f6= ecf62bffa44ad37850e90268cb/meta/conf/bitbake.conf#L405C6-L405C16 >=20 >=20 > Jose >=20 >=20 >> +do_unpack[cleandirs] +=3D "${GOMODCACHE}" >> + >> GO_WORKDIR ?=3D "${GO_IMPORT}" >> do_compile[dirs] +=3D "${B}/src/${GO_WORKDIR}" >> - >> -export GOMODCACHE =3D "${B}/.mod" >> - >> -do_compile[cleandirs] +=3D "${B}/.mod" >> -- >> 2.39.2 >>=20 >>=20 >>=20 >>=20 >=20 >=20 >=20 >=20 > -- > Best regards, >=20 > Jos=C3=A9 Quaresma > --yuEmruagyHGmmYle3li9 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable
On Thu, Sep 12, 2024 at 07:01 PM, Jose Quaresma wrote:
Hi Christian,

Christian Lindeberg via lists.openembedded.org <christian.linde= berg=3Daxis.com@lists.op= enembedded.org> escreveu (quinta, 12/09/2024 à(s) 15:30):
From: Christian Lindeberg &l= t;christian.lindeberg@axis.com>

Set the GO_MOD_CA= CHE_DIR variable and move the location of the module
cache to enable t= he use of the go module fetchers for module
dependencies.
Also, c= lean out the module cache before unpacking.

Signed-off-by: Chris= tian Lindeberg <christian.lindeberg@axis.com>
---<= br /> meta/classes-recipe/go-mod.bbclass | 8 ++++----
 1 fil= e changed, 4 insertions(+), 4 deletions(-)

diff --git a/meta/cla= sses-recipe/go-mod.bbclass b/meta/classes-recipe/go-mod.bbclass
index = ca3a690d05..71a6712c47 100644
--- a/meta/classes-recipe/go-mod.bbclass=
+++ b/meta/classes-recipe/go-mod.bbclass
@@ -22,9 +22,9 @@ GOBUI= LDFLAGS:append =3D " -modcacherw"

 inherit go

+G= O_MOD_CACHE_DIR ?=3D "${@os.path.join(os.path.basename(d.getVar('S')), 'pkg= /mod')}"
+export GOMODCACHE =3D "${@os.path.join(os.path.dirname(d.get= Var('S')), d.getVar('GO_MOD_CACHE_DIR'))}"
 
Using the default [1] bitbake S =3D "${WORKDIR}/${BP}" config, I = think this will be equal to:
 
GO_MOD_CACHE_DIR ?=3D "${BP}/pkg/mod"
export GOMODCACHE =3D "${WORKDIR}/${BP}/pkg/mod"
 
in the end this can be written as:

export GOMODCACHE ?=3D "${S}/pkg/mod"

Is it correct or am I seeing something wrong?
Correct, I sent a new version with this and the suggestion from Peter Kjell= erstedt.
 
Thanks,
Christian

 
 
Jose
 
+do_unpack[cleandirs] +=3D "= ${GOMODCACHE}"
+
 GO_WORKDIR ?=3D "${GO_IMPORT}"
 = do_compile[dirs] +=3D "${B}/src/${GO_WORKDIR}"
-
-export GOMODCAC= HE =3D "${B}/.mod"
-
-do_compile[cleandirs] +=3D "${B}/.mod"
--
2.39.2




 
--
Best regards,

José Quaresma
--yuEmruagyHGmmYle3li9--