Permalink
Browse files

Improve RPM spec creation. Pull JRuby spec into this repo temporarily…

…. Use cantiere to build.
  • Loading branch information...
1 parent 5ad4f02 commit 0167399b3c51e28b4d04db6b8f852c462e8ffbca @bobmcwhirter bobmcwhirter committed Oct 17, 2010
Showing with 100 additions and 34 deletions.
  1. +1 −0 .gitignore
  2. +3 −0 .gitmodules
  3. +18 −18 Gemfile
  4. +5 −0 Rakefile
  5. +29 −16 { → bin}/bundle2rpm
  6. +1 −0 lib/cantiere
  7. +43 −0 specs/torquebox-jruby.spec
View
1 .gitignore
@@ -0,0 +1 @@
+specs/gems/*
View
3 .gitmodules
@@ -0,0 +1,3 @@
+[submodule "lib/cantiere"]
+ path = lib/cantiere
+ url = git://github.com/stormgrind/cantiere.git
View
36 Gemfile
@@ -10,24 +10,24 @@ source "http://rubygems.org"
# ActiveRecord-JDBC gems
#gem "activerecord-jdbcpostgresql-adapter", "0.9.7"
-#gem "authlogic", "2.1.5"
-#gem "aws", "2.3.21"
+gem "authlogic", "2.1.5"
+gem "aws", "2.3.21"
gem "s3", "0.3.4"
-#gem "haml", "3.0.15"
-#gem "compass", "0.10.2"
-#gem "steamcannon-deltacloud-client", "0.0.9.7.2", :require => "deltacloud"
-#gem "paperclip", "2.3.3"
-#gem "simple-navigation", "2.6.0"
-#gem "aasm", "2.1.5"
-#gem "rest-client", '~> 1.6.0'
+gem "haml", "3.0.15"
+gem "compass", "0.10.2"
+gem "steamcannon-deltacloud-client", "0.0.9.7.2", :require => "deltacloud"
+gem "paperclip", "2.3.3"
+gem "simple-navigation", "2.6.0"
+gem "aasm", "2.1.5"
+gem "rest-client", '~> 1.6.0'
gem "json", '1.4.6'
-#
-#group :test do
- #gem "rspec", "1.3.0"
- #gem "rspec-rails", "1.3.2"
- #gem "rcov", "0.9.8"
- #gem "factory_girl", "1.3.2"
- #gem "shoulda", "2.11.3"
- #gem "awesome_print", "0.2.1"
-#end
+
+group :test do
+ gem "rspec", "1.3.0"
+ gem "rspec-rails", "1.3.2"
+ gem "rcov", "0.9.8"
+ gem "factory_girl", "1.3.2"
+ gem "shoulda", "2.11.3"
+ gem "awesome_print", "0.2.1"
+end
View
5 Rakefile
@@ -0,0 +1,5 @@
+$: << 'lib/cantiere/lib'
+
+require 'cantiere/helpers/rake-helper'
+
+Cantiere::RakeHelper.new
View
45 bundle2rpm → bin/bundle2rpm 100644 → 100755
@@ -1,3 +1,4 @@
+#!/usr/bin/env ruby
require 'rubygems'
@@ -72,7 +73,7 @@ class BundleConverter
end
def dump_spec(output_dir, gemspec)
- rpmspec_path = File.join( output_dir, "#{gemspec.name}.spec" )
+ rpmspec_path = File.join( output_dir, "#{ruby_config.tree_prefix}#{gemspec.name}-gem.spec" )
puts "Writing #{rpmspec_path}"
FileUtils.mkdir_p( File.dirname( rpmspec_path ) )
File.open( rpmspec_path, 'w' ) do |file|
@@ -94,10 +95,15 @@ class SpecConverter
end
def emit(*args)
- puts args
+ #puts args
@out.puts( args )
end
+ def base_gem_package_name()
+ return "#{gem_name}-#{version}-#{platform}" if ( platform != 'ruby' )
+ "#{gem_name}-#{version}"
+ end
+
def gem_url()
if ( gemspec.platform != 'ruby' )
"http://rubygems.org/gems/#{gem_name}-#{version}-#{gemspec.platform}.gem"
@@ -140,6 +146,8 @@ class SpecConverter
dump_provides
dump_requires
+ dump_description
+
dump_prep
dump_build
dump_install
@@ -167,7 +175,6 @@ class SpecConverter
emit "Group: Development/Languages"
emit "License: GPLv2+ or Ruby"
emit "Summary: #{summary}"
- emit "Description: #{description}"
if (gemspec.homepage)
emit "URL: #{gemspec.homepage}"
@@ -185,12 +192,21 @@ class SpecConverter
def dump_requires
emit "Requires: ruby(abi) = %{ruby_abi}"
emit ""
- gemspec.dependencies.each do |dep|
- emit "Requires: %{tree_prefix}rubygem(#{dep.name}) #{dep.requirement.to_rpm}"
+ gemspec.runtime_dependencies.each do |dep|
+ for req in dep.requirement.to_rpm
+ emit "Requires: %{tree_prefix}rubygem(#{dep.name}) #{req}"
+ end
end
emit ""
end
+ def dump_description
+ emit "%description"
+ emit ""
+ emit description
+ emit ""
+ end
+
def dump_prep
emit "%prep"
@@ -208,7 +224,7 @@ class SpecConverter
emit "rm -rf %{buildroot}"
emit "install -m 755 -d %{buildroot}%{gem_dir}"
emit "install -m 755 -d %{buildroot}%{bin_dir}"
- emit "gem install --local --bindir %{bin_dir} --install-dir %{buildroot}%{gem_dir} --force --ignore-dependencies --platform #{platform}"
+ emit "gem install --local --bindir %{buildroot}%{bin_dir} --install-dir %{buildroot}%{gem_dir} --force --ignore-dependencies --platform #{platform} %{SOURCE0}"
emit ""
end
@@ -223,18 +239,15 @@ class SpecConverter
emit "%files"
emit ""
emit "%defattr(-, root, root, -)"
- for f in gemspec.executables
- emit "%{bin_dir}/#{f}"
- emit "%{gem_dir}%{bin_dir}/#{f}"
- end
- emit "%{gem_dir}/gems/%{gem_name}-%{version}/"
- emit "%{gem_dir}/cache/%{gemname}-%{version}.gem"
- emit "%{gem_dir}/specifications/%{gemname}-%{version}.gemspec"
+ emit "%{bin_dir}/"
+ emit "%{gem_dir}/gems/#{base_gem_package_name}/"
+ emit "%{gem_dir}/cache/#{base_gem_package_name}.gem"
+ emit "%{gem_dir}/specifications/#{base_gem_package_name}.gemspec"
if gemspec.has_rdoc
- emit "%doc %{gemdir}/doc/%{gemname}-%{version}"
+ emit "%doc %{gem_dir}/doc/#{base_gem_package_name}"
end
for f in gemspec.extra_rdoc_files
- emit "%doc %{geminstdir}/#{f}"
+ emit "%doc %{gem_instdir}/#{f}"
end
emit ""
end
@@ -249,4 +262,4 @@ end
converter = BundleConverter.new( 'Gemfile' )
converter.resolve!
-converter.dump_specs( 'specs' )
+converter.dump_specs( 'specs/gems' )
1 lib/cantiere
@@ -0,0 +1 @@
+Subproject commit e5c27aae9cde20913b7fc0c44f4de543c63b707b
View
43 specs/torquebox-jruby.spec
@@ -0,0 +1,43 @@
+%define torquebox_version 1.0.0.Beta22
+
+%global _binaries_in_noarch_packages_terminate_build 0
+
+Summary: TorqueBox JRuby
+Name: torquebox-jruby
+Version: %{torquebox_version}
+Release: 1
+License: LGPL
+BuildArch: noarch
+Group: Applications/System
+Source0: http://repository.torquebox.org/maven2/releases/org/torquebox/torquebox-dist/1.0.0.Beta22/torquebox-dist-%{torquebox_version}-bin.zip
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+
+%description
+The TorqueBox JRuby Distribution
+
+%define __jar_repack %{nil}
+
+%prep
+%setup -T -b 0 -n torquebox-%{torquebox_version}
+
+%install
+rm -Rf $RPM_BUILD_ROOT
+
+cd %{_topdir}/BUILD
+
+install -d -m 755 $RPM_BUILD_ROOT/opt/
+
+# copy jruby
+cp -R torquebox-%{torquebox_version}/jruby $RPM_BUILD_ROOT/opt/
+rm -Rf $RPM_BUILD_ROOT/opt/jruby/lib/ruby/gems/1.8/cache
+
+%clean
+rm -Rf $RPM_BUILD_ROOT
+
+%files
+%defattr(-,root,root)
+/
+
+%changelog
+* Mon Oct 04 2010 Bob McWhirter
+- Initial release

0 comments on commit 0167399

Please sign in to comment.