You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by dj...@apache.org on 2025/06/04 10:52:05 UTC
(cloudberry) branch main updated: Support new VERSION/BUILD\_NUMBER files for non-Git versioning fallback
This is an automated email from the ASF dual-hosted git repository.
djwang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
The following commit(s) were added to refs/heads/main by this push:
new 9f37357a6b Support new VERSION/BUILD\_NUMBER files for non-Git versioning fallback
9f37357a6b is described below
commit 9f37357a6ba7757c50ec8d28aa31fc3ffc850399
Author: Ed Espino <es...@apache.org>
AuthorDate: Sun Jun 1 12:06:36 2025 -0700
Support new VERSION/BUILD\_NUMBER files for non-Git versioning fallback
Enhances `getversion` to handle both legacy and new formats for versioning
in non-Git environments.
Specifically:
* If the `VERSION` file contains a line like `<version> build <build_number>`,
both values are extracted as before.
* If `VERSION` is a single line and `BUILD_NUMBER` exists, they are combined.
This supports Apache Cloudberry packaging conventions while maintaining
backward compatibility with earlier versioning styles.
Header documentation updated to clarify both paths.
---
getversion | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/getversion b/getversion
index 9f100bd7f0..76f6984ada 100755
--- a/getversion
+++ b/getversion
@@ -35,7 +35,13 @@
# e.g., VERSION = 2.0.1-devel+dev.3.gabcd123
#
# 3. If *not* in a Git repo but a `VERSION` file exists:
-# VERSION and BUILDNUMBER are read from that file (format: "<version> build <build_number>")
+#
+# a. If the file contains a line like "<version> build <build_number>", both values are extracted.
+#
+# b. Otherwise, the VERSION is read from the file and the BUILDNUMBER is taken from BUILD_NUMBER if it exists.
+#
+# (This is the case for Apache Cloudberry packaging builds, where these files are created by the
+# release script and may also be leveraged by downstream users.)
#
# 4. If neither a Git repo nor a VERSION file is present:
# VERSION = <PACKAGE_VERSION> from configure
@@ -101,8 +107,16 @@ if type git >/dev/null 2>&1 && [ -d '.git' ]; then
fi
# Not a git repo but VERSION file exists
elif [[ -s ./VERSION ]]; then
- VERSION=$(awk -F' build ' '{print $1}' ./VERSION)
- BUILDNUMBER=$(awk -F' build ' '{print $2}' ./VERSION)
+ # Support both legacy "<version> build <build_number>" and newer single-version formats
+ if grep -q ' build ' ./VERSION; then
+ VERSION=$(awk -F' build ' '{print $1}' ./VERSION)
+ BUILDNUMBER=$(awk -F' build ' '{print $2}' ./VERSION)
+ else
+ VERSION=$(<./VERSION)
+ if [[ -f ./BUILD_NUMBER ]]; then
+ BUILDNUMBER=$(<./BUILD_NUMBER)
+ fi
+ fi
fi
# Handle optional flag
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org