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

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


The following commit has been merged in the master branch:
commit 481c2485756c4324a7841747a78ea4d85a33630e
Author: Vincent Fourmond <fourmond at debian.org>
Date:   Wed May 11 17:35:42 2011 +0200

    Implement the setuprb install, on the dh_ruby side

diff --git a/lib/gem2deb/dh_ruby.rb b/lib/gem2deb/dh_ruby.rb
index 8ae9bec..fe5fd18 100644
--- a/lib/gem2deb/dh_ruby.rb
+++ b/lib/gem2deb/dh_ruby.rb
@@ -108,6 +108,7 @@ module Gem2Deb
       package = packages.first
 
       if setuprb
+        setuprb_install(package, supported_versions)
       else
         traditional_install(package, supported_versions)
       end
@@ -133,6 +134,7 @@ module Gem2Deb
     # * :bindir
     # * :libdir
     # * :archdir
+    # * :prefix
     #
     # _rubyver_ is the ruby version, needed only for :archdir for now.
     def destdir(package, which, rubyver = nil)
@@ -143,9 +145,41 @@ module Gem2Deb
         return File.join(destdir_for(package), RUBY_CODE_DIR)
       when :archdir
         return File.join(destdir_for(package), `#{SUPPORTED_RUBY_VERSIONS[rubyver]} -rrbconfig -e "puts RbConfig::CONFIG['vendorarchdir']"`.chomp)
+      when :prefix
+        return File.join(destdir_for(package), "usr/")
       end
     end
 
+    def spawn(cmd)
+      puts cmd
+      if ! system(cmd)
+        puts " -> failed"
+        exit(1)
+      end
+    end
+    # Here comes the code for installation specific to the traditional
+    # installation scheme.
+    def setuprb_install(package, supported_versions)
+      for rubyver in supported_version
+        ruby = SUPPORTED_VERSIONS[rubyver]
+        siteruby = destdir(package, :libdir, rubyver)
+        bindir = destdir(package, :bindir, rubyver)
+        archdir = destdir(package, :archdir, rubyver)
+        prefix = destdir(package, :prefix, rubyver)
+
+        # First configure
+        spawn("#{ruby} setup.rb config --prefix=#{prefix} --bindir=#{bindir} --siteruby=#{siteruby} --siterubyver=#{siteruby} --siterubyverarch=#{archdir}")
+        
+        # then clean (to make sure old things are removed)
+        spawn("#{ruby} setup.rb clean")
+
+        # And install. We risk installing twice to the same target,
+        # but that doesn't matter much.
+        spawn("#{ruby} setup.rb install")
+      end
+    end
+
+
     # Here comes the code for installation specific to the traditional
     # installation scheme.
     def traditional_install(package, supported_versions)

-- 
gem2deb.git



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