Skip to content

Commit

Permalink
Fix treatment of BUILD_METADATA
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
Reviewed-by: Todd Short <[email protected]>
(Merged from openssl#19815)
  • Loading branch information
levitte committed Dec 8, 2022
1 parent 084d3af commit 83a5bd8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
3 changes: 3 additions & 0 deletions NOTES-NONSTOP.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'
)
Expand Down
4 changes: 4 additions & 0 deletions dev/release-aux/release-version-fn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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" <<EOF
MAJOR=$MAJOR
MINOR=$MINOR
Expand Down
20 changes: 12 additions & 8 deletions dev/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -354,11 +354,11 @@ fi
set_version

if [ -n "$PRE_LABEL" ]; then
release="$VERSION-$PRE_RELEASE_TAG$BUILD_METADATA"
release_text="$SERIES$BUILD_METADATA $PRE_LABEL $PRE_NUM"
release="$VERSION$_PRE_RELEASE_TAG$_BUILD_METADATA"
release_text="$SERIES$_BUILD_METADATA $PRE_LABEL $PRE_NUM"
announce_template=openssl-announce-pre-release.tmpl
else
release="$VERSION$BUILD_METADATA"
release="$VERSION$_BUILD_METADATA"
release_text="$release"
announce_template=openssl-announce-release.tmpl
fi
Expand Down Expand Up @@ -458,10 +458,10 @@ prev_release_date="$RELEASE_DATE"
next_release_state "$next_method2"
set_version

release="$VERSION-$PRE_RELEASE_TAG$BUILD_METADATA"
release_text="$VERSION$BUILD_METADATA"
release="$VERSION$_PRE_RELEASE_TAG$_BUILD_METADATA"
release_text="$VERSION$_BUILD_METADATA"
if [ -n "$PRE_LABEL" ]; then
release_text="$SERIES$BUILD_METADATA $PRE_LABEL $PRE_NUM"
release_text="$SERIES$_BUILD_METADATA $PRE_LABEL $PRE_NUM"
fi
$VERBOSE "== Updated version information to $release"

Expand Down Expand Up @@ -494,8 +494,8 @@ if $do_branch; then
next_release_state "minor"
set_version

release="$VERSION-$PRE_RELEASE_TAG$BUILD_METADATA"
release_text="$SERIES$BUILD_METADATA"
release="$VERSION$_PRE_RELEASE_TAG$_BUILD_METADATA"
release_text="$SERIES$_BUILD_METADATA"
$VERBOSE "== Updated version information to $release"

$VERBOSE "== Updating files for $release :"
Expand Down Expand Up @@ -803,6 +803,10 @@ found in the tar file of a regular release.
=back
=item B<BUILD_METADATA>
Extra build metadata to be used by anyone for their own purposes.
=item B<RELEASE_DATE>
This is normally empty in the git workspace, but should always have the
Expand Down
1 change: 1 addition & 0 deletions util/mktar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 83a5bd8

Please sign in to comment.