diff options
| author | Ross Burton <ross.burton@arm.com> | 2025-11-13 13:28:00 +0100 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2025-11-26 07:50:35 -0800 |
| commit | 6707dcecb23666e96d9ab1dc568f58bf2cd35aad (patch) | |
| tree | 11c2672b15814a9ac243f451ca0263f5bbbf39b4 /meta/lib | |
| parent | cac0ff2d909accc77ff350f1adf2f1486865ff4b (diff) | |
| download | poky-6707dcecb23666e96d9ab1dc568f58bf2cd35aad.tar.gz | |
lib/oe/go: document map_arch, and raise an error on unknown architecture
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)
(From OE-Core rev: e6de433ccb2784581d6c775cce97f414ef9334b1)
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>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'meta/lib')
| -rw-r--r-- | meta/lib/oe/go.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/meta/lib/oe/go.py b/meta/lib/oe/go.py index dfd957d157..4559dc63b2 100644 --- a/meta/lib/oe/go.py +++ b/meta/lib/oe/go.py | |||
| @@ -7,6 +7,10 @@ | |||
| 7 | import re | 7 | import re |
| 8 | 8 | ||
| 9 | def map_arch(a): | 9 | def map_arch(a): |
| 10 | """ | ||
| 11 | Map our architecture names to Go's GOARCH names. | ||
| 12 | See https://github.com/golang/go/blob/master/src/internal/syslist/syslist.go for the complete list. | ||
| 13 | """ | ||
| 10 | if re.match('i.86', a): | 14 | if re.match('i.86', a): |
| 11 | return '386' | 15 | return '386' |
| 12 | elif a == 'x86_64': | 16 | elif a == 'x86_64': |
| @@ -31,4 +35,4 @@ def map_arch(a): | |||
| 31 | return 'riscv64' | 35 | return 'riscv64' |
| 32 | elif a == 'loongarch64': | 36 | elif a == 'loongarch64': |
| 33 | return 'loong64' | 37 | return 'loong64' |
| 34 | return '' | 38 | raise KeyError(f"Cannot map architecture {a}") |
