File rubygems-1.5.0_buildroot.patch of Package ruby20

Index: lib/rubygems/dependency_installer.rb
===================================================================
--- lib/rubygems/dependency_installer.rb.orig
+++ lib/rubygems/dependency_installer.rb
@@ -58,6 +58,7 @@ class Gem::DependencyInstaller
 
   def initialize(options = {})
     @install_dir = options[:install_dir] || Gem.dir
+    @build_root = options[:build_root]
 
     if options[:install_dir] then
       # HACK shouldn't change the global settings, needed for -i behavior
@@ -353,6 +354,7 @@ class Gem::DependencyInstaller
                                 :format_executable   => @format_executable,
                                 :ignore_dependencies => @ignore_dependencies,
                                 :install_dir         => @install_dir,
+                                :build_root          => @build_root,
                                 :security_policy     => @security_policy,
                                 :user_install        => @user_install,
                                 :wrappers            => @wrappers,
Index: lib/rubygems/installer.rb
===================================================================
--- lib/rubygems/installer.rb.orig
+++ lib/rubygems/installer.rb
@@ -555,8 +555,17 @@ class Gem::Installer
     # (or use) a new bin dir under the gem_home.
     @bin_dir             = options[:bin_dir] || Gem.bindir(gem_home)
     @development         = options[:development]
+    @build_root          = options[:build_root]
 
     @build_args          = options[:build_args] || Gem::Command.build_args
+
+    unless @build_root.nil?
+      require 'pathname'
+      @build_root = Pathname.new(@build_root).expand_path
+      @bin_dir = File.join(@build_root, options[:bin_dir] || Gem.bindir(@gem_home))
+      @gem_home = File.join(@build_root,@gem_home)
+      alert_warning "You build with buildroot.\n  Build root: #{@build_root}\n  Bin dir: #{@bin_dir}\n  Gem home: #{@gem_home}"
+    end
   end
 
   # DOC: Missing docs or :nodoc:.
Index: lib/rubygems/install_update_options.rb
===================================================================
--- lib/rubygems/install_update_options.rb.orig
+++ lib/rubygems/install_update_options.rb
@@ -56,6 +56,12 @@ module Gem::InstallUpdateOptions
                            end
     end
 
+    add_option(:"Install/Update", '--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", '-N', '--no-document',
                'Disable documentation generation') do |value, options|
       options[:document] = []
openSUSE Build Service is sponsored by