You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@madlib.apache.org by ri...@apache.org on 2016/10/25 18:40:46 UTC

incubator-madlib git commit: Update to enable semantic versioning

Repository: incubator-madlib
Updated Branches:
  refs/heads/patch/v1.9.1_madpack 51ef7e030 -> 07d2c39af


Update to enable semantic versioning


Project: http://git-wip-us.apache.org/repos/asf/incubator-madlib/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-madlib/commit/07d2c39a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-madlib/tree/07d2c39a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-madlib/diff/07d2c39a

Branch: refs/heads/patch/v1.9.1_madpack
Commit: 07d2c39af5bb6416a62f3626a0c0f291a7fc581d
Parents: 51ef7e0
Author: Rahul Iyer <ri...@apache.org>
Authored: Tue Oct 25 11:40:41 2016 -0700
Committer: Rahul Iyer <ri...@apache.org>
Committed: Tue Oct 25 11:40:41 2016 -0700

----------------------------------------------------------------------
 src/config/Version.yml |  2 +-
 src/madpack/madpack.py | 18 +++++++++++++++---
 2 files changed, 16 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-madlib/blob/07d2c39a/src/config/Version.yml
----------------------------------------------------------------------
diff --git a/src/config/Version.yml b/src/config/Version.yml
index 4a27f29..d1180ca 100644
--- a/src/config/Version.yml
+++ b/src/config/Version.yml
@@ -1 +1 @@
-version: 1.9.1MS
+version: 1.9.1-MS

http://git-wip-us.apache.org/repos/asf/incubator-madlib/blob/07d2c39a/src/madpack/madpack.py
----------------------------------------------------------------------
diff --git a/src/madpack/madpack.py b/src/madpack/madpack.py
index 8d31331..5bb1453 100755
--- a/src/madpack/madpack.py
+++ b/src/madpack/madpack.py
@@ -355,14 +355,24 @@ def _get_rev_num(rev):
     """
     Convert version string into number for comparison
         @param rev version text
+                It is expected to follow Semantic Versioning (semver.org)
+                Valid inputs:
+                    1.9.0, 1.10.0, 2.5.0
+                    1.0.0-alpha, 1.0.0-alpha.1, 1.0.0-0.3.7, 1.0.0-x.7.z.92
+
     """
     try:
-        num = tuple(int(i) for i in rev.split('.'))
+        rev_parts = rev.split('-')  # text to the right of - is treated as str
+        numeric_rev = rev_parts[0]
+        num = tuple(int(i) for i in numeric_rev.split('.'))
+        if len(rev_parts) > 1:
+            num = num + tuple(str(rev_parts[1]))
         if num:
             return num
         else:
             return ['0']
     except:
+        # invalid revision
         return ['0']
 # ------------------------------------------------------------------------------
 
@@ -736,7 +746,7 @@ def _db_create_objects(schema, old_schema, upgrade=False, sc=None, testcase="",
     try:
         _info("> Writing version info in MigrationHistory table", True)
         _internal_run_query("INSERT INTO %s.migrationhistory(version) "
-                       "VALUES('%s')" % (schema, rev), True)
+                            "VALUES('%s')" % (schema, rev), True)
     except:
         _error("Cannot insert data into %s.migrationhistory table" % schema, False)
         raise Exception
@@ -1234,7 +1244,9 @@ def main(argv):
             return
 
         # Create install-check user
-        test_user = 'madlib_' + rev.replace('.', '') + '_installcheck'
+        test_user = ('madlib_' +
+                     rev.replace('.', '').replace('-', '_') +
+                     '_installcheck')
         try:
             _internal_run_query("DROP USER IF EXISTS %s;" % (test_user), False)
         except: