public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: Talel BELHAJ SALEM <bhstalel@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: Talel BELHAJ SALEM <bhstalel@gmail.com>
Subject: [PATCH] image_types: catch exception if no CONVERSION_CMD is defined
Date: Sat, 18 Apr 2026 00:54:22 +0100	[thread overview]
Message-ID: <20260417235422.838481-1-bhstalel@gmail.com> (raw)

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>
---
 meta/classes-recipe/image_types.bbclass | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/meta/classes-recipe/image_types.bbclass b/meta/classes-recipe/image_types.bbclass
index e6ef0ce11e..326602d960 100644
--- a/meta/classes-recipe/image_types.bbclass
+++ b/meta/classes-recipe/image_types.bbclass
@@ -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)
 
-- 
2.43.0



             reply	other threads:[~2026-04-17 23:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-17 23:54 Talel BELHAJ SALEM [this message]
2026-04-21  4:49 ` [OE-core] [PATCH] image_types: catch exception if no CONVERSION_CMD is defined Khem Raj
2026-04-21  6:19   ` Talel BELHADJ SALEM

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260417235422.838481-1-bhstalel@gmail.com \
    --to=bhstalel@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox