Skip to content

Commit

Permalink
Classify cdx component type file
Browse files Browse the repository at this point in the history
Signed-off-by: Henri Rosten <[email protected]>
  • Loading branch information
henrirosten committed Dec 22, 2024
1 parent 86fb90f commit 584988e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/sbomnix/cdx.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,12 @@ def _cdx_component_add_patches(component, drv):
def _drv_to_cdx_component(drv, uid="store_path"):
"""Convert one entry from sbomdb (drv) to cdx component"""
component = {}
# Set the cdx component type based on the following heuristic:
# - Set the default component type to 'library'
# - Set the component type to 'file' if the drv version string is missing
component["type"] = "library"
if not drv.version:
component["type"] = "file"
component["bom-ref"] = getattr(drv, uid)
component["name"] = drv.pname
component["version"] = drv.version
Expand Down

0 comments on commit 584988e

Please sign in to comment.