pvalena / rpms / ruby

Forked from rpms/ruby 6 years ago
Clone
14d2887
From b95b9942361104dc5b7fd08eb4970f893d8c1a54 Mon Sep 17 00:00:00 2001
e811eb0
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
14d2887
Date: Wed, 13 Feb 2013 13:12:30 +0100
929678a
Subject: [PATCH 1/3] Remove duplicated check.
14d2887
14d2887
The loaded specifications are rejected already in #gather_dependencies,
14d2887
so this condition cannot trigger.
14d2887
---
14d2887
 lib/rubygems/dependency_installer.rb | 3 ---
14d2887
 1 file changed, 3 deletions(-)
14d2887
14d2887
diff --git a/lib/rubygems/dependency_installer.rb b/lib/rubygems/dependency_installer.rb
14d2887
index d811f62..dffa8df 100644
14d2887
--- a/lib/rubygems/dependency_installer.rb
14d2887
+++ b/lib/rubygems/dependency_installer.rb
14d2887
@@ -319,9 +319,6 @@ class Gem::DependencyInstaller
14d2887
 
14d2887
     last = @gems_to_install.size - 1
14d2887
     @gems_to_install.each_with_index do |spec, index|
14d2887
-      # REFACTOR more current spec set hardcoding, should be abstracted?
14d2887
-      next if Gem::Specification.include?(spec) and index != last
14d2887
-
14d2887
       # TODO: make this sorta_verbose so other users can benefit from it
14d2887
       say "Installing gem #{spec.full_name}" if Gem.configuration.really_verbose
14d2887
 
14d2887
-- 
14d2887
1.8.1.2
14d2887
14d2887
14d2887
From 2fa9087b1986db6c7945c0f997fed2bfff5ce06a Mon Sep 17 00:00:00 2001
14d2887
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
14d2887
Date: Wed, 13 Feb 2013 15:47:47 +0100
929678a
Subject: [PATCH 2/3] Do not modify global Specification.dirs during
14d2887
 installation.
e811eb0
e811eb0
While gems are installed into --install-dir just fine even without
e811eb0
modifications of Specification.dirs, change in it makes inaccessible
e811eb0
gems already present on the system.
e811eb0
---
14d2887
 lib/rubygems/dependency_installer.rb | 15 ++++++---------
14d2887
 1 file changed, 6 insertions(+), 9 deletions(-)
e811eb0
e811eb0
diff --git a/lib/rubygems/dependency_installer.rb b/lib/rubygems/dependency_installer.rb
14d2887
index dffa8df..841f26a 100644
e811eb0
--- a/lib/rubygems/dependency_installer.rb
e811eb0
+++ b/lib/rubygems/dependency_installer.rb
14d2887
@@ -57,17 +57,14 @@ class Gem::DependencyInstaller
14d2887
   # :build_args:: See Gem::Installer::new
14d2887
 
14d2887
   def initialize(options = {})
14d2887
-    @install_dir = options[:install_dir] || Gem.dir
e811eb0
 
e811eb0
     if options[:install_dir] then
bf92566
-      # HACK shouldn't change the global settings, needed for -i behavior
bf92566
-      # maybe move to the install command?  See also github #442
bf92566
-      Gem::Specification.dirs = @install_dir
14d2887
-      Gem.ensure_gem_subdirectories @install_dir
14d2887
+      Gem.ensure_gem_subdirectories options[:install_dir]
e811eb0
     end
e811eb0
 
14d2887
     options = DEFAULT_OPTIONS.merge options
14d2887
 
14d2887
+    @install_dir         = options[:install_dir]
14d2887
     @bin_dir             = options[:bin_dir]
14d2887
     @dev_shallow         = options[:dev_shallow]
14d2887
     @development         = options[:development]
14d2887
@@ -91,7 +88,7 @@ class Gem::DependencyInstaller
14d2887
     @installed_gems = []
14d2887
     @toplevel_specs = nil
14d2887
 
14d2887
-    @cache_dir = options[:cache_dir] || @install_dir
14d2887
+    @cache_dir = options[:cache_dir] || @install_dir || Gem.dir
14d2887
 
