From 83a5bd80708adc6726deac390e405a7b50dec540 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Fri, 2 Dec 2022 06:59:58 +0100 Subject: [PATCH] Fix treatment of BUILD_METADATA According to documentation [^1], the BUILD_METADATA from VERSION.dat should be prefixed with a plus sign when used. It is given this treatment in Configure, but not in all other scripts that use VERSION.dat directly. This change fixes that. Reviewed-by: Paul Dale Reviewed-by: Tomas Mraz Reviewed-by: Todd Short (Merged from https://github.com/openssl/openssl/pull/19815) --- NOTES-NONSTOP.md | 3 +++ dev/release-aux/release-version-fn.sh | 4 ++++ dev/release.sh | 20 ++++++++++++-------- util/mktar.sh | 1 + 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/NOTES-NONSTOP.md b/NOTES-NONSTOP.md index 586fbabef0..627843babf 100644 --- a/NOTES-NONSTOP.md +++ b/NOTES-NONSTOP.md @@ -186,6 +186,9 @@ following variables: if [ -n "$PRE_RELEASE_TAG" ]; then PRE_RELEASE_TAG="-$PRE_RELEASE_TAG" fi + if [ -n "$BUILD_METADATA" ]; then + BUILD_METADATA="+$BUILD_METADATA" + fi echo "$MAJOR.$MINOR.$PATCH$PRE_RELEASE_TAG$BUILD_METADATA" |\ sed -e 's/[-.+]/_/g' ) diff --git a/dev/release-aux/release-version-fn.sh b/dev/release-aux/release-version-fn.sh index e9e1ac3850..b924fad8c0 100644 --- a/dev/release-aux/release-version-fn.sh +++ b/dev/release-aux/release-version-fn.sh @@ -54,6 +54,9 @@ get_version () { -e 's|^dev$|0|' \ -e 's|^alpha([0-9]+)(-(dev))?$|\1|' \ -e 's|^beta([0-9]+)(-(dev))?$|\1|' ) + _BUILD_METADATA='' + if [ -n "$PRE_RELEASE_TAG" ]; then _PRE_RELEASE_TAG="-${PRE_RELEASE_TAG}"; fi + if [ -n "$BUILD_METADATA" ]; then _BUILD_METADATA="+${BUILD_METADATA}"; fi } # $1 is one of "alpha", "beta", "final", "", or "minor" @@ -102,6 +105,7 @@ set_version () { PRE_RELEASE_TAG="$PRE_LABEL$PRE_NUM" ;; esac + if [ -n "$PRE_RELEASE_TAG" ]; then _PRE_RELEASE_TAG="-${PRE_RELEASE_TAG}"; fi cat > "$SOURCEDIR/VERSION.dat" < + +Extra build metadata to be used by anyone for their own purposes. + =item B This is normally empty in the git workspace, but should always have the diff --git a/util/mktar.sh b/util/mktar.sh index 06a1f92150..353ff716d3 100755 --- a/util/mktar.sh +++ b/util/mktar.sh @@ -12,6 +12,7 @@ HERE=`dirname $0` . $HERE/../VERSION.dat if [ -n "$PRE_RELEASE_TAG" ]; then PRE_RELEASE_TAG=-$PRE_RELEASE_TAG; fi +if [ -n "$BUILD_METADATA" ]; then BUILD_METADATA=+$BUILD_METADATA; fi version=$MAJOR.$MINOR.$PATCH$PRE_RELEASE_TAG$BUILD_METADATA basename=openssl