]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
image_types: catch exception if no CONVERSION_CMD is defined
authorBELHADJ SALEM Talel <bhstalel@gmail.com>
Fri, 17 Apr 2026 23:54:22 +0000 (00:54 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 20 Apr 2026 16:58:37 +0000 (17:58 +0100)
When new conversion type is defined, BitBake assumes
that CONVERSION_CMD: is defined for the type, so it gets
the variable which returns NoneType if it is not defined.

That generates the following exception which may not be clear
for some:

--
ERROR: /../techleef-image.bb: Error executing a python function in <code>:

The stack trace of python calls that resulted in this exception/failure was:
File: '<code>', lineno: 16, function: <module>
     0012:__anon_117__.._recipe_populate_sdk_base_bbclass(d)
     0013:__anon_427__.._recipe_populate_sdk_base_bbclass(d)
     0014:__anon_131__.._recipe_image_bbclass(d)
     0015:__anon_187__.._recipe_image_bbclass(d)
 *** 0016:__anon_535__.._recipe_image_bbclass(d)
     0017:__anon_44__.._recipe_rootfs_ipk_bbclass(d)
     0018:__anon_191__.._recipe_siteinfo_bbclass(d)
     0019:__anon_17__.._recipe_license_image_bbclass(d)
     0020:__anon_206__.._recipe_image_types_wic_bbclass(d)
File: '/../image.bbclass', lineno: 501, function: __anon_535__.._recipe_image_bbclass
     0497:                    if original_type not in alltypes:
     0498:                        rm_tmp_images.add(localdata.expand("${IMAGE_NAME}.${type}"))
     0499:
     0500:        for bt in basetypes[t]:
 *** 0501:            gen_conversion_cmds(bt)
     0502:
     0503:        localdata.setVar('type', realt)
     0504:        if t not in alltypes:
     0505:            rm_tmp_images.add(localdata.expand("${IMAGE_NAME}.${type}"))
File: '/../image.bbclass', lineno: 490, function: gen_conversion_cmds
     0486:                        type = type[8:]
     0487:                    # Create input image first.
     0488:                    gen_conversion_cmds(type)
     0489:                    localdata.setVar('type', type)
 *** 0490:                    cmd = "\t" + localdata.getVar("CONVERSION_CMD:" + ctype)
     0491:                    if cmd not in cmds:
     0492:                        cmds.append(cmd)
     0493:                    vardeps.add('CONVERSION_CMD:' + ctype)
     0494:                    subimage = type + "." + ctype
Exception: TypeError: can only concatenate str (not "NoneType") to str

ERROR: Parsing halted due to errors, see error messages above
--

Fail with human readable error if no CONVERSION_CMD is defined for
any defined subtype.

Signed-off-by: Talel BELHAJ SALEM <bhstalel@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes-recipe/image_types.bbclass

index e6ef0ce11e40c0f8388fb5547ab03943004bde2f..326602d960b5e0fbc86c4d8773ff3b9d5f5d2982 100644 (file)
@@ -44,6 +44,10 @@ def imagetypes_getdepends(d):
                 deprecated.add(var)
 
         for ctype in resttypes:
+            ctype_cmd = d.getVar('CONVERSION_CMD:' + ctype)
+            if not ctype_cmd:
+                bb.fatal('No CONVERSION_CMD defined for subtype "%s"'
+                         ' - possibly invalid conversion type name or missing support class' % ctype)
             adddep(d.getVar("CONVERSION_DEPENDS_%s" % ctype), deps)
             adddep(d.getVar("COMPRESS_DEPENDS_%s" % ctype), deps)