3848: Package version numbers use UTC timestamps.
authorBrett Smith <brett@curoverse.com>
Fri, 26 Sep 2014 21:06:15 +0000 (17:06 -0400)
committerBrett Smith <brett@curoverse.com>
Mon, 29 Sep 2014 16:17:56 +0000 (12:17 -0400)
Per note-9 in the issue.

sdk/cli/arvados-cli.gemspec
sdk/python/setup.py
sdk/ruby/arvados.gemspec
services/fuse/setup.py

index 88a409c96d30553be87bb16a34edc85b58e8bc6b..9daae38cb3d43d8bad2b85f85d49ca553421822d 100644 (file)
@@ -3,12 +3,15 @@ if not File.exists?('/usr/bin/git') then
   exit
 end
 
+git_timestamp, git_hash = `git log -n1 --first-parent --format=%ct:%H .`.chomp.split(":")
+git_timestamp = Time.at(git_timestamp.to_i).utc
+
 Gem::Specification.new do |s|
   s.name        = 'arvados-cli'
-  s.version     = '0.1.' + `git log --first-parent --pretty=format:'%ci' -n 1 .`[0..18].gsub(/[ \-:]/,'')
-  s.date        = `git log --first-parent --pretty=format:'%ci' -n 1 .`[0..9]
+  s.version     = "0.1.#{git_timestamp.strftime('%Y%m%d%H%M%S')}"
+  s.date        = git_timestamp.strftime("%Y-%m-%d")
   s.summary     = "Arvados CLI tools"
-  s.description = "Arvados command line tools, git commit " + `git log --pretty=format:'%H' -n 1 .`
+  s.description = "Arvados command line tools, git commit #{git_hash}"
   s.authors     = ["Arvados Authors"]
   s.email       = 'gem-dev@curoverse.com'
   #s.bindir      = '.'
index 5ae4e64b3389849cd0f68f83785db5929f2190d0..03637cbf580c78f275f3609827334f6e0182bf86 100644 (file)
@@ -2,6 +2,7 @@
 
 import os
 import subprocess
+import time
 
 from setuptools import setup, find_packages
 
@@ -12,15 +13,13 @@ cmd_opts = {'egg_info': {}}
 try:
     git_tags = subprocess.check_output(
         ['git', 'log', '--first-parent', '--max-count=1',
-         '--format=format:%ci %h', SETUP_DIR]).split()
-    assert len(git_tags) == 4
+         '--format=format:%ct %h', SETUP_DIR]).split()
+    assert len(git_tags) == 2
 except (AssertionError, OSError, subprocess.CalledProcessError):
     pass
 else:
-    del git_tags[2]    # Remove timezone
-    for ii in [0, 1]:  # Remove non-digits from other datetime fields
-        git_tags[ii] = ''.join(c for c in git_tags[ii] if c.isdigit())
-    cmd_opts['egg_info']['tag_build'] = '.{}{}.{}'.format(*git_tags)
+    git_tags[0] = time.strftime('%Y%m%d%H%M%S', time.gmtime(int(git_tags[0])))
+    cmd_opts['egg_info']['tag_build'] = '.{}.{}'.format(*git_tags)
 
 
 setup(name='arvados-python-client',
index cc6b5f5de4deed53e5d6b7c0cb719ac5325f18b2..85f41720e8613eb2515ff9a81c59cf4142cf29ca 100644 (file)
@@ -3,12 +3,15 @@ if not File.exists?('/usr/bin/git') then
   exit
 end
 
+git_timestamp, git_hash = `git log -n1 --first-parent --format=%ct:%H .`.chomp.split(":")
+git_timestamp = Time.at(git_timestamp.to_i).utc
+
 Gem::Specification.new do |s|
   s.name        = 'arvados'
-  s.version     = '0.1.' + `git log --first-parent --pretty=format:'%ci' -n 1 .`[0..18].gsub(/[ \-:]/,'')
-  s.date        = `git log --first-parent --pretty=format:'%ci' -n 1 .`[0..9]
+  s.version     = "0.1.#{git_timestamp.strftime('%Y%m%d%H%M%S')}"
+  s.date        = git_timestamp.strftime("%Y-%m-%d")
   s.summary     = "Arvados client library"
-  s.description = "Arvados client library, git commit " + `git log --pretty=format:'%H' -n 1 .`
+  s.description = "Arvados client library, git commit #{git_hash}"
   s.authors     = ["Arvados Authors"]
   s.email       = 'gem-dev@curoverse.com'
   s.licenses    = ['Apache License, Version 2.0']
index 3ea28cbbba0ea3ddf8aa555d148e16fbf9c1dcd0..be9e4e64a547f5b169f8a5710800e561ba324f9f 100644 (file)
@@ -2,6 +2,7 @@
 
 import os
 import subprocess
+import time
 
 from setuptools import setup, find_packages
 
@@ -12,15 +13,13 @@ cmd_opts = {'egg_info': {}}
 try:
     git_tags = subprocess.check_output(
         ['git', 'log', '--first-parent', '--max-count=1',
-         '--format=format:%ci %h', SETUP_DIR]).split()
-    assert len(git_tags) == 4
+         '--format=format:%ct %h', SETUP_DIR]).split()
+    assert len(git_tags) == 2
 except (AssertionError, OSError, subprocess.CalledProcessError):
     pass
 else:
-    del git_tags[2]    # Remove timezone
-    for ii in [0, 1]:  # Remove non-digits from other datetime fields
-        git_tags[ii] = ''.join(c for c in git_tags[ii] if c.isdigit())
-    cmd_opts['egg_info']['tag_build'] = '.{}{}.{}'.format(*git_tags)
+    git_tags[0] = time.strftime('%Y%m%d%H%M%S', time.gmtime(int(git_tags[0])))
+    cmd_opts['egg_info']['tag_build'] = '.{}.{}'.format(*git_tags)
 
 
 setup(name='arvados_fuse',