From 4f1655a24b702229f1549775d6b056f6a427a2ef Mon Sep 17 00:00:00 2001 From: Peter van Dijk Date: Thu, 19 Sep 2024 14:50:07 +0200 Subject: [PATCH] dnf sbom: use same logic for our version number too --- builder-support/helpers/generate-sbom-dnf.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/builder-support/helpers/generate-sbom-dnf.py b/builder-support/helpers/generate-sbom-dnf.py index ff6f53809c9b..4bb74d0cd702 100755 --- a/builder-support/helpers/generate-sbom-dnf.py +++ b/builder-support/helpers/generate-sbom-dnf.py @@ -132,7 +132,12 @@ def generateSBOM(packageName, additionalDeps): appName = packageName appInfos = getPackageInformations(pkgDB, packageName) component = { 'name': appName, 'bom-ref': 'pkg:' + appName, 'type': 'application'} - component['version'] = appInfos.version + + if appInfos.release: + component['version'] = (appInfos.version if appInfos.epoch == 0 else str(appInfos.epoch) + ':' + appInfos.version) + '-' + appInfos.release + else: + component['version'] = (appInfos.version if appInfos.epoch == 0 else str(appInfos.epoch) + ':' + appInfos.version) + component['supplier'] = {'name': appInfos.vendor if appInfos.vendor != '' else 'PowerDNS.COM BV', 'url': ['https://www.powerdns.com']} component['licenses'] = [{'license': {'id': licenseToSPDXIdentifier(appInfos.license)}}] depRelations['pkg:' + appName] = []