[DRE-commits] [gem2deb] 01/01: ExtractMethod Gem2deb#run_ruby

Antonio Terceiro terceiro at moszumanska.debian.org
Fri Apr 10 15:41:13 UTC 2015


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

terceiro pushed a commit to branch master
in repository gem2deb.

commit 6da87ee495b93ac33a8fcffd7755064cac2abdc2
Author: Antonio Terceiro <terceiro at debian.org>
Date:   Fri Apr 10 17:39:43 2015 +0200

    ExtractMethod Gem2deb#run_ruby
    
    It won't pass LIBDIR into command line if installed
---
 debian/changelog         | 4 ++++
 lib/gem2deb.rb           | 9 +++++++++
 lib/gem2deb/dh_ruby.rb   | 2 +-
 lib/gem2deb/installer.rb | 2 +-
 4 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index eec0693..7d8dc0c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,10 @@ gem2deb (0.14) UNRELEASED; urgency=medium
 
   * dh-make-ruby: fix conversion of gem names with uppercase characters into
     debian package names
+  * dh_ruby: don't pass LIBDIR into command line when running different
+    interpreters while installed system-wide. This avoids extra
+    -I/usr/lib/ruby/vendor_ruby in command lines and eases debugging running
+    processes for packages that e.g. hang while running their tests.
 
  -- Antonio Terceiro <terceiro at debian.org>  Fri, 10 Apr 2015 10:49:34 +0200
 
diff --git a/lib/gem2deb.rb b/lib/gem2deb.rb
index 7a5e26d..6a37d52 100644
--- a/lib/gem2deb.rb
+++ b/lib/gem2deb.rb
@@ -57,6 +57,15 @@ module Gem2Deb
     end
   end
 
+  def run_ruby(ruby, *args)
+    cmd = args.dup
+    if !$LOAD_PATH.include?(LIBDIR)
+      cmd.unshift("-I", LIBDIR)
+    end
+    cmd.unshift(ruby)
+    run(*cmd)
+  end
+
   private
 
   def _format_cmdline(argv)
diff --git a/lib/gem2deb/dh_ruby.rb b/lib/gem2deb/dh_ruby.rb
index 4a20107..915e2cd 100644
--- a/lib/gem2deb/dh_ruby.rb
+++ b/lib/gem2deb/dh_ruby.rb
@@ -150,7 +150,7 @@ module Gem2Deb
       end
 
       begin
-        run(SUPPORTED_RUBY_VERSIONS[rubyver], '-I' + LIBDIR, TEST_RUNNER)
+        run_ruby(SUPPORTED_RUBY_VERSIONS[rubyver], TEST_RUNNER)
       rescue Gem2Deb::CommandFailed
         handle_test_failure(rubyver)
       end
diff --git a/lib/gem2deb/installer.rb b/lib/gem2deb/installer.rb
index ecf18d8..82a42a1 100644
--- a/lib/gem2deb/installer.rb
+++ b/lib/gem2deb/installer.rb
@@ -33,7 +33,7 @@ module Gem2Deb
       if metadata.has_native_extensions?
         ruby_versions.each do |rubyver|
           puts "Building extension for #{rubyver} ..." if verbose
-          run(SUPPORTED_RUBY_VERSIONS[rubyver], "-I#{LIBDIR}", EXTENSION_BUILDER, root, destdir_base)
+          run_ruby(SUPPORTED_RUBY_VERSIONS[rubyver], EXTENSION_BUILDER, root, destdir_base)
 
           # Remove duplicate files installed by rubygems in the arch dir
           # This is a hack to workaround a problem in rubygems

-- 
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