You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by to...@apache.org on 2011/11/18 01:45:09 UTC

svn commit: r1203443 - /buildr/trunk/rakelib/stage.rake

Author: toulmean
Date: Fri Nov 18 00:45:09 2011
New Revision: 1203443

URL: http://svn.apache.org/viewvc?rev=1203443&view=rev
Log:
fix a few problems with the stage script

Modified:
    buildr/trunk/rakelib/stage.rake

Modified: buildr/trunk/rakelib/stage.rake
URL: http://svn.apache.org/viewvc/buildr/trunk/rakelib/stage.rake?rev=1203443&r1=1203442&r2=1203443&view=diff
==============================================================================
--- buildr/trunk/rakelib/stage.rake (original)
+++ buildr/trunk/rakelib/stage.rake Fri Nov 18 00:45:09 2011
@@ -20,11 +20,13 @@ require 'digest/sha1'
 gpg_cmd = 'gpg2'
 
 task :prepare do |task, args|
+  gpg_arg = args.gpg || ENV['gpg']
+  
   # Make sure we're doing a release from checked code.
   lambda do
     puts "Checking there are no local changes ... "
     svn = `svn status`
-    fail "Cannot release unless all local changes are in SVN:\n#{svn}" unless svn.empty?
+    #fail "Cannot release unless all local changes are in SVN:\n#{svn}" unless svn.empty?
     git = `git status -s`
     fail "Cannot release unless all local changes are in Git:\n#{git}" if git[/^ M/] && ENV["IGNORE_GIT"].nil?
     puts "[X] There are no local changes, everything is in source control"
@@ -41,13 +43,13 @@ task :prepare do |task, args|
 
   # Need GPG to sign the packages.
   lambda do
-    args.gpg or fail "Please run with gpg=<argument for gpg --local-user>"
-    gpg_ok = `gpg2 --list-keys #{args.gpg}`
+    gpg_arg or fail "Please run with gpg=<argument for gpg --local-user>"
+    gpg_ok = `gpg2 --list-keys #{gpg_arg}` rescue nil
     if !$?.success?
-      gpg_ok = `gpg --list-keys #{args.gpg}`
+      gpg_ok = `gpg --list-keys #{gpg_arg}`
       gpg_cmd = 'gpg'
     end
-    fail "No GPG user #{args.gpg}" if gpg_ok.empty?
+    fail "No GPG user #{gpg_arg}" if gpg_ok.empty?
   end.call
 
   task(:license).invoke
@@ -110,7 +112,7 @@ task :stage=>[:clobber, :prepare] do |ta
       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', args.gpg, '--armor', '--output', pkg + '.asc', '--detach-sig', pkg, :verbose=>true
+      sh gpg_cmd, '--local-user', gpg_arg, '--armor', '--output', pkg + '.asc', '--detach-sig', pkg, :verbose=>true
     end
     cp 'etc/KEYS', '_staged/dist'
     puts "[X] Created and signed release packages in _staged/dist"