File rubygems-1.3.1_install_into_buildroot.patch of Package rubygems

Index: setup.rb
===================================================================
--- setup.rb.orig	2008-07-11 10:08:08.000000000 +0200
+++ setup.rb	2008-11-21 22:00:26.465514960 +0100
@@ -29,7 +29,8 @@ opts = GetoptLong.new(
     [ '--no-rdoc',                      GetoptLong::NO_ARGUMENT ],
     [ '--no-ri',                        GetoptLong::NO_ARGUMENT ],
     [ '--vendor',                       GetoptLong::NO_ARGUMENT ],
-    [ '--destdir',                      GetoptLong::REQUIRED_ARGUMENT ]
+    [ '--destdir',                      GetoptLong::REQUIRED_ARGUMENT ],
+    [ '--buildroot',                    GetoptLong::REQUIRED_ARGUMENT ]
 )
 
 prefix = ''
@@ -63,6 +64,8 @@ Options:
                          (Requires Ruby 1.8.7)
   --destdir              Root directory to install rubygems into
                          Used mainly for packaging RubyGems
+                         (For backwards compatibility we also
+                          support --buildroot.)
 HELP
     exit 0
 
@@ -87,6 +90,8 @@ HELP
 
   when '--destdir'
     install_destdir = File.expand_path(arg)
+  when '--buildroot'
+    install_destdir = File.expand_path(arg)
   end
 end
 
@@ -95,11 +100,11 @@ require 'rbconfig'
 require 'tmpdir'
 require 'pathname'
 
+top_dir = Pathname.new(RbConfig::TOPDIR || RbConfig::CONFIG["prefix"])
 unless install_destdir.empty? then
   default_dir = Pathname.new(Gem.default_dir)
-  top_dir = Pathname.new(RbConfig::TOPDIR)
   ENV['GEM_HOME'] ||= File.join(install_destdir,
-                                default_dir.relative_path_from(top_dir))
+                                default_dir)
 end
 
 include FileUtils::Verbose
@@ -137,12 +142,11 @@ else
 end
 
 unless install_destdir.empty?
-  top_dir = Pathname.new(RbConfig::TOPDIR)
   lib_dir_p = Pathname.new(lib_dir)
   bin_dir_p = Pathname.new(bin_dir)
 
-  lib_dir = File.join install_destdir, lib_dir_p.relative_path_from(top_dir)
-  bin_dir = File.join install_destdir, bin_dir_p.relative_path_from(top_dir)
+  lib_dir = File.join install_destdir, lib_dir_p
+  bin_dir = File.join install_destdir, bin_dir_p
 end
 
 mkdir_p lib_dir
openSUSE Build Service is sponsored by