diff mbox series

qemuboot: Fix build error if UNINATIVE_LOADER is unset

Message ID 20220209160248.1128131-1-zboszor@pr.hu
State New
Headers show
Series qemuboot: Fix build error if UNINATIVE_LOADER is unset | expand

Commit Message

Böszörményi Zoltán Feb. 9, 2022, 4:02 p.m. UTC
From: Zoltán Böszörményi <zboszor@gmail.com>

I got this error on current master:

File: 'exec_func_python() autogenerated', lineno: 2, function: <module>
     0001:
 *** 0002:do_write_qemuboot_conf(d)
     0003:
File: '.../layers/openembedded-core/meta/classes/qemuboot.bbclass', lineno: 141, function: do_write_qemuboot_conf
     0137:        else:
     0138:            val = d.getVar(k)
     0139:        # we only want to write out relative paths so that we can relocate images
     0140:        # and still run them
 *** 0141:        if val.startswith(topdir):
     0142:            val = os.path.relpath(val, finalpath)
     0143:        cf.set('config_bsp', k, '%s' % val)
     0144:
     0145:    # QB_DEFAULT_KERNEL's value of KERNEL_IMAGETYPE is the name of a symlink
Exception: AttributeError: 'NoneType' object has no attribute 'startswith'

Do nothing if "val" is None, which may happen for k = "UNINATIVE_LOADER".

Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
---
 meta/classes/qemuboot.bbclass | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/meta/classes/qemuboot.bbclass b/meta/classes/qemuboot.bbclass
index 229bd88527..755d49acd6 100644
--- a/meta/classes/qemuboot.bbclass
+++ b/meta/classes/qemuboot.bbclass
@@ -136,6 +136,8 @@  python do_write_qemuboot_conf() {
                                'qemu-helper-native/1.0-r1/recipe-sysroot-native/usr/bin/')
         else:
             val = d.getVar(k)
+        if val is None:
+            continue
         # we only want to write out relative paths so that we can relocate images
         # and still run them
         if val.startswith(topdir):