Author: vanto
Date: Fri Dec  3 01:35:23 2010
New Revision: 1041670

URL: http://svn.apache.org/viewvc?rev=1041670&view=rev
Log:
Nexus deployments + GPG signing.

Added:
    ode/trunk/tasks/gpg.rake
Modified:
    ode/trunk/Rakefile

Modified: ode/trunk/Rakefile
URL: 
http://svn.apache.org/viewvc/ode/trunk/Rakefile?rev=1041670&r1=1041669&r2=1041670&view=diff
==============================================================================
--- ode/trunk/Rakefile (original)
+++ ode/trunk/Rakefile Fri Dec  3 01:35:23 2010
@@ -14,7 +14,7 @@
 #    limitations under the License.
 #
 
-gem "buildr", "~>1.4"
+gem "buildr", "~>1.4.3"
 require "buildr"
 require "buildr/xmlbeans.rb"
 require "buildr/openjpa"
@@ -36,6 +36,15 @@ require File.join(File.dirname(__FILE__)
 # Keep this structure to allow the build system to update version numbers.
 VERSION_NUMBER = "1.4-SNAPSHOT"
 
+# Apache Nexus Repositories
+if VERSION_NUMBER =~ /SNAPSHOT/
+    # Apache Development Snapshot Repository
+    repositories.release_to[:url] = 
'https://repository.apache.org/content/repositories/snapshots'
+else
+    # Apache Release Distribution Repository
+    repositories.release_to[:url] = 
'https://repository.apache.org/service/local/staging/deploy/maven2'
+end
+
 BUNDLE_VERSIONS = {
   "ode.version" => VERSION_NUMBER,
   "commons.collections.version" => artifact(COMMONS.collections).version,
@@ -531,6 +540,9 @@ define "ode" do
 
   package_with_sources
   package_with_javadoc unless ENV["JAVADOC"] =~ /^(no|off|false|skip)$/i
+
+  # sign artifacts
+  projects.each { |pr| pr.packages.each { |pkg| GPG.sign_and_upload(pkg) } }
 end
 
 define "apache-ode" do
@@ -619,4 +631,10 @@ define "apache-ode" do
 
   package(:zip, :id=>"#{id}-docs").include(doc.from(project("ode").projects).
     using(:javadoc, :windowtitle=>"Apache ODE #{project.version}").target, 
:as=>"#{id}-docs-#{version}") unless ENV["JAVADOC"] =~ /^(no|off|false|skip)$/i
+    
+  # sign disto packages
+  projects.each { |pr| pr.packages.each { |pkg| GPG.sign_and_upload(pkg) } }
+  # sign source and javadoc artifacts
+  packages.each { |pkg| GPG.sign_and_upload(pkg) }
+
 end

Added: ode/trunk/tasks/gpg.rake
URL: http://svn.apache.org/viewvc/ode/trunk/tasks/gpg.rake?rev=1041670&view=auto
==============================================================================
--- ode/trunk/tasks/gpg.rake (added)
+++ ode/trunk/tasks/gpg.rake Fri Dec  3 01:35:23 2010
@@ -0,0 +1,24 @@
+module GPG
+  extend self
+
+  def sign_task(pkg)
+    file(pkg.to_s + '.asc') do
+      puts "GPG signing #{pkg.to_spec}"
+      cmd = 'gpg',
+             '--local-user', ENV['GPG_USER'],
+             '--armor',
+             '--output', pkg.to_s + '.asc'
+      cmd += ['--passphrase', ENV['GPG_PASS']] if ENV['GPG_PASS']
+      cmd += ['--detach-sig', pkg]
+      #cmd << { :verbose => true }
+      #sh *cmd
+      system *cmd
+    end
+  end
+
+  def sign_and_upload(pkg)
+    artifact = Buildr.artifact(pkg.to_spec_hash.merge(:type => 
"#{pkg.type}.asc"))
+    artifact.from sign_task(pkg)
+    task(:upload).enhance [artifact.upload_task]
+  end
+end


Reply via email to