[DRE-commits] [SCM] gem2deb.git branch, master, updated. a6511ff4b681e84b05790893bced3738dd686085
Lucas Nussbaum
lucas at lucas-nussbaum.net
Fri Mar 25 08:25:48 UTC 2011
The following commit has been merged in the master branch:
commit 4a4a78ecfd7458ce316e74269568618e1fbaf2a4
Author: Lucas Nussbaum <lucas at lucas-nussbaum.net>
Date: Fri Mar 25 09:23:05 2011 +0100
Support building only for specific ruby versions.
diff --git a/bin/dh-make-ruby b/bin/dh-make-ruby
index 6f847da..e9390bf 100755
--- a/bin/dh-make-ruby
+++ b/bin/dh-make-ruby
@@ -36,6 +36,9 @@ optparse = OptionParser.new do |opts|
options[:source_package_name] = package_name
end
+ opts.on('', '--ruby-versions VERSIONS', 'ruby versions to use (default: all)') do |versions|
+ options[:ruby_versions] = versions
+ end
end
optparse.parse!
@@ -75,6 +78,14 @@ library, then it should use the default. On the other hand, if the packages is
mainly used as an application, then you should drop the ruby- prefix by using
this option an explicit package u.
+=item B<--ruby-versions VERSIONS>
+
+Ruby versions to build the package for. This is used to generate the
+X-Ruby-Versions: field in the source package, that can later be used to tune
+this value. By default, gem2deb generates a package that works on all known
+Ruby versions, but it might be necessary to only build the package for Ruby
+1.8, for example (using B<--ruby-versions "ruby1.8">).
+
=item B<-h>, B<--help>
Displays the help
diff --git a/bin/gem2deb b/bin/gem2deb
index 5b84bfe..90c63e7 100755
--- a/bin/gem2deb
+++ b/bin/gem2deb
@@ -57,6 +57,11 @@ optparse = OptionParser.new do |opts|
dh_make_ruby_options[:source_package_name] = package_name
end
+ opts.on('', '--ruby-versions VERSIONS', 'ruby versions to use (default: all)') do |versions|
+ dh_make_ruby_options[:ruby_versions] = versions
+ end
+
+
end
optparse.parse!
@@ -144,6 +149,11 @@ Only build a Debian source package (do not build binary packages).
Specify package name (default: ruby-*).
Passed to dh-make-ruby. See B<dh-make-ruby(1)>.
+=item B<--ruby-versions VERSIONS>
+
+Ruby versions to build the package for (default: all).
+Passed to dh-make-ruby. See B<dh-make-ruby(1)>.
+
=item B<-h>, B<--help>
Displays B<gem2deb> usage information.
diff --git a/debian/TODO b/debian/TODO
index d1660ab..1f6bd90 100644
--- a/debian/TODO
+++ b/debian/TODO
@@ -15,3 +15,5 @@ options as appropriate on the command line).
there should be a way to opt out ruby1.9.1 build (example of package failing: termios)
+
+write test suite for Ruby-Versions settings
diff --git a/debian/changelog b/debian/changelog
index ae906db..45b4502 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -17,8 +17,9 @@ gem2deb (0.1.1) experimental; urgency=low
* Rewrite depends after dh_shlibdeps to create ORed deps.
* Add perl:Depends, reorganize Depends:
* Switch to 3.0 (native)
+ * Support building only for specific ruby versions.
- -- Lucas Nussbaum <lucas at lucas-nussbaum.net> Fri, 25 Mar 2011 07:16:00 +0100
+ -- Lucas Nussbaum <lucas at lucas-nussbaum.net> Fri, 25 Mar 2011 09:22:49 +0100
gem2deb (0.1.0) experimental; urgency=low
diff --git a/lib/gem2deb/dh_make_ruby.rb b/lib/gem2deb/dh_make_ruby.rb
index 3b4bf64..90ceae0 100644
--- a/lib/gem2deb/dh_make_ruby.rb
+++ b/lib/gem2deb/dh_make_ruby.rb
@@ -48,10 +48,13 @@ module Gem2Deb
attr_accessor :orig_tarball_dir
+ attr_accessor :ruby_versions
+
def initialize(tarball, options = {})
self.source_tarball_name = File.basename(tarball)
self.orig_tarball_dir = File.dirname(tarball)
+ self.ruby_versions = 'all'
options.each do |attr,value|
self.send("#{attr}=", value)
end
@@ -356,9 +359,11 @@ Standards-Version: 3.9.1
#Vcs-Git: git://git.debian.org/pkg-ruby-extras/<%= source_package_name %>.git
#Vcs-Browser: http://git.debian.org/?p=pkg-ruby-extras/<%= source_package_name %>;a=summary
Homepage: <%= homepage ? homepage : 'FIXME'%>
+XS-Ruby-Versions: <%= ruby_versions %>
Package: <%= binary_package.name %>
Architecture: <%= binary_package.architecture %>
+XB-Ruby-Versions: ${ruby:Versions}
Depends: <%= binary_package.dependencies.join(', ') %>
<% if binary_package.gem_dependencies.length > 0 %>
# <%= binary_package.gem_dependencies.join(', ') %>
@@ -373,10 +378,11 @@ Description: <%= short_description ? short_description : 'FIXME' %>
#!/usr/bin/make -f
#export DH_VERBOSE=1
#
-# Uncomment to ignore all test failures
+# Uncomment to ignore all test failures (but the tests will run anyway)
#export DH_RUBY_IGNORE_TESTS=all
#
-# Uncomment to ignore some test failures. Valid values:
+# Uncomment to ignore some test failures (but the tests will run anyway).
+# Valid values:
#export DH_RUBY_IGNORE_TESTS=ruby1.8 ruby1.9.1 require-rubygems
%:
diff --git a/lib/gem2deb/dh_ruby.rb b/lib/gem2deb/dh_ruby.rb
index 596b082..ecd8e1f 100644
--- a/lib/gem2deb/dh_ruby.rb
+++ b/lib/gem2deb/dh_ruby.rb
@@ -91,15 +91,33 @@ module Gem2Deb
install_files('lib', find_files('lib'), File.join(destdir_for(package), RUBY_CODE_DIR), 644) if File::directory?('lib')
+ # find ruby versions to build the package for.
+ l = IO::readlines('debian/control').grep(/^XS-Ruby-Versions: /)
+ if l.empty?
+ puts "No XS-Ruby-Versions: field found in source!"
+ exit(1)
+ end
+ supported_versions = l[0].split[1..-1]
+ if supported_versions.include?('all')
+ supported_versions = SUPPORTED_RUBY_VERSIONS.keys
+ end
+
if metadata.has_native_extensions?
- SUPPORTED_RUBY_VERSIONS.each_key do |rubyver|
+ supported_versions.each do |rubyver|
puts "Building extension for #{rubyver} ..." if @verbose
run("#{SUPPORTED_RUBY_VERSIONS[rubyver]} -I#{LIBDIR} #{EXTENSION_BUILDER} #{package}")
end
end
# run tests
- SUPPORTED_RUBY_VERSIONS.each_key do |rubyver|
- run_tests(rubyver)
+ tested_versions = supported_versions
+ tested_versions.each do |rubyver|
+ if not run_tests(rubyver)
+ supported_versions.delete(rubyver)
+ end
+ end
+
+ File::open("debian/#{package}.substvars", "a") do |fd|
+ fd.puts "ruby:Versions=#{supported_versions.join(' ')}"
end
update_shebangs(package)
@@ -190,6 +208,9 @@ module Gem2Deb
end
if $?.exitstatus != 0
handle_test_failure(rubyver)
+ return false
+ else
+ return true
end
end
--
gem2deb.git
More information about the Pkg-ruby-extras-commits
mailing list