buildr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject [6/7] buildr git commit: Adjust the staging process to use the same environment variables as the gpg addon
Date Sun, 02 Apr 2017 23:51:31 GMT
Adjust the staging process to use the same environment variables as the gpg addon


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

Branch: refs/heads/master
Commit: be5ebbe7a8c88c0e5db840510491830ab04a827a
Parents: efdbd38
Author: Peter Donald <peter@realityforge.org>
Authored: Mon Apr 3 09:20:00 2017 +1000
Committer: Peter Donald <peter@realityforge.org>
Committed: Mon Apr 3 09:30:05 2017 +1000

----------------------------------------------------------------------
 rakelib/release.rake |  6 ++----
 rakelib/stage.rake   | 31 +++++++++++++++++++++++--------
 2 files changed, 25 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/buildr/blob/be5ebbe7/rakelib/release.rake
----------------------------------------------------------------------
diff --git a/rakelib/release.rake b/rakelib/release.rake
index 825b2e4..ed2dddb 100644
--- a/rakelib/release.rake
+++ b/rakelib/release.rake
@@ -13,12 +13,10 @@
 # License for the specific language governing permissions and limitations under
 # the License.
 
-RC_VERSION = ENV['RC_VERSION'] || ""
+RC_VERSION = ENV['RC_VERSION'] || ''
 
 desc 'Release the next version of buildr from existing staged repository'
-task 'release' do |task, args|
-  user = args.user || ENV['user'] || `whoami`
-
+task 'release' do
   # First, we need to get all the staged files from Apache to _release.
   mkpath '_release'
   lambda do

http://git-wip-us.apache.org/repos/asf/buildr/blob/be5ebbe7/rakelib/stage.rake
----------------------------------------------------------------------
diff --git a/rakelib/stage.rake b/rakelib/stage.rake
index c2009db..1c22693 100644
--- a/rakelib/stage.rake
+++ b/rakelib/stage.rake
@@ -21,10 +21,7 @@ gpg_cmd = 'gpg2'
 STAGE_DATE = ENV['STAGE_DATE'] ||  Time.now.strftime('%Y-%m-%d')
 RC_VERSION = ENV['RC_VERSION'] || ''
 
-task 'prepare' do |task, args|
-  gpg_arg = args.gpg || ENV['gpg']
-  user = args.user || ENV['user'] || `whoami`
-
+task 'prepare' do
   # Update source files to next release number.
   lambda do
     current_version = spec.version.to_s.split('.').map { |v| v.to_i }.
@@ -68,7 +65,10 @@ task 'prepare' do |task, args|
 
   # Need GPG to sign the packages.
   lambda do
-    gpg_arg or fail 'Please run with gpg=<argument for gpg --local-user>'
+    raise "ENV['GPG_USER'] not specified" unless ENV['GPG_USER']
+
+    gpg_arg = ENV['GPG_USER']
+    gpg_arg or fail 'Please run with GPG_USER=<argument for gpg --local-user>'
     gpg_ok = `gpg2 --list-keys #{gpg_arg}` rescue nil
     unless $?.success?
       gpg_ok = `gpg --list-keys #{gpg_arg}`
@@ -91,8 +91,7 @@ task 'prepare' do |task, args|
   raise 'Can not run staging process under older rubies' unless RUBY_VERSION >= '1.9'
 end
 
-task 'stage' => %w(clobber prepare) do |task, args|
-  gpg_arg = args.gpg || ENV['gpg']
+task 'stage' => %w(clobber prepare) do
   mkpath '_staged'
 
   lambda do
@@ -128,7 +127,23 @@ task 'stage' => %w(clobber prepare) do |task, args|
       bytes = File.open(pkg, 'rb') { |file| file.read }
       File.open(pkg + '.md5', 'w') { |file| file.write Digest::MD5.hexdigest(bytes) <<
' ' << File.basename(pkg) }
       File.open(pkg + '.sha1', 'w') { |file| file.write Digest::SHA1.hexdigest(bytes) <<
' ' << File.basename(pkg) }
-      sh gpg_cmd, '--local-user', gpg_arg, '--armor', '--output', pkg + '.asc', '--detach-sig',
pkg, :verbose=>true
+
+      cmd = []
+      cmd << gpg_cmd
+      cmd << '--local-user'
+      cmd << ENV['GPG_USER']
+      cmd << '--armor'
+      if ENV['GPG_PASS']
+        cmd << '--batch'
+        cmd << '--passphrase'
+        cmd << ENV['GPG_PASS']
+      end
+      cmd << '--output'
+      cmd << pkg + '.asc'
+      cmd << '--detach-sig'
+      cmd << pkg
+
+      sh *cmd, :verbose=>true
     end
     cp 'etc/KEYS', '_staged/dist'
     puts '[X] Created and signed release packages in _staged/dist'


Mime
View raw message