[yocto-autobuilder-helper][PATCH 04/11] scripts/utils: add getconfigdict() for dict-type config values
[email protected] Thu, 7 May 2026 18:25:33 -0700
| Newsgroups | org.yoctoproject.lists.yocto,org.yoctoproject.lists.yocto-patches |
|---|---|
| Message-ID | <d85e765060f18251c2072ad3d1cb12219a2b0085.1778202125.git.tim.orling@konsulko.com> |
From: Tim Orling <[email protected]> Parallel to getconfiglist(), but for JSON object values. The merge priority is defaults < target-level < step-level so that more-specific keys win: a step can override individual entries in a target-level dict without replacing the whole thing, and both levels refine the defaults. Used by the upcoming CONTAINER_IMAGES support, where each entry maps a Yocto recipe name (the on-disk OCI path stem) to an image name (the name pushed to the container registry). AI-Generated: Claude Cowork Sonnet 4.6 Signed-off-by: Tim Orling <[email protected]> --- scripts/utils.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scripts/utils.py b/scripts/utils.py index ea905d9..112ebc2 100644 --- a/scripts/utils.py +++ b/scripts/utils.py @@ -112,6 +112,21 @@ def getconfiglist(name, config, target, stepnum): ret.extend(config['defaults'][name]) return expandresult(ret, config) +# Get a build configuration dict, merging defaults < target < step so that +# more-specific entries win (step-level keys override target-level, which +# override defaults). +def getconfigdict(name, config, target, stepnum): + ret = {} + step = "step" + str(stepnum) + if name in config['defaults']: + ret.update(config['defaults'][name]) + if target in config['overrides']: + if name in config['overrides'][target]: + ret.update(config['overrides'][target][name]) + if step in config['overrides'][target] and name in config['overrides'][target][step]: + ret.update(config['overrides'][target][step][name]) + return expandresult(ret, config) + # Return only unique configuration values (identified with '=' in them) def getconfiglistfilter(name, config, target, stepnum): def merge(main, newvals): -- 2.43.0