kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From granthe...@apache.org
Subject kudu git commit: [build] Centralize project version to version.txt
Date Wed, 31 Oct 2018 18:44:41 GMT
Repository: kudu
Updated Branches:
  refs/heads/master 0b2fef41d -> dc71ab7ea


[build] Centralize project version to version.txt

This patch changes the Java and Python builds
to use the version.txt as their source of the project
version. This simplifies branching and ensures
our versions always match.

I use symbolic links in the python project to ensure
that the version and licence file are copied from the
parent directory when generating a source
distribution.

This patch also corrects the versioning of snapshot
builds to ensure they include .dev0. This was being
done in the kudu/version.py file, but not in the
distribution version set in setup(…).

Change-Id: Ib654be8657ae3dc2f193056484b5d0743aa1ce95
Reviewed-on: http://gerrit.cloudera.org:8080/11735
Tested-by: Kudu Jenkins
Reviewed-by: <andy@phdata.io>
Reviewed-by: Adar Dembo <adar@cloudera.com>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/dc71ab7e
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/dc71ab7e
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/dc71ab7e

Branch: refs/heads/master
Commit: dc71ab7eaf37b2924ca508567e11eca482a4fec5
Parents: 0b2fef4
Author: Grant Henke <granthenke@apache.org>
Authored: Fri Oct 19 09:05:17 2018 -0500
Committer: Grant Henke <granthenke@apache.org>
Committed: Wed Oct 31 18:44:22 2018 +0000

----------------------------------------------------------------------
 RELEASING.adoc         |  7 +------
 java/build.gradle      |  3 +++
 java/gradle.properties |  1 -
 python/LICENSE.txt     |  1 +
 python/MANIFEST.in     |  3 ++-
 python/setup.py        | 39 +++++++++++++++++++++++----------------
 python/version.txt     |  1 +
 7 files changed, 31 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/dc71ab7e/RELEASING.adoc
----------------------------------------------------------------------
diff --git a/RELEASING.adoc b/RELEASING.adoc
index 40cbbcd..559ac23 100644
--- a/RELEASING.adoc
+++ b/RELEASING.adoc
@@ -85,12 +85,7 @@ branch with the same name and the previously-noted SHA1.
 
 . Check out the `master` branch and bump the version in `version.txt`.
 
-. Update the version in `java/gradle.properties`.
-
-. If the python API has changed since the previous release, bump the Python version
-  in `python/setup.py` in master. (the Python API uses separate versioning).
-
-. After all the versions are updated, commit and push that change to Gerrit.
+. Commit and push that change to Gerrit.
 
 . Notify dev@kudu.apache.org that the new branch is available.
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/dc71ab7e/java/build.gradle
----------------------------------------------------------------------
diff --git a/java/build.gradle b/java/build.gradle
index f5131e0..49862d9 100755
--- a/java/build.gradle
+++ b/java/build.gradle
@@ -37,6 +37,9 @@ allprojects {
     mavenLocal()
   }
 
+  // Read the version.txt file to set the project version
+  project.version = file("$rootDir/../version.txt").text.trim()
+
   apply from: "$rootDir/gradle/docs.gradle"
 }
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/dc71ab7e/java/gradle.properties
----------------------------------------------------------------------
diff --git a/java/gradle.properties b/java/gradle.properties
index 9cc522b..f786b30 100755
--- a/java/gradle.properties
+++ b/java/gradle.properties
@@ -20,7 +20,6 @@
 #   https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties
 
 group = org.apache.kudu
-version = 1.9.0-SNAPSHOT
 url = https://kudu.apache.org/
 
 # The Maven respository used when uploading artifacts.

