diff mbox series

[meta] go-vendor.bbclass: Unpack into BP for destsuffix

Message ID 20260618213119.2495463-1-john.ripple@keysight.com
State New
Headers show
Series [meta] go-vendor.bbclass: Unpack into BP for destsuffix | expand

Commit Message

John Ripple June 18, 2026, 9:31 p.m. UTC
The go-vendor class has a hardcoded destsuffix variable used to unpack
sources fetched with the go_src_uri function. Change this unpack
location to take the base package name into account (BP) as is the new
standard.

Signed-off-by: John Ripple <john.ripple@keysight.com>
---
 meta/classes/go-vendor.bbclass | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Bruce Ashfield June 18, 2026, 9:33 p.m. UTC | #1
On Thu, Jun 18, 2026 at 5:31 PM John Ripple via lists.openembedded.org
<john.ripple=keysight.com@lists.openembedded.org> wrote:

> The go-vendor class has a hardcoded destsuffix variable used to unpack
> sources fetched with the go_src_uri function. Change this unpack
> location to take the base package name into account (BP) as is the new
> standard.
>

I have no particular issues with the change, but the commit log doesn't
tell us why this is needed. Was something breaking ? is there any risk
to the assumptions that other classes/recipes/layers may have made
about the location of the unpacked files ?

Bruce



>
> Signed-off-by: John Ripple <john.ripple@keysight.com>
> ---
>  meta/classes/go-vendor.bbclass | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/meta/classes/go-vendor.bbclass
> b/meta/classes/go-vendor.bbclass
> index 6ec6178add..f854d14bdf 100644
> --- a/meta/classes/go-vendor.bbclass
> +++ b/meta/classes/go-vendor.bbclass
> @@ -19,7 +19,7 @@ inherit go-mod
>  def go_src_uri(repo, version, path=None, subdir=None, \
>                  vcs='git', replaces=None, pathmajor=None):
>
> -    destsuffix = "git/src/import/vendor.fetch"
> +    destsuffix = "${BP}/src/import/vendor.fetch"
>      module_path = repo if not path else path
>
>      src_uri = "{}://{};name={}".format(vcs, repo,
> module_path.replace('/', '.'))
> @@ -58,7 +58,8 @@ python do_go_vendor() {
>      if not src_uri:
>          bb.fatal("SRC_URI is empty")
>
> -    default_destsuffix = "git/src/import/vendor.fetch"
> +    base_package = d.getVar('BP')
> +    default_destsuffix = "{}/src/import/vendor.fetch".format(base_package)
>      fetcher = bb.fetch2.Fetch(src_uri, d)
>      go_import = d.getVar('GO_IMPORT')
>      source_dir = d.getVar('S')
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#239109):
> https://lists.openembedded.org/g/openembedded-core/message/239109
> Mute This Topic: https://lists.openembedded.org/mt/119874754/1050810
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> bruce.ashfield@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
John Ripple June 18, 2026, 9:56 p.m. UTC | #2
> 
> I have no particular issues with the change, but the commit log doesn't
> tell us why this is needed. Was something breaking ? is there any risk
> to the assumptions that other classes/recipes/layers may have made
> about the location of the unpacked files ?
> 

The go-vendor class was unpacking dependencies to ${UNPACKDIR}/git
and then needed S = "${UNPACKDIR}/git" to find the dependencies.
Changing the S variable caused the do_qa_unpack() ( https://git.openembedded.org/openembedded-core/tree/meta/classes-global/insane.bbclass#n1450 ) from insane.bbclass
to throw an error.

There shouldn't be any other assumptions from other classes/recipes/layers
that have been broken. The recipes I tested this change against used sources
fetched using the go_src_uri() function, regular git fetching, and local files.
There weren't any issues with moving to the go dependencies to the new
location. As far as I know nothing in openembedded-core uses the go-vendor
class making it trickier to test against a known baseline.

John
Richard Purdie June 18, 2026, 10:06 p.m. UTC | #3
On Thu, 2026-06-18 at 14:56 -0700, John Ripple via lists.openembedded.org wrote:
> 
> 
> > I have no particular issues with the change, but the commit log doesn't
> > tell us why this is needed. Was something breaking ? is there any risk
> > to the assumptions that other classes/recipes/layers may have made
> > about the location of the unpacked files ?
> 
> The go-vendor class was unpacking dependencies to ${UNPACKDIR}/git
> and then needed S = "${UNPACKDIR}/git" to find the dependencies. 
> Changing the S variable caused the do_qa_unpack() from insane.bbclass
> to throw an error.
>  
> There shouldn't be any other assumptions from other classes/recipes/layers
> that have been broken. The recipes I tested this change against used sources
> fetched using the go_src_uri() function, regular git fetching, and local files.
> There weren't any issues with moving to the go dependencies to the new
> location. As far as I know nothing in openembedded-core uses the go-vendor
> class making it trickier to test against a known baseline.

It does sound a lot like we're missing some test cases as if I
understand it correctly, that class can't have worked for a while?

Cheers,

Richard
John Ripple June 18, 2026, 10:12 p.m. UTC | #4
> 
> It does sound a lot like we're missing some test cases as if I
> understand it correctly, that class can't have worked for a while?
> 

I've used the go-vendor class on Scarthgap and have only started to
look at it on Wrynose with the recent release. It would have thrown
an error since whenever the insane.bbclass explicitly denied setting
S = "${UNPACKDIR}/git". It's probably slipped under the radar
because nothing uses it in the core layers.

John
diff mbox series

Patch

diff --git a/meta/classes/go-vendor.bbclass b/meta/classes/go-vendor.bbclass
index 6ec6178add..f854d14bdf 100644
--- a/meta/classes/go-vendor.bbclass
+++ b/meta/classes/go-vendor.bbclass
@@ -19,7 +19,7 @@  inherit go-mod
 def go_src_uri(repo, version, path=None, subdir=None, \
                 vcs='git', replaces=None, pathmajor=None):
 
-    destsuffix = "git/src/import/vendor.fetch"
+    destsuffix = "${BP}/src/import/vendor.fetch"
     module_path = repo if not path else path
 
     src_uri = "{}://{};name={}".format(vcs, repo, module_path.replace('/', '.'))
@@ -58,7 +58,8 @@  python do_go_vendor() {
     if not src_uri:
         bb.fatal("SRC_URI is empty")
 
-    default_destsuffix = "git/src/import/vendor.fetch"
+    base_package = d.getVar('BP')
+    default_destsuffix = "{}/src/import/vendor.fetch".format(base_package)
     fetcher = bb.fetch2.Fetch(src_uri, d)
     go_import = d.getVar('GO_IMPORT')
     source_dir = d.getVar('S')