| Message ID | 20261203153920.419088-1-andre.draszik@linaro.org |
|---|---|
| State | Under Review |
| Headers | show |
| Series | checklayer: fix show-layers regex in add_layers() | expand |
diff --git a/scripts/lib/checklayer/__init__.py b/scripts/lib/checklayer/__init__.py index 5fc2ef7058..3166593e10 100644 --- a/scripts/lib/checklayer/__init__.py +++ b/scripts/lib/checklayer/__init__.py @@ -228,7 +228,7 @@ def add_layers(bblayersconf, layers, logger): # Don't add a layer that is already present. added = set() output = check_command('Getting existing layers failed.', 'bitbake-layers show-layers').decode('utf-8') - for layer, path, pri in re.findall(r'^(\S+) +([^\n]*?) +(\d+)$', output, re.MULTILINE): + for layer, path, version in re.findall(r'^(\S+) +([^\n]*?) +(\d+)(?: +[^\n]*)?$', output, re.MULTILINE): added.add(path) with open(bblayersconf, 'a+') as f:
add_layers() parses `bitbake-layers show-layers` with `r'^(\S+) +([^\n]*?) +(\d+)$'`, which expects the old three-column `layer path priority` output and fails to match any layer after BitBake switched `show-layers` to `layer path version depends` (bitbake commit 4bca2d0ea404, "bblayers: Switch to use layerdata and new format layers"). Even layers without dependencies fail to match because `version` is left-justified with trailing spaces. As a result, calling add_layers() repeatedly appends duplicate BBLAYERS entries and triggers `ERROR: LAYERNAME ... is used by both ...`. Match the new two-space-delimited columns, making the trailing depends column optional and requiring at least two spaces between columns so single-space paths and diagnostic lines are not misparsed. Tested against synthetic show-layers lines (empty, trimmed, and versioned depends, paths with spaces, long names/paths, and NOTE/WARNING lines) and via repeated add_layers() / add_layer_dependencies() calls against a fresh build directory. Fixes: cb771198c206 ("checklayer: Update for layer format changes and removal of collections") AI-Generated: Uses Gemini Signed-off-by: André Draszik <andre.draszik@linaro.org> --- scripts/lib/checklayer/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)