File rubygems-1.3.1_buildroot.patch of Package rubygems
Index: lib/rubygems/install_update_options.rb
===================================================================
--- lib/rubygems/install_update_options.rb.orig 2008-06-24 20:56:30.000000000 +0200
+++ lib/rubygems/install_update_options.rb 2008-11-21 23:29:36.949017634 +0100
@@ -31,6 +31,12 @@ module Gem::InstallUpdateOptions
options[:bin_dir] = File.expand_path(value)
end
+ add_option(:"Install", '-B', '--build-root DIR',
+ 'Temporary installation root. Useful for building',
+ 'packages. Do not use this when installing remote gems.') do |value, options|
+ options[:build_root] = File.expand_path(value)
+ end
+
add_option(:"Install/Update", '-d', '--[no-]rdoc',
'Generate RDoc documentation for the gem on',
'install') do |value, options|
Index: lib/rubygems/installer.rb
===================================================================
--- lib/rubygems/installer.rb.orig 2008-10-10 20:22:39.000000000 +0200
+++ lib/rubygems/installer.rb 2008-11-21 23:30:35.937015743 +0100
@@ -106,9 +106,10 @@ class Gem::Installer
@format_executable = options[:format_executable]
@security_policy = options[:security_policy]
@wrappers = options[:wrappers]
- @bin_dir = options[:bin_dir]
+ @bin_dir = options[:bin_dir] || Gem.bindir(@gem_home)
@development = options[:development]
@source_index = options[:source_index]
+ @build_root = options[:build_root]
begin
@format = Gem::Format.from_file_by_path @gem, @security_policy
@@ -116,6 +117,13 @@ class Gem::Installer
raise Gem::InstallError, "invalid gem format for #{@gem}"
end
+
+ unless @build_root.nil? or @build_root == ""
+ @build_root = Pathname.new(@build_root).expand_path
+ @gem_home = File.join(@build_root,@gem_home)
+ @bin_dir = File.join(@build_root,@bin_dir)
+ end
+
begin
FileUtils.mkdir_p @gem_home
rescue Errno::EACCESS, Errno::ENOTDIR
Index: lib/rubygems/commands/install_command.rb
===================================================================
--- lib/rubygems/commands/install_command.rb.orig 2008-09-10 23:55:28.000000000 +0200
+++ lib/rubygems/commands/install_command.rb 2008-11-21 23:29:36.977015529 +0100
@@ -72,6 +72,7 @@ version is also installed.
:format_executable => options[:format_executable],
:ignore_dependencies => options[:ignore_dependencies],
:install_dir => options[:install_dir],
+ :build_root => options[:build_root],
:security_policy => options[:security_policy],
:wrappers => options[:wrappers],
:bin_dir => options[:bin_dir],
Index: lib/rubygems/dependency_installer.rb
===================================================================
--- lib/rubygems/dependency_installer.rb.orig 2008-08-12 23:50:22.000000000 +0200
+++ lib/rubygems/dependency_installer.rb 2008-11-21 23:29:36.997016383 +0100
@@ -65,6 +65,7 @@ class Gem::DependencyInstaller
@installed_gems = []
@install_dir = options[:install_dir] || Gem.dir
+ @build_root = options[:build_root]
@cache_dir = options[:cache_dir] || @install_dir
end
@@ -241,6 +242,7 @@ class Gem::DependencyInstaller
:format_executable => @format_executable,
:ignore_dependencies => @ignore_dependencies,
:install_dir => @install_dir,
+ :build_root => @build_root,
:security_policy => @security_policy,
:source_index => @source_index,
:user_install => @user_install,