14d2887
     # Set with any errors that SpecFetcher finds while search through
14d2887
     # gemspecs for a dep
14d2887
@@ -185,7 +182,7 @@ class Gem::DependencyInstaller
14d2887
     # that this isn't dependent only on the currently installed gems
14d2887
     dependency_list.specs.reject! { |spec|
14d2887
       not keep_names.include?(spec.full_name) and
14d2887
-      Gem::Specification.include?(spec)
14d2887
+      (!@install_dir && Gem::Specification.include?(spec))
14d2887
     }
14d2887
 
14d2887
     unless dependency_list.ok? or @ignore_dependencies or @force then
14d2887
@@ -237,7 +234,7 @@ class Gem::DependencyInstaller
14d2887
           to_do.push t.spec
14d2887
         end
14d2887
 
14d2887
-        results.remove_installed! dep
14d2887
+        results.remove_installed! dep unless @install_dir
14d2887
 
14d2887
         @available << results
14d2887
         results.inject_into_list dependency_list
14d2887
@@ -349,7 +346,7 @@ class Gem::DependencyInstaller
14d2887
                                 :force               => @force,
14d2887
                                 :format_executable   => @format_executable,
14d2887
                                 :ignore_dependencies => @ignore_dependencies,
14d2887
-                                :install_dir         => @install_dir,
14d2887
+                                :install_dir         => (@install_dir || Gem.dir),
14d2887
                                 :security_policy     => @security_policy,
14d2887
                                 :user_install        => @user_install,
14d2887
                                 :wrappers            => @wrappers,
e811eb0
-- 
14d2887
1.8.1.2
e811eb0
929678a
929678a
From d473204ce920702dd87257db49355929f31530d4 Mon Sep 17 00:00:00 2001
929678a
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
929678a
Date: Fri, 15 Feb 2013 17:02:44 +0100
929678a
Subject: [PATCH 3/3] Default to Gem.dir as late as possible.
929678a
929678a
---
929678a
 lib/rubygems/dependency_installer.rb | 2 +-
929678a
 lib/rubygems/installer.rb            | 4 ++--
929678a
 2 files changed, 3 insertions(+), 3 deletions(-)
929678a
929678a
diff --git a/lib/rubygems/dependency_installer.rb b/lib/rubygems/dependency_installer.rb
929678a
index 841f26a..abcfa0f 100644
929678a
--- a/lib/rubygems/dependency_installer.rb
929678a
+++ b/lib/rubygems/dependency_installer.rb
929678a
@@ -346,7 +346,7 @@ class Gem::DependencyInstaller
929678a
                                 :force               => @force,
929678a
                                 :format_executable   => @format_executable,
929678a
                                 :ignore_dependencies => @ignore_dependencies,
929678a
-                                :install_dir         => (@install_dir || Gem.dir),
929678a
+                                :install_dir         => @install_dir,
929678a
                                 :security_policy     => @security_policy,
929678a
                                 :user_install        => @user_install,
929678a
                                 :wrappers            => @wrappers,
929678a
diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb
929678a
index 780a88b..6543130 100644
929678a
--- a/lib/rubygems/installer.rb
929678a
+++ b/lib/rubygems/installer.rb
cdd0186
@@ -536,13 +536,13 @@ class Gem::Installer
929678a
       :bin_dir      => nil,
929678a
       :env_shebang  => false,
929678a
       :force        => false,
929678a
-      :install_dir  => Gem.dir,
929678a
       :only_install_dir => false
929678a
     }.merge options
929678a
 
929678a
     @env_shebang         = options[:env_shebang]
929678a
     @force               = options[:force]
929678a
-    @gem_home            = options[:install_dir]
929678a
+    @install_dir         = options[:install_dir]
929678a
+    @gem_home            = options[:install_dir] || Gem.dir
929678a
     @ignore_dependencies = options[:ignore_dependencies]
929678a
     @format_executable   = options[:format_executable]
929678a
     @security_policy     = options[:security_policy]
929678a
-- 
929678a
1.8.1.2
929678a