[openwrt/openwrt] build: fix version info in cyclonedx sbom

LEDE Commits lede-commits at lists.infradead.org
Sat May 25 10:27:48 PDT 2024


hauke pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/d8939ff2d5daac4eb3ff932f38ea9d63e091697a

commit d8939ff2d5daac4eb3ff932f38ea9d63e091697a
Author: Akshay Bhat <nodeax at gmail.com>
AuthorDate: Fri Apr 19 11:26:45 2024 -0700

    build: fix version info in cyclonedx sbom
    
    Prior e8725a932e16eaf6ec51add8c084d959cbe32ff2, version used to be
    VERSION:=$(PKG_VERSION)-$(PKG_RELEASE)
    After e8725a932e16eaf6ec51add8c084d959cbe32ff2, the version is:
    VERSION:=$(PKG_VERSION)-r$(PKG_RELEASE)
    
    Hence the gen_*_cyclonedxsbom functions need to be updated to remove
    the trailing -r prefix in the version in order to generate correct
    version info in the SBOM.
    
    Signed-off-by: Akshay Bhat <nodeax at gmail.com>
---
 scripts/package-metadata.pl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/package-metadata.pl b/scripts/package-metadata.pl
index 2c7d3c624b..1e47052ba0 100755
--- a/scripts/package-metadata.pl
+++ b/scripts/package-metadata.pl
@@ -722,7 +722,7 @@ sub gen_image_cyclonedxsbom() {
 		if ($image_packages{$name}) {
 			$version = $image_packages{$name};
 		}
-		$version =~ s/-\d+$// if $version;
+		$version =~ s/-r\d+$// if $version;
 		if ($name =~ /^(kernel|kmod-)/ and $version =~ /^(\d+\.\d+\.\d+)/) {
 			$version = $1;
 		}
@@ -775,7 +775,7 @@ sub gen_package_cyclonedxsbom() {
 		}
 
 		my $version = $pkg->{version};
-		$version =~ s/-\d+$// if $version;
+		$version =~ s/-r\d+$// if $version;
 		if ($name =~ /^(kernel|kmod-)/ and $version =~ /^(\d+\.\d+\.\d+)/) {
 			$version = $1;
 		}




More information about the lede-commits mailing list