Skip to content

Commit f397101

Browse files
committed
Revert "sbom: work around grype matching unrelated packages with CPEs only"
This reverts commit 151044c. This was fixed with grype 0.91.2
1 parent 759d243 commit f397101

File tree

2 files changed

+1
-24
lines changed

2 files changed

+1
-24
lines changed

msys2_devtools/sbom.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,7 @@ def generate_components(value) -> list[Component]:
6565
for cpe in cpes:
6666
name, version = parse_cpe(cpe)[2:4]
6767
assert isinstance(version, str) and isinstance(name, str)
68-
# https://github.com/anchore/grype/issues/2618
69-
cpe_properties = properties + [Property(name="syft:package:type", value="binary")]
70-
component = Component(name=name, version=version, cpe=cpe, properties=cpe_properties)
68+
component = Component(name=name, version=version, cpe=cpe, properties=properties)
7169
components.append(component)
7270

7371
for purl in purls:

tests/test_sbom.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -58,24 +58,3 @@ def test_generate_components():
5858
assert components[0].version == "1.2.3"
5959
assert components[0].purl is None
6060
assert components[0].cpe == "cpe:/a:djangoproject:django:1.2.3"
61-
62-
63-
def test_grype_workaround():
64-
# https://github.com/anchore/grype/issues/2618
65-
srcinfo = {"mingw32": "pkgbase = foo\npkgver = 42"}
66-
components = generate_components({"srcinfo": srcinfo, "extra": {"references": [
67-
"cpe: cpe:/a:djangoproject:django:1.2.3"
68-
]}})
69-
for property in components[0].properties:
70-
if property.name == "syft:package:type":
71-
assert property.value == "binary"
72-
break
73-
else:
74-
assert False, "syft:package:type property not found"
75-
76-
components = generate_components({"srcinfo": srcinfo, "extra": {"references": [
77-
"purl: pkg:pypi/django"
78-
]}})
79-
assert all(
80-
property.name != "syft:package:type" for property in components[0].properties
81-
), "syft:package:type property should not be present"

0 commit comments

Comments
 (0)