http://git-wip-us.apache.org/repos/asf/kudu/blob/dc71ab7e/python/LICENSE.txt
----------------------------------------------------------------------
diff --git a/python/LICENSE.txt b/python/LICENSE.txt
new file mode 120000
index 0000000..4ab4373
--- /dev/null
+++ b/python/LICENSE.txt
@@ -0,0 +1 @@
+../LICENSE.txt
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/kudu/blob/dc71ab7e/python/MANIFEST.in
----------------------------------------------------------------------
diff --git a/python/MANIFEST.in b/python/MANIFEST.in
index a6e88d6..fcfcff7 100644
--- a/python/MANIFEST.in
+++ b/python/MANIFEST.in
@@ -1,7 +1,8 @@
+include LICENSE.txt
 include MANIFEST.in
-include ../LICENSE.txt
 include README.md
 include setup.py
+include version.txt
 
 graft kudu
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/dc71ab7e/python/setup.py
----------------------------------------------------------------------
diff --git a/python/setup.py b/python/setup.py
index faa4714..601dc78 100644
--- a/python/setup.py
+++ b/python/setup.py
@@ -27,6 +27,7 @@ from setuptools import setup
 from distutils.command.clean import clean as _clean
 from distutils.extension import Extension
 import os
+import re
 import subprocess
 
 # Workaround a Python bug in which multiprocessing's atexit handler doesn't
@@ -37,31 +38,35 @@ import multiprocessing
 if Cython.__version__ < '0.21.0':
     raise Exception('Please upgrade to Cython 0.21.0 or newer')
 
-MAJOR = 1
-MINOR = 9
-MICRO = 0
-VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
-ISRELEASED = True
-
 setup_dir = os.path.abspath(os.path.dirname(__file__))
 
-
-def write_version_py(filename=os.path.join(setup_dir, 'kudu/version.py')):
-    version = VERSION
-    if not ISRELEASED:
-        version += '.dev'
-
+def find_version():
+    version_file = open(os.path.join(setup_dir, "version.txt")).read()
+    version_match = re.search(
+        # Matches versions in the format of major.minor.patch-optional-label.
+        # For example: 1.2.3 or 1.2.3-SNAPSHOT or 1.2.3-beta-SNAPSHOT
+        r"^(?P<version>\d+\.\d+\.\d+)(?:-(?P<label>.+))?",
+        version_file
+    )
+    if not version_match:
+        raise RuntimeError("Unable to parse version string " + version_file)
+    version = version_match.group("version")
+    if "SNAPSHOT" in version_match.group("label"):
+        version += '.dev0'
+    return version
+
+def write_version_py(version, filename=os.path.join(setup_dir, 'kudu/version.py')):
+    is_release = "dev" not in version
     a = open(filename, 'w')
     file_content = "\n".join(["",
                               "# THIS FILE IS GENERATED FROM SETUP.PY",
                               "version = '%(version)s'",
                               "isrelease = '%(isrelease)s'"])
 
-    a.write(file_content % {'version': VERSION,
-                            'isrelease': str(ISRELEASED)})
+    a.write(file_content % {'version': version,
+                            'isrelease': str(is_release)})
     a.close()
 
-
 class clean(_clean):
     def run(self):
         _clean.run(self)
@@ -99,6 +104,8 @@ def generate_config_pxi(include_dirs):
     else:
       os.rename(dst_tmp, dst)
 
+VERSION = find_version()
+
 # If we're in the context of the Kudu git repository, build against the
 # latest in-tree build artifacts
 if 'KUDU_HOME' in os.environ:
@@ -155,7 +162,7 @@ for submodule_name in ext_submodules:
 
 extensions = cythonize(extensions)
 
-write_version_py()
+write_version_py(VERSION)
 
 LONG_DESCRIPTION = open(os.path.join(setup_dir, "README.md")).read()
 DESCRIPTION = "Python interface to the Apache Kudu C++ Client API"

http://git-wip-us.apache.org/repos/asf/kudu/blob/dc71ab7e/python/version.txt
----------------------------------------------------------------------
diff --git a/python/version.txt b/python/version.txt
new file mode 120000
index 0000000..aa4e5be
--- /dev/null
+++ b/python/version.txt
@@ -0,0 +1 @@
+../version.txt
\ No newline at end of file


Mime
View raw message