Emit dependency info from Conan v1 lock files #3019
Merged
+383
−31
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.
Problem Statement
When
cdxgenparsesconan.lockfiles, the resultant document's/dependenciessection is left empty. This pull request adjusts processing ofconan.lockfiles (produced by Conan v1) so that:conan.lockare translated to dependencies between components in resultant SBOM fileconan.lockwas generated) are translated to dependencies of the automatically created parent componentSample Output Diff
SBOM for conan.lock based on Conanfile with 3 installed packages
Summary of Changes
parseConanLockDatainlib/helpers/utils.jsnow returns an object of return values instead of just the package list (tried to do this in a similar way to how other package managers seem to be doing this in the same file).bom-refdependenciesbetween components whosebom-refis known, or for the parent component which always has a node key of"0"and which cannot be translated to a pURLbuild_requiresattribute of lock nodes, in addition to justrequirescreateCppBominlib/cli/index.jsupdated to accept new return type ofparseConanLockDataand to pipe the new outputs into the generated BOM file.parseConanLockDataupdated wrt/ new return type and new information extracted from existing test files.parse conan dataextended with two new test data files.conan-v1-for-reference.lockwas created by runningconan lock create --referenceand demonstrates a lock file where all packages can be translated to a component with Conan pURLconan-v1-with-nested-deps.lockwas created by runningconan lock createon a Conanfile with three root packages and demonstrates a lock file where the component"0"cannot be translated to a component with Conan pURL and its dependency nodes are therefore propagated to the parent component