fix(bitbake): resolve layer misidentification with deepest match#1755
Open
bd-spratikbharti wants to merge 2 commits into
Open
fix(bitbake): resolve layer misidentification with deepest match#1755bd-spratikbharti wants to merge 2 commits into
bd-spratikbharti wants to merge 2 commits into
Conversation
- Match deepest folder in path instead of first occurrence - Validate against authoritative show-recipes source - Add comprehensive test coverage
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes Yocto/BitBake layer identification when recipe paths contain parent directories that collide with known layer names, ensuring the detector selects the correct (deepest) layer and avoids dropping components into an empty BOM.
Changes:
- Update
GraphNodeLabelParserto select the deepest (rightmost) matching layer path segment vialastIndexOf. - Validate the path-parsed layer against
bitbake-layers show-recipesresults inBitbakeDependencyGraphTransformer, falling back to the authoritative layer when invalid. - Expand
GraphNodeLabelParserTestwith multiple collision/determinism scenarios.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| detectable/src/main/java/com/blackduck/integration/detectable/detectables/bitbake/parse/GraphNodeLabelParser.java | Switches layer matching to deepest/rightmost path match to avoid parent-folder collisions. |
| detectable/src/main/java/com/blackduck/integration/detectable/detectables/bitbake/transform/BitbakeDependencyGraphTransformer.java | Validates parsed layer against show-recipes output and falls back when invalid. |
| detectable/src/test/java/com/blackduck/integration/detectable/detectables/bitbake/unit/GraphNodeLabelParserTest.java | Adds unit tests for collision cases and deterministic parsing behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Prevent crash on empty layer lists, validate graph layer against authoritative source, and cover new fallback paths in tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Summary
wrlinux).lastIndexOf) instead of first (indexOf) to identify the correct layer.bitbake-layers show-recipesoutput before accepting.Details
When recipe paths contained directories whose names matched known layer names, the detector previously matched the first occurrence instead of the actual layer directory.
Example
Path:
/wrlinux/layers/meta/recipes/zlib.bbwrlinux(parent directory) → failed validation → BOM emptymeta(actual layer) → validation passes → BOM populatedLayer Identification Process
bitbake-layers show-recipes(authoritative source).show-recipes.Impact