Skip to contentSkip to conversation

xen: avoid parse time errors for non-xen-archs

PATCH In review Christopher Larson 2 participants 2 messages Mar 16, 2015 – Mar 17, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen: avoid parse time errors for non-xen-archs

XEN_TARGET_ARCH, when expanded, would emit a bb.error(). Referencing XEN_TARGET_ARCH in PACKAGECONFIG resulted in its expansion at the up front parse time, rather than at compile time, so non-xen-supported-archs like powerpc would see parse time errors, resulting in non-zero bitbake exit codes.

Naturally this isn't ideal, so instead have the mapping function return 'INVALID' in the unsupported case, and in anonymous python, raise SkipPackage if the mapped architecture is invalid, so it's seen as unbuildable in that case.

---
 recipes-extended/xen/xen-arch.inc | 2 +-
 recipes-extended/xen/xen.inc      | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)
recipes-extended/xen/xen-arch.inc +1 -1
index bcf9f54..fb0093e 100644
@@ -14,5 +14,5 @@ def map_xen_arch(a, d):
     elif re.match("aarch64.*", a):   return "arm64"
     elif a in valid_archs:           return a
     else:
-        bb.error("cannot map '%s' to a xen architecture" % a)
+        return "INVALID"
 
recipes-extended/xen/xen.inc +5 -0
index 0e4136a..432bf4d 100644
@@ -663,6 +663,11 @@ export STAGING_LIBDIR
 export XEN_TARGET_ARCH = "${@map_xen_arch(d.getVar('TARGET_ARCH', True), d)}"
 export XEN_COMPILE_ARCH = "${@map_xen_arch(d.getVar('BUILD_ARCH', True), d)}"
 
+python () {
+    if d.getVar('XEN_TARGET_ARCH', True) == 'INVALID':
+        raise bb.parse.SkipPackage('Cannot map `%s` to a xen architecture' % d.getVar('TARGET_ARCH', True))
+}
+
 # hardcoded as Linux, as the only compatible hosts are Linux.
 export XEN_OS = "Linux"
 
Signature · 1 line
2.2.1
#1 lore raw
Quoted 9 lines · Christopher Larson

XEN_TARGET_ARCH, when expanded, would emit a bb.error(). Referencing XEN_TARGET_ARCH in PACKAGECONFIG resulted in its expansion at the up front parse time, rather than at compile time, so non-xen-supported-archs like powerpc would see parse time errors, resulting in non-zero bitbake exit codes.

Naturally this isn't ideal, so instead have the mapping function return 'INVALID' in the unsupported case, and in anonymous python, raise SkipPackage if the mapped architecture is invalid, so it's seen as unbuildable in that case.

Looks good to me.

merged.

Bruce

Quoted 42 lines
---
 recipes-extended/xen/xen-arch.inc | 2 +-
 recipes-extended/xen/xen.inc      | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)
recipes-extended/xen/xen-arch.inc +1 -1
index bcf9f54..fb0093e 100644
@@ -14,5 +14,5 @@ def map_xen_arch(a, d):
     elif re.match("aarch64.*", a):   return "arm64"
     elif a in valid_archs:           return a
     else:
-        bb.error("cannot map '%s' to a xen architecture" % a)
+        return "INVALID"
 
recipes-extended/xen/xen.inc +5 -1
index 0e4136a..432bf4d 100644
@@ -663,6 +663,11 @@ export STAGING_LIBDIR
 export XEN_TARGET_ARCH = "${@map_xen_arch(d.getVar('TARGET_ARCH', True), d)}"
 export XEN_COMPILE_ARCH = "${@map_xen_arch(d.getVar('BUILD_ARCH', True), d)}"
 
+python () {
+    if d.getVar('XEN_TARGET_ARCH', True) == 'INVALID':
+        raise bb.parse.SkipPackage('Cannot map `%s` to a xen architecture' % d.getVar('TARGET_ARCH', True))
+}
+
 # hardcoded as Linux, as the only compatible hosts are Linux.
 export XEN_OS = "Linux"
 
--

2.2.1

--
_______________________________________________
meta-virtualization mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/meta-virtualization

Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end"