diff --git a/build-recipe-livebuild b/build-recipe-livebuild index 2f4363d1b..7f34eba84 100644 --- a/build-recipe-livebuild +++ b/build-recipe-livebuild @@ -265,10 +265,9 @@ recipe_build_livebuild() { done for format in $(queryconfig --dist "$BUILD_DIST" --configdir "$CONFIG_DIR" --archpath "$BUILD_ARCH" buildflags+ sbom | sort -u) ; do - vendormacro=$(queryconfig --dist "$BUILD_DIST" --configdir "$CONFIG_DIR" --archpath "$BUILD_ARCH" eval %vendor || "") echo "Generating $format sbom file" pushd $BUILD_ROOT/$TOPDIR/$LIVEBUILD_ROOT >/dev/null - generate_sbom --format "$format" --vendor "$vendormacro" --dir "chroot" > "$BUILD_ROOT/$TOPDIR/OTHER/${RECIPEFILE%.livebuild}${buildnum}.${format/cyclonedx/cdx}.json" + generate_sbom --format "$format" --dir "chroot" > "$BUILD_ROOT/$TOPDIR/OTHER/${RECIPEFILE%.livebuild}${buildnum}.${format/cyclonedx/cdx}.json" popd >/dev/null pushd $BUILD_ROOT/$TOPDIR/OTHER >/dev/null /usr/bin/sha256sum "${RECIPEFILE%.livebuild}${buildnum}.${format/cyclonedx/cdx}.json" > "${RECIPEFILE%.livebuild}${buildnum}.${format/cyclonedx/cdx}.json".sh256 diff --git a/generate_sbom b/generate_sbom index c80efc814..1ed74901e 100755 --- a/generate_sbom +++ b/generate_sbom @@ -32,6 +32,7 @@ use File::Temp; use Digest::SHA; use Digest::MD5; +use Build; use Build::Rpm; use Build::Deb; use Build::SimpleJSON; @@ -637,6 +638,14 @@ sub spdx_encode_header { return $spdx; } +sub queryconfig { + my ($type, $param) = @_; + my $cf = Build::read_config_dist($::ENV{'BUILD_DIST'}, $::ENV{'BUILD_ARCH'}, $::ENV{'CONFIG_DIR'}); + if ($type eq 'eval') { + return Build::Rpm::expandmacros($cf, $param); + } +} + ################################################################################################## @@ -647,7 +656,7 @@ my $istar; my $distro; my $rpmmd; my $format; -my $vendorstring = ""; +my $vendorstring=queryconfig('eval','%vendor'); while (@ARGV && $ARGV[0] =~ /^-/) { my $opt = shift @ARGV; @@ -665,8 +674,6 @@ while (@ARGV && $ARGV[0] =~ /^-/) { $istar = 1; } elsif ($opt eq '--format') { $format = shift @ARGV; - } elsif ($opt eq '--vendor') { - $vendorstring = shift @ARGV; } elsif ($opt eq '--help') { echo_help(); exit(0); @@ -715,11 +722,6 @@ Supported content --container-archive CONTAINER_ARCHIVE An container providing a system -Optional parameters -=================== - - --vendor VENDOR - The vendor string to be set when deb packages are used. "; } die("usage: generate_sbom [--distro NAME] [--format spdx|cyclonedx] [--intoto] [--dir DIRECTORY]|[--product DIRECTORY]|[--rpmmd DIRECTORY]|[--container-archive CONTAINER_ARCHIVE]\n") unless @ARGV == 1;