diff mbox series

bitbake-setup: handle dict entries in oe-fragments

Message ID 20260707163424.678708-1-fabien.lehoussel@smile.fr
State New
Headers show
Series bitbake-setup: handle dict entries in oe-fragments | expand

Commit Message

Fabien Lehoussel July 7, 2026, 4:34 p.m. UTC
The setup-schema allows oe-fragments entries to be either plain
strings or dicts with 'name'/'description' keys, and choose_fragments()
already accepts both forms for oe-fragments-one-of options. But
setup_bitbake_build() joins the oe-fragments list as-is, so only the
plain string form works:

  "oe-fragments": [
      "distro/poky",
      "core/yocto/sbom-cve-check"
  ]

while a configuration using the dict form, e.g.:

  "oe-fragments": [
      { "name": "distro/poky", "description": "Yocto reference distro" },
      { "name": "core/yocto/sbom-cve-check", "description": "Enable SBOM CVE checking" }
  ]

crashes the setup with:

  TypeError: sequence item 0: expected str instance, dict found

Normalize the entries to fragment names before enabling them.

AI-Generated: Uses Claude Sonnet

Signed-off-by: Fabien Lehoussel <fabien.lehoussel@smile.fr>
---
 bin/bitbake-setup | 2 ++
 1 file changed, 2 insertions(+)

Comments

Alexander Kanavin July 7, 2026, 4:53 p.m. UTC | #1
On Tue, 7 Jul 2026 at 18:34, Fabien Lehoussel via
lists.openembedded.org
<fabien.lehoussel=smile.fr@lists.openembedded.org> wrote:
>      fragments = bitbake_config.get("oe-fragments", []) + sorted(bitbake_config.get("oe-fragment-choices",{}).values())
> +    # oe-fragments entries can be strings or dicts with 'name'/'description' keys
> +    fragments = [f["name"] if isinstance(f, dict) else f for f in fragments]

This should only fix up oe-fragments, and then concatenate with the
choices. Doing the 'fixing' over the complete final list may work ok,
but it is odd logically, as it creates a point in the code flow where
that list contains inconsistent entries.

Alex
diff mbox series

Patch

diff --git a/bin/bitbake-setup b/bin/bitbake-setup
index b81d3ad11..4f1cf7ad3 100755
--- a/bin/bitbake-setup
+++ b/bin/bitbake-setup
@@ -387,6 +387,8 @@  def setup_bitbake_build(bitbake_config, layerdir, setupdir, thisdir, update_bb_c
     workspace_file = os.path.join(setupdir, "bitbake.code-workspace")
     shell = "bash"
     fragments = bitbake_config.get("oe-fragments", []) + sorted(bitbake_config.get("oe-fragment-choices",{}).values())
+    # oe-fragments entries can be strings or dicts with 'name'/'description' keys
+    fragments = [f["name"] if isinstance(f, dict) else f for f in fragments]
     if fragments:
         bb.process.run("{} -c '. {} && bitbake-config-build enable-fragment {}'".format(shell, init_script, " ".join(fragments)))