[meta-virtualization] [PATCH 1/2] go-osarchmap: Skip golang recipes for unsupported architectures

Paul Barker paul at paulbarker.me.uk
Sun Jan 1 14:21:19 PST 2017


Building any recipe for a mips-based machine like arduino-yun currently leads
to errors in go_map_arch(). Instead, errors should only be raised if a recipe
which uses golang is built. This is achieved using the same error handling seen
in recipes-extended/xen.

Signed-off-by: Paul Barker <paul at paulbarker.me.uk>
---
 classes/go-osarchmap.bbclass | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/classes/go-osarchmap.bbclass b/classes/go-osarchmap.bbclass
index 4e00c7b..303b30b 100644
--- a/classes/go-osarchmap.bbclass
+++ b/classes/go-osarchmap.bbclass
@@ -11,6 +11,11 @@ TARGET_GOARM = "${@go_map_arm(d.getVar('TARGET_ARCH', True), d.getVar('TUNE_FEAT
 TARGET_GOTUPLE = "${TARGET_GOOS}_${TARGET_GOARCH}"
 GO_BUILD_BINDIR = "${@['bin/${HOST_GOTUPLE}','bin'][d.getVar('BUILD_GOTUPLE',True) == d.getVar('HOST_GOTUPLE',True)]}"
 
+python() {
+    if d.getVar('TARGET_GOARCH') == 'INVALID':
+        raise bb.parse.SkipPackage('Cannot map `%s` to a go architecture' % d.getVar('TARGET_ARCH', True))
+}
+
 def go_map_arch(a, d):
     import re
     if re.match('i.86', a):
@@ -24,7 +29,7 @@ def go_map_arch(a, d):
     elif re.match('p(pc|owerpc)(|64)', a):
         return 'powerpc'
     else:
-        bb.error("cannot map '%s' to a Go architecture" % a)
+        return 'INVALID'
 
 def go_map_arm(a, f, d):
     import re
-- 
2.1.4



More information about the meta-virtualization mailing list