summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@arm.com>2025-06-20 16:14:19 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-06-23 21:42:54 +0100
commit18319c08adf10e55a4c5acbb2d2d07e9e2b3ebf0 (patch)
tree718ffd1e33a7e4dc41c82ea5b9f4f2c255d610d0 /meta/lib
parent81ad1de523a3dec8651e7abbca8371f8ff6a1bd1 (diff)
downloadpoky-18319c08adf10e55a4c5acbb2d2d07e9e2b3ebf0.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) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oe/go.py6
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 @@
7import re 7import re
8 8
9def map_arch(a): 9def 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}")