| Message ID | 20251113122806.16769-4-peter.marko@siemens.com |
|---|---|
| State | Accepted |
| Delegated to: | Steve Sakoman |
| Headers | show |
| Series | go tests backports | expand |
On 11/13/25 04:28, Peter Marko wrote: > From: Ross Burton <ross.burton@arm.com> > > Add a comment explaining what this function does and where the values > come from. > > If the architecture isn't know, instead of returning an empty string > which could fail mysteriously, raise a KeyError so it fails quickly. > > (From OE-Core rev: 025414c16319b068df1cd757ad9a3c987a6b871d) > > Signed-off-by: Ross Burton <ross.burton@arm.com> > Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> > Signed-off-by: Peter Marko <peter.marko@siemens.com> > --- > meta/lib/oe/go.py | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/meta/lib/oe/go.py b/meta/lib/oe/go.py > index dfd957d157a..4559dc63b28 100644 > --- a/meta/lib/oe/go.py > +++ b/meta/lib/oe/go.py > @@ -7,6 +7,10 @@ > import re > > def map_arch(a): > + """ > + Map our architecture names to Go's GOARCH names. > + See https://github.com/golang/go/blob/master/src/internal/syslist/syslist.go for the complete list. > + """ > if re.match('i.86', a): > return '386' > elif a == 'x86_64': > @@ -31,4 +35,4 @@ def map_arch(a): > return 'riscv64' > elif a == 'loongarch64': > return 'loong64' > - return '' > + raise KeyError(f"Cannot map architecture {a}") > > This was recently merged to scarthgap and unfortunately it breaks SOURCE_MIRROR_FETCH on architectures not supported by Go. This is easily reproduced: git clone https://git.yoctoproject.org/poky cd poky . oe-init-build-env Set MACHINE to qemuppc and set SOURCE_MIRROR_FETCH = "1" in local.conf bitbake --runonly fetch core-image-minimal WARNING: /home/robert/yocto/poky-scarthgap/meta/recipes-devtools/go/go-cross_1.22.12.bb: Exception during build_dependencies for GOARCH WARNING: /home/robert/yocto/poky-scarthgap/meta/recipes-devtools/go/go-cross_1.22.12.bb: Error during finalise of /home/robert/yocto/poky-scarthgap/meta/recipes-devtools/go/go-cross_1.22.12.bb ERROR: ExpansionError during parsing /home/robert/yocto/poky-scarthgap/meta/recipes-devtools/go/go-cross_1.22.12.bb bb.data_smart.ExpansionError: Failure expanding variable TARGET_GOARCH, expression was ${@go_map_arch(d.getVar('TARGET_ARCH'), d)} which triggered exception KeyError: 'Cannot map architecture powerpc' The variable dependency chain for the failure is: TARGET_GOARCH -> GOARCH ... Is there another way of using SOURCE_MIRROR_FETCH to avoid this? Or is reverting this reasonable? I realize we're probably one of the few remaining PowerPC users, but more generally it feels like parsing shouldn't be limited to whatever architectures Go happens to support. Thanks, Robert
This was already discussed, see https://lists.openembedded.org/g/openembedded-core/message/226846 Feel free to send a revert. Peter > -----Original Message----- > From: Robert Joslyn <robert.joslyn@redrectangle.org> > Sent: Tuesday, December 2, 2025 4:27 > To: Marko, Peter (FT D EU SK BFS1) <Peter.Marko@siemens.com>; > openembedded-core@lists.openembedded.org > Cc: Ross Burton <ross.burton@arm.com>; Richard Purdie > <richard.purdie@linuxfoundation.org> > Subject: Re: [OE-core][scarthgap][PATCH 3/9] lib/oe/go: document map_arch, > and raise an error on unknown architecture > > On 11/13/25 04:28, Peter Marko wrote: > > From: Ross Burton <ross.burton@arm.com> > > > > Add a comment explaining what this function does and where the values > > come from. > > > > If the architecture isn't know, instead of returning an empty string > > which could fail mysteriously, raise a KeyError so it fails quickly. > > > > (From OE-Core rev: 025414c16319b068df1cd757ad9a3c987a6b871d) > > > > Signed-off-by: Ross Burton <ross.burton@arm.com> > > Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> > > Signed-off-by: Peter Marko <peter.marko@siemens.com> > > --- > > meta/lib/oe/go.py | 6 +++++- > > 1 file changed, 5 insertions(+), 1 deletion(-) > > > > diff --git a/meta/lib/oe/go.py b/meta/lib/oe/go.py > > index dfd957d157a..4559dc63b28 100644 > > --- a/meta/lib/oe/go.py > > +++ b/meta/lib/oe/go.py > > @@ -7,6 +7,10 @@ > > import re > > > > def map_arch(a): > > + """ > > + Map our architecture names to Go's GOARCH names. > > + See https://github.com/golang/go/blob/master/src/internal/syslist/syslist.go > for the complete list. > > + """ > > if re.match('i.86', a): > > return '386' > > elif a == 'x86_64': > > @@ -31,4 +35,4 @@ def map_arch(a): > > return 'riscv64' > > elif a == 'loongarch64': > > return 'loong64' > > - return '' > > + raise KeyError(f"Cannot map architecture {a}") > > > > > > This was recently merged to scarthgap and unfortunately it breaks > SOURCE_MIRROR_FETCH on architectures not supported by Go. > > This is easily reproduced: > > git clone https://git.yoctoproject.org/poky > cd poky > . oe-init-build-env > Set MACHINE to qemuppc and set SOURCE_MIRROR_FETCH = "1" in local.conf > bitbake --runonly fetch core-image-minimal > > WARNING: > /home/robert/yocto/poky-scarthgap/meta/recipes-devtools/go/go- > cross_1.22.12.bb: > Exception during build_dependencies for GOARCH > WARNING: > /home/robert/yocto/poky-scarthgap/meta/recipes-devtools/go/go- > cross_1.22.12.bb: > Error during finalise of > /home/robert/yocto/poky-scarthgap/meta/recipes-devtools/go/go-cross_1.22.12.bb > ERROR: ExpansionError during parsing > /home/robert/yocto/poky-scarthgap/meta/recipes-devtools/go/go-cross_1.22.12.bb > bb.data_smart.ExpansionError: Failure expanding variable TARGET_GOARCH, > expression was ${@go_map_arch(d.getVar('TARGET_ARCH'), d)} which > triggered exception KeyError: 'Cannot map architecture powerpc' > The variable dependency chain for the failure is: TARGET_GOARCH -> GOARCH > ... > > > Is there another way of using SOURCE_MIRROR_FETCH to avoid this? Or is > reverting this reasonable? I realize we're probably one of the few > remaining PowerPC users, but more generally it feels like parsing > shouldn't be limited to whatever architectures Go happens to support. > > Thanks, > Robert
diff --git a/meta/lib/oe/go.py b/meta/lib/oe/go.py index dfd957d157a..4559dc63b28 100644 --- a/meta/lib/oe/go.py +++ b/meta/lib/oe/go.py @@ -7,6 +7,10 @@ import re def map_arch(a): + """ + Map our architecture names to Go's GOARCH names. + See https://github.com/golang/go/blob/master/src/internal/syslist/syslist.go for the complete list. + """ if re.match('i.86', a): return '386' elif a == 'x86_64': @@ -31,4 +35,4 @@ def map_arch(a): return 'riscv64' elif a == 'loongarch64': return 'loong64' - return '' + raise KeyError(f"Cannot map architecture {a}")