Skip to content

Commit

Permalink
Ensure SBOM build timestamp is set to the ACTUAL timestamp compiled i…
Browse files Browse the repository at this point in the history
…n from spec.gmk (#3846)

Signed-off-by: Andrew Leonard <anleonar@redhat.com>
  • Loading branch information
andrew-m-leonard authored Jun 12, 2024
1 parent f5e9369 commit d57edcf
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions sbin/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -748,18 +748,17 @@ executeTemplatedFile() {
fi

if [[ "${BUILD_CONFIG[OPENJDK_FEATURE_NUMBER]}" -ge 19 || "${BUILD_CONFIG[OPENJDK_FEATURE_NUMBER]}" -eq 17 ]]; then
if [ "${BUILD_CONFIG[RELEASE]}" == "true" ]; then
# Always get the "actual" buildTimestamp used in making openjdk
local specFile="./spec.gmk"
if [ -z "${BUILD_CONFIG[USER_OPENJDK_BUILD_ROOT_DIRECTORY]}" ] ; then
specFile="build/*/spec.gmk"
fi
# For "release" reproducible builds get openjdk timestamp used
# For reproducible builds get openjdk timestamp used in the spec.gmk file
local buildTimestamp=$(grep SOURCE_DATE_ISO_8601 ${specFile} | tr -s ' ' | cut -d' ' -f4)
# BusyBox doesn't use T Z iso8601 format
buildTimestamp="${buildTimestamp//T/ }"
buildTimestamp="${buildTimestamp//Z/}"
BUILD_CONFIG[BUILD_TIMESTAMP]="${buildTimestamp}"
fi
fi

# Restore exit behavior
Expand Down

0 comments on commit d57edcf

Please sign in to comment.