[DRE-commits] [SCM] gem2deb.git branch, master, updated. 006f36dfa0c064d2712f58af3e028ca6bdc1ee0f

Vincent Fourmond fourmond at debian.org
Wed May 11 16:03:13 UTC 2011


The following commit has been merged in the master branch:
commit 3c9294533597f5e0e220fd394642cdd196667818
Author: Vincent Fourmond <fourmond at debian.org>
Date:   Wed May 11 16:13:03 2011 +0200

    Moving the specific part of the "traditional" installation to its own method + setting up a flag for choosing setup.rb (still useless)

diff --git a/bin/dh_ruby b/bin/dh_ruby
index 1c309cd..97d97f7 100755
--- a/bin/dh_ruby
+++ b/bin/dh_ruby
@@ -20,39 +20,45 @@ require 'gem2deb/dh_ruby'
 require 'optparse'
 include Gem2Deb
 
+setuprb = false
+
 optparse = OptionParser.new do |opts|
   opts.on('-h', '--help', 'show help') do
     puts opts
     exit
   end
 
+  opts.on('', '--setuprb', 'use setup.rb for installation') do
+    setuprb = true
+  end
+
   opts.on('-v', '--version', 'show dh_ruby version') do
     puts "dh_ruby version #{Gem2Deb::VERSION}"
     exit
   end
 
   opts.on('', '--clean', 'debhelper clean helper') do
-    DhRuby::new.clean
+    DhRuby::new(setuprb).clean
     exit(0)
   end
 
   opts.on('', '--configure', 'debhelper configure helper') do
-    DhRuby::new.configure
+    DhRuby::new(setuprb).configure
     exit(0)
   end
 
   opts.on('', '--build', 'debhelper build helper') do
-    DhRuby::new.build
+    DhRuby::new(setuprb).build
     exit(0)
   end
 
   opts.on('', '--test', 'debhelper test helper') do
-    DhRuby::new.test
+    DhRuby::new(setuprb).test
     exit(0)
   end
 
   opts.on('', '--install', 'debhelper install helper') do
-    DhRuby::new.install(ARGV)
+    DhRuby::new(setuprb).install(ARGV)
     exit(0)
   end
 end
diff --git a/lib/gem2deb/dh_ruby.rb b/lib/gem2deb/dh_ruby.rb
index e032abc..8ae9bec 100644
--- a/lib/gem2deb/dh_ruby.rb
+++ b/lib/gem2deb/dh_ruby.rb
@@ -59,11 +59,15 @@ module Gem2Deb
 
     attr_reader :metadata
 
-    def initialize
+    # Whether we run the standard dh_ruby build or the setuprb one
+    attr_reader :setuprb
+
+    def initialize(setuprb = false)
       @verbose = true
       @bindir = '/usr/bin'
       @skip_checks = nil
       @metadata = Gem2Deb::Metadata.new('.')
+      @setuprb = setuprb
     end
     
     def clean
@@ -103,37 +107,11 @@ module Gem2Deb
 
       package = packages.first
 
-      install_files('bin', find_files('bin'), destdir(package, :bindir), 755) if File::directory?('bin')
-
-      install_files('lib', find_files('lib'), destdir(package, :libdir), 644) if File::directory?('lib')
-
-
-      if metadata.has_native_extensions?
-        supported_versions.each do |rubyver|
-          puts "Building extension for #{rubyver} ..." if @verbose
-          run("#{SUPPORTED_RUBY_VERSIONS[rubyver]} -I#{LIBDIR} #{EXTENSION_BUILDER} #{package}")
-
-          # Remove duplicate files installed by rubygems in the arch dir
-          # This is a hack to workaround a problem in rubygems
-          vendor_dir = destdir(package, :libdir)
-          vendor_arch_dir = destdir(package, :archdir, rubyver)
-          if File::exists?(vendor_dir) and File::exists?(vendor_arch_dir)
-            remove_duplicate_files(vendor_dir, vendor_arch_dir)
-          end
-          # run tests for this version of ruby
-          if not run_tests(rubyver)
-            supported_versions.delete(rubyver)
-          end
-        end
+      if setuprb
       else
-        # run tests for all versions
-        tested_versions = supported_versions
-        tested_versions.each do |rubyver|
-          if not run_tests(rubyver)
-            supported_versions.delete(rubyver)
-          end
-        end
+        traditional_install(package, supported_versions)
       end
+        
 
       File::open("debian/#{package}.substvars", "a") do |fd|
         fd.puts "ruby:Versions=#{supported_versions.join(' ')}"
@@ -168,6 +146,42 @@ module Gem2Deb
       end
     end
 
+    # Here comes the code for installation specific to the traditional
+    # installation scheme.
+    def traditional_install(package, supported_versions)
+      install_files('bin', find_files('bin'), destdir(package, :bindir), 755) if File::directory?('bin')
+
+      install_files('lib', find_files('lib'), destdir(package, :libdir), 644) if File::directory?('lib')
+
+
+      if metadata.has_native_extensions?
+        supported_versions.each do |rubyver|
+          puts "Building extension for #{rubyver} ..." if @verbose
+          run("#{SUPPORTED_RUBY_VERSIONS[rubyver]} -I#{LIBDIR} #{EXTENSION_BUILDER} #{package}")
+
+          # Remove duplicate files installed by rubygems in the arch dir
+          # This is a hack to workaround a problem in rubygems
+          vendor_dir = destdir(package, :libdir)
+          vendor_arch_dir = destdir(package, :archdir, rubyver)
+          if File::exists?(vendor_dir) and File::exists?(vendor_arch_dir)
+            remove_duplicate_files(vendor_dir, vendor_arch_dir)
+          end
+          # run tests for this version of ruby
+          if not run_tests(rubyver)
+            supported_versions.delete(rubyver)
+          end
+        end
+      else
+        # run tests for all versions
+        tested_versions = supported_versions
+        tested_versions.each do |rubyver|
+          if not run_tests(rubyver)
+            supported_versions.delete(rubyver)
+          end
+        end
+      end
+    end
+
     def remove_duplicate_files(src, dst)
       candidates = (Dir::entries(src) & Dir::entries(dst)) - ['.', '..']
       candidates.each do |cand|

-- 
gem2deb.git



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