Skip to content

Commit

Permalink
Fix SBOM glibc and gcc version info
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Leonard <anleonar@redhat.com>
  • Loading branch information
andrew-m-leonard committed Aug 4, 2023
1 parent 8ffcab7 commit 1d376eb
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions sbin/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -923,14 +923,11 @@ addGLIBCforLinux() {
addSBOMMetadataTools "${javaHome}" "${classpath}" "${sbomJson}" "MUSL" "${MUSL_VERSION}"
else
# Get GLIBC from configured build spec.gmk sysroot and features.h definitions
cat /home/jenkins/workspace/build-scripts/jobs/jdk8u/jdk8u-linux-x64-temurin/workspace/build/src/build/linux-x86_64-normal-server-release/spec.gmk
# Get CC and SYSROOT_CFLAGS from the built build spec.gmk.
local CC=$(grep "^CC :=" ${BUILD_CONFIG[WORKSPACE_DIR]}/${BUILD_CONFIG[WORKING_DIR]}/${BUILD_CONFIG[OPENJDK_SOURCE_DIR]}/build/*/spec.gmk)
# Remove env=xx from CC, so we can call from bash to get __GLIBC.
CC=$(echo "$CC" | tr -s " " | cut -d" " -f3- | sed -E "s/[^ ]*=[^ ]*//g")
echo "$CC"
local SYSROOT_CFLAGS=$(grep "^SYSROOT_CFLAGS :=" ${BUILD_CONFIG[WORKSPACE_DIR]}/${BUILD_CONFIG[WORKING_DIR]}/${BUILD_CONFIG[OPENJDK_SOURCE_DIR]}/build/*/spec.gmk | tr -s " " | cut -d" " -f3-)
echo "#include <features.h>" | $CC $SYSROOT_CFLAGS -dM -E - 2>&1
local GLIBC_MAJOR=$(echo "#include <features.h>" | $CC $SYSROOT_CFLAGS -dM -E - 2>&1 | tr -s " " | grep "#define __GLIBC__" | cut -d" " -f3)
local GLIBC_MINOR=$(echo "#include <features.h>" | $CC $SYSROOT_CFLAGS -dM -E - 2>&1 | tr -s " " | grep "#define __GLIBC_MINOR__" | cut -d" " -f3)
local GLIBC_VERSION="${GLIBC_MAJOR}.${GLIBC_MINOR}"
Expand Down

0 comments on commit 1d376eb

Please sign in to comment.