[elbe-devel] [PATCH 1/8] elbepack: cyclonedx-sbom: simplify duplicate check
Thomas Weißschuh
thomas.weissschuh at linutronix.de
Fri Aug 30 09:10:08 CEST 2024
There is no reason to build the JSON twice and throw one of it away.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
elbepack/commands/cyclonedx-sbom.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/elbepack/commands/cyclonedx-sbom.py b/elbepack/commands/cyclonedx-sbom.py
index d0996ebbf1b1..8b2809b673c3 100644
--- a/elbepack/commands/cyclonedx-sbom.py
+++ b/elbepack/commands/cyclonedx-sbom.py
@@ -111,8 +111,9 @@ def run_command(argv):
source_file.node('initvmpkgs'),
):
# Duplicates are disallowed by the schema
- if _component_from_apt_pkg(XMLPackage(p)) not in formulation_components:
- formulation_components.append(_component_from_apt_pkg(XMLPackage(p)))
+ c = _component_from_apt_pkg(XMLPackage(p))
+ if c not in formulation_components:
+ formulation_components.append(c)
output = {
'bomFormat': 'CycloneDX',
--
2.46.0
More information about the elbe-devel
mailing list