Skip to content

Commit 5fe2218

Browse files
committed
sbom: add multiple pkgbase if they match
We have multiple packages with the same CPE, and since we now have multiple components with the same name they get merged by grype into one, which means each SBOM component can point to multiple pkgbase values.
1 parent da03cb0 commit 5fe2218

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

msys2_devtools/sbom.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,12 @@ def get_component_key(component: Component) -> str:
176176
return (component.name, component.version, component.purl, cpe_key)
177177

178178
for component in src_bom.components:
179+
assert isinstance(component, Component)
179180
key = get_component_key(component)
180-
properties[key] = component.properties
181+
if key not in properties:
182+
properties[key] = component.properties
183+
else:
184+
properties[key].update(component.properties)
181185

182186
with open(args.target_sbom, "r", encoding="utf-8") as h:
183187
target_bom: Bom = Bom.from_json(json.loads(h.read()))

0 commit comments

Comments
 (0)