[DRE-commits] [SCM] gem2deb.git branch, master, updated. 006f36dfa0c064d2712f58af3e028ca6bdc1ee0f
Vincent Fourmond
fourmond at debian.org
Wed May 11 16:03:01 UTC 2011
The following commit has been merged in the master branch:
commit d3d10e9946a362afdbcc5075fdd46ec2ee80bac0
Author: Vincent Fourmond <fourmond at debian.org>
Date: Wed May 11 15:25:21 2011 +0200
Setup a dedicated method to provide installation paths
diff --git a/lib/gem2deb/dh_ruby.rb b/lib/gem2deb/dh_ruby.rb
index 4d6e6c7..e032abc 100644
--- a/lib/gem2deb/dh_ruby.rb
+++ b/lib/gem2deb/dh_ruby.rb
@@ -103,9 +103,9 @@ module Gem2Deb
package = packages.first
- install_files('bin', find_files('bin'), File.join(destdir_for(package), @bindir), 755) if File::directory?('bin')
+ install_files('bin', find_files('bin'), destdir(package, :bindir), 755) if File::directory?('bin')
- install_files('lib', find_files('lib'), File.join(destdir_for(package), RUBY_CODE_DIR), 644) if File::directory?('lib')
+ install_files('lib', find_files('lib'), destdir(package, :libdir), 644) if File::directory?('lib')
if metadata.has_native_extensions?
@@ -115,8 +115,8 @@ module Gem2Deb
# Remove duplicate files installed by rubygems in the arch dir
# This is a hack to workaround a problem in rubygems
- vendor_dir = File.join(destdir_for(package), RUBY_CODE_DIR)
- vendor_arch_dir = File.join(destdir_for(package), `#{SUPPORTED_RUBY_VERSIONS[rubyver]} -rrbconfig -e "puts RbConfig::CONFIG['vendorarchdir']"`.chomp)
+ 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
@@ -150,6 +150,24 @@ module Gem2Deb
protected
+ # This function returns the installation path for the given
+ # package and the given "component", which is one of:
+ # * :bindir
+ # * :libdir
+ # * :archdir
+ #
+ # _rubyver_ is the ruby version, needed only for :archdir for now.
+ def destdir(package, which, rubyver = nil)
+ case which
+ when :bindir
+ return File.join(destdir_for(package), @bindir)
+ when :libdir
+ 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)
+ 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