Gemspec sets GIT_DIR and GIT_WORK_TREE to ensure correct gem version
authorPeter Amstutz <peter.amstutz@curii.com>
Tue, 14 Jan 2020 20:26:20 +0000 (15:26 -0500)
committerPeter Amstutz <peter.amstutz@curii.com>
Tue, 14 Jan 2020 20:26:20 +0000 (15:26 -0500)
refs #16010

Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz@curii.com>

sdk/cli/arvados-cli.gemspec
sdk/ruby/arvados.gemspec
services/login-sync/Gemfile.lock
services/login-sync/arvados-login-sync.gemspec

index 749797cf848afbd698da32cc7feb7afd00f02d03..3db613c2929b472764d6b9c5b07f753786a27b93 100644 (file)
@@ -7,9 +7,18 @@ if not File.exist?('/usr/bin/git') then
   exit
 end
 
-version = `#{__dir__}/../../build/version-at-commit.sh HEAD`.encode('utf-8').strip
-git_timestamp, git_hash = `git log -n1 --first-parent --format=%ct:%H .`.chomp.split(":")
-git_timestamp = Time.at(git_timestamp.to_i).utc
+git_dir = ENV["GIT_DIR"]
+git_work = ENV["GIT_WORK_TREE"]
+begin
+  ENV["GIT_DIR"] = File.expand_path "#{__dir__}/../../.git"
+  ENV["GIT_WORK_TREE"] = File.expand_path "#{__dir__}/../.."
+  git_timestamp, git_hash = `git log -n1 --first-parent --format=%ct:%H #{__dir__}`.chomp.split(":")
+  version = `#{__dir__}/../../build/version-at-commit.sh #{git_hash}`.encode('utf-8').strip
+  git_timestamp = Time.at(git_timestamp.to_i).utc
+ensure
+  ENV["GIT_DIR"] = git_dir
+  ENV["GIT_WORK_TREE"] = git_work
+end
 
 Gem::Specification.new do |s|
   s.name        = 'arvados-cli'
index 9f314e6c9c0e28d82c3a2e767a04dcb058d8aea5..9a24414bb8eeae4b4dec931eab882cf16529cfec 100644 (file)
@@ -7,9 +7,18 @@ if not File.exist?('/usr/bin/git') then
   exit
 end
 
-version = `#{__dir__}/../../build/version-at-commit.sh HEAD`.encode('utf-8').strip
-git_timestamp, git_hash = `git log -n1 --first-parent --format=%ct:%H .`.chomp.split(":")
-git_timestamp = Time.at(git_timestamp.to_i).utc
+git_dir = ENV["GIT_DIR"]
+git_work = ENV["GIT_WORK_TREE"]
+begin
+  ENV["GIT_DIR"] = File.expand_path "#{__dir__}/../../.git"
+  ENV["GIT_WORK_TREE"] = File.expand_path "#{__dir__}/../.."
+  git_timestamp, git_hash = `git log -n1 --first-parent --format=%ct:%H #{__dir__}`.chomp.split(":")
+  version = `#{__dir__}/../../build/version-at-commit.sh #{git_hash}`.encode('utf-8').strip
+  git_timestamp = Time.at(git_timestamp.to_i).utc
+ensure
+  ENV["GIT_DIR"] = git_dir
+  ENV["GIT_WORK_TREE"] = git_work
+end
 
 Gem::Specification.new do |s|
   s.name        = 'arvados'
index 1d89604ae104bd30fe0db69546e2d0cec906f53b..ce648a2fc9a89b697d42d431df0c4e61da9a8253 100644 (file)
@@ -1,9 +1,10 @@
 PATH
   remote: .
   specs:
-    arvados-login-sync (1.3.1.pre20191210204053)
+    arvados-login-sync (1.5.0.pre20191230153247)
       arvados (~> 1.3.0, >= 1.3.0)
       faraday (< 0.16)
+      signet (< 0.12)
 
 GEM
   remote: https://rubygems.org/
index f6485d695fcfe27b61f1b866c8c14085156480f9..2a91eed71ce6d22ace8671f0206edb2c518bd0c4 100644 (file)
@@ -7,9 +7,18 @@ if not File.exist?('/usr/bin/git') then
   exit
 end
 
-version = `#{__dir__}/../../build/version-at-commit.sh HEAD`.encode('utf-8').strip
-git_timestamp, git_hash = `git log -n1 --first-parent --format=%ct:%H .`.chomp.split(":")
-git_timestamp = Time.at(git_timestamp.to_i).utc
+git_dir = ENV["GIT_DIR"]
+git_work = ENV["GIT_WORK_TREE"]
+begin
+  ENV["GIT_DIR"] = File.expand_path "#{__dir__}/../../.git"
+  ENV["GIT_WORK_TREE"] = File.expand_path "#{__dir__}/../.."
+  git_timestamp, git_hash = `git log -n1 --first-parent --format=%ct:%H #{__dir__}`.chomp.split(":")
+  version = `#{__dir__}/../../build/version-at-commit.sh #{git_hash}`.encode('utf-8').strip
+  git_timestamp = Time.at(git_timestamp.to_i).utc
+ensure
+  ENV["GIT_DIR"] = git_dir
+  ENV["GIT_WORK_TREE"] = git_work
+end
 
 Gem::Specification.new do |s|
   s.name        = 'arvados-login-sync'
@@ -19,7 +28,7 @@ Gem::Specification.new do |s|
   s.description = "Creates and updates local login accounts for Arvados users. Built from git commit #{git_hash}"
   s.authors     = ["Arvados Authors"]
   s.email       = 'gem-dev@curoverse.com'
-  s.licenses    = ['GNU Affero General Public License, version 3.0']
+  s.licenses    = ['AGPL-3.0']
   s.files       = ["bin/arvados-login-sync", "agpl-3.0.txt"]
   s.executables << "arvados-login-sync"
   s.required_ruby_version = '>= 2.1.0'