]>
git.ipfire.org Git - thirdparty/openssl.git/blob - dev/release-aux/release-version-fn.sh
2 # Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.
4 # Licensed under the Apache License 2.0 (the "License"). You may not use
5 # this file except in compliance with the License. You can obtain a copy
6 # in the file LICENSE in the source distribution or at
7 # https://www.openssl.org/source/license.html
9 # These functions load, manipulate and store the current version information
10 # for OpenSSL 3.0 and on.
11 # They are meant to be minimalistic for easy refactoring depending on OpenSSL
14 # Version information is stored in the following variables:
16 # |MAJOR|, |MINOR|, |PATCH| are the three parts of a version number.
17 # |MAJOR| is to be increased for new major releases, |MINOR| for new
18 # minor releases, and |PATCH| for update releases.
20 # |SERIES| tells what release series the current version belongs to, and
21 # is composed from |MAJOR| and |MINOR|.
22 # |VERSION| tells what the current version is, and is composed from |MAJOR|,
23 # |MINOR| and |PATCH|.
24 # |TYPE| tells what state the source is in. It may have an empty value
25 # for released source, or 'dev' for "in development".
26 # |PRE_LABEL| may be "alpha" or "beta" to signify an ongoing series of
27 # alpha or beta releases. |PRE_NUM| is a pre-release counter for the
28 # alpha and beta release series, but isn't necessarily strictly tied
29 # to the prerelease label.
31 # Scripts loading this file are not allowed to manipulate these
32 # variables directly. They must use functions such as fixup_version()
33 # below, or next_release_state(), found in release-state-fn.sh.
35 # These functions depend on |SOURCEDIR|, which must have the intended
36 # OpenSSL source directory as value.
39 eval $
(git cat-file blob HEAD
:VERSION.dat
)
40 VERSION
="$MAJOR.$MINOR.$PATCH"
41 SERIES
="$MAJOR.$MINOR"
42 TYPE
=$
( echo "$PRE_RELEASE_TAG" \
45 -e 's|^alpha([0-9]+)(-(dev))?$|\3|' \
46 -e 's|^beta([0-9]+)(-(dev))?$|\3|' )
47 PRE_LABEL
=$
( echo "$PRE_RELEASE_TAG" \
50 -e 's|^alpha([0-9]+)(-(dev))?$|alpha|' \
51 -e 's|^beta([0-9]+)(-(dev))?$|beta|' )
52 PRE_NUM
=$
( echo "$PRE_RELEASE_TAG" \
55 -e 's|^alpha([0-9]+)(-(dev))?$|\1|' \
56 -e 's|^beta([0-9]+)(-(dev))?$|\1|' )
59 # $1 is one of "alpha", "beta", "final", "", or "minor"
65 if [ "$new_label" != "$PRE_LABEL" ]; then
66 PRE_LABEL
="$new_label"
68 elif [ "$TYPE" = 'dev' ]; then
69 PRE_NUM
=$
(expr $PRE_NUM + 1)
73 if [ "$TYPE" = 'dev' ]; then
74 PATCH
=$
(expr $PATCH + 1)
80 if [ "$TYPE" = 'dev' ]; then
81 MINOR
=$
(expr $MINOR + 1)
89 VERSION
="$MAJOR.$MINOR.$PATCH"
90 SERIES
="$MAJOR.$MINOR"
94 case "$TYPE+$PRE_LABEL+$PRE_NUM" in
96 PRE_RELEASE_TAG
="$TYPE"
99 PRE_RELEASE_TAG
="$PRE_LABEL$PRE_NUM-dev"
102 PRE_RELEASE_TAG
="$PRE_LABEL$PRE_NUM"
105 cat > "$SOURCEDIR/VERSION.dat" <<EOF
109 PRE_RELEASE_TAG=$PRE_RELEASE_TAG
110 BUILD_METADATA=$BUILD_METADATA
111 RELEASE_DATE="$RELEASE_DATE"
112 SHLIB_VERSION=$SHLIB_VERSION