[DRE-commits] [gem2deb] 01/08: dh_ruby: install a single gemspec for pure-Ruby packages

Antonio Terceiro terceiro at moszumanska.debian.org
Mon Feb 10 16:06:26 UTC 2014


This is an automated email from the git hooks/post-receive script.

terceiro pushed a commit to branch master
in repository gem2deb.

commit 43f29d7c11841e996ece0b0c94b7d2cda049695c
Author: Antonio Terceiro <terceiro at debian.org>
Date:   Sun Feb 9 20:37:11 2014 -0300

    dh_ruby: install a single gemspec for pure-Ruby packages
    
    * dh_ruby: install a single gemspec for pure-Ruby packages
      - This single gemspec will be installed at
        /usr/share/rubygems-integration/all and will be made available to all
        interpreters by rubygems-integration >= 1.5. This way when a new
        interpreter is added there is no need to re-upload every package to
        make it seen by that new interpreter rubygems.
---
 debian/changelog          |  6 ++++++
 lib/gem2deb/installer.rb  | 11 +++++++++--
 test/unit/dh_ruby_test.rb |  7 +++++--
 3 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 56e91ad..b49781f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,12 @@ gem2deb (0.6.2) UNRELEASED; urgency=medium
     - that -w does not help us much
     - build logs will become a lot cleaner now
   * dh_ruby: remove blank lines from --help output
+  * dh_ruby: install a single gemspec for pure-Ruby packages
+    - This single gemspec will be installed at
+      /usr/share/rubygems-integration/all and will be made available to all
+      interpreters by rubygems-integration >= 1.5. This way when a new
+      interpreter is added there is no need to re-upload every package to
+      make it seen by that new interpreter rubygems.
 
   [ Cédric Boutillier ]
   * Make build of C extensions verbose
diff --git a/lib/gem2deb/installer.rb b/lib/gem2deb/installer.rb
index 0324a96..0852670 100644
--- a/lib/gem2deb/installer.rb
+++ b/lib/gem2deb/installer.rb
@@ -66,8 +66,15 @@ module Gem2Deb
 
     def install_gemspec
       if metadata.gemspec
-        ruby_versions.each do |version|
-          target = File.join(destdir(:root), "/usr/share/rubygems-integration/#{RUBY_CONFIG_VERSION[version]}/specifications/#{metadata.name}-#{metadata.version}.gemspec")
+        versions =
+          if metadata.has_native_extensions?
+            ruby_versions.map { |v| RUBY_CONFIG_VERSION[v] }
+          else
+            ['all']
+          end
+        versions.each do |version|
+          target = File.join(destdir(:root), "/usr/share/rubygems-integration/#{version}/specifications/#{metadata.name}-#{metadata.version}.gemspec")
+          puts "generating gemspec at ${target}"
           FileUtils.mkdir_p(File.dirname(target))
           File.open(target, 'w') do |file|
             file.write(metadata.gemspec.to_ruby)
diff --git a/test/unit/dh_ruby_test.rb b/test/unit/dh_ruby_test.rb
index e06bccf..bd0f242 100644
--- a/test/unit/dh_ruby_test.rb
+++ b/test/unit/dh_ruby_test.rb
@@ -110,9 +110,12 @@ class DhRubyTest < Gem2DebTestCase
   end
 
   context 'installing gemspec' do
+      should 'install gemspec for simplegem for all interpreters' do
+        assert_installed SIMPLE_GEM_DIRNAME, 'ruby-simplegem', "/usr/share/rubygems-integration/all/specifications/simplegem-0.0.1.gemspec"
+      end
     SUPPORTED_VERSION_NUMBERS.each do |version|
-      should 'install gemspec for simplegem under Ruby ' + version do
-        assert_installed SIMPLE_GEM_DIRNAME, 'ruby-simplegem', "/usr/share/rubygems-integration/#{version}/specifications/simplegem-0.0.1.gemspec"
+      should 'install gemspec for simpleextension under Ruby ' + version do
+        assert_installed SIMPLE_EXTENSION_DIRNAME, 'ruby-simpleextension', "/usr/share/rubygems-integration/#{version}/specifications/simpleextension-1.2.3.gemspec"
       end
     end
   end

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/gem2deb.git



More information about the Pkg-ruby-extras-commits mailing list