diff options
author | ryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-01-19 00:08:49 +0000 |
---|---|---|
committer | ryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-01-19 00:08:49 +0000 |
commit | e798ccbacf489a3af2201ae30058ff0ae7f79045 (patch) | |
tree | 4147a7834eb88323057fd2120a2ddc96c1eb32ab /lib/rubygems/dependency_installer.rb | |
parent | d26fb035cae8d351dc238376722c980230dc5fbd (diff) | |
download | ruby-e798ccbacf489a3af2201ae30058ff0ae7f79045.tar.gz |
Import rubygems 1.5.0 (release candidate)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30599 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/dependency_installer.rb')
-rw-r--r-- | lib/rubygems/dependency_installer.rb | 61 |
1 files changed, 37 insertions, 24 deletions
diff --git a/lib/rubygems/dependency_installer.rb b/lib/rubygems/dependency_installer.rb index 099d223295..3913f36bc2 100644 --- a/lib/rubygems/dependency_installer.rb +++ b/lib/rubygems/dependency_installer.rb @@ -1,3 +1,9 @@ +###################################################################### +# This file is imported from the rubygems project. +# DO NOT make modifications in this repo. They _will_ be reverted! +# File a patch instead and assign it to Ryan Davis or Eric Hodel. +###################################################################### + require 'rubygems' require 'rubygems/dependency_list' require 'rubygems/installer' @@ -132,41 +138,48 @@ class Gem::DependencyInstaller dependency_list = Gem::DependencyList.new @development dependency_list.add(*specs) + to_do = specs.dup - unless @ignore_dependencies then - to_do = specs.dup - seen = {} + add_found_dependencies to_do, dependency_list unless @ignore_dependencies - until to_do.empty? do - spec = to_do.shift - next if spec.nil? or seen[spec.name] - seen[spec.name] = true + @gems_to_install = dependency_list.dependency_order.reverse + end - deps = spec.runtime_dependencies - deps |= spec.development_dependencies if @development + def add_found_dependencies to_do, dependency_list + seen = {} - deps.each do |dep| - results = find_gems_with_sources(dep).reverse + until to_do.empty? do + spec = to_do.shift + next if spec.nil? or seen[spec.name] + seen[spec.name] = true - results.reject! do |dep_spec,| - to_do.push dep_spec + deps = spec.runtime_dependencies + deps |= spec.development_dependencies if @development - @source_index.any? do |_, installed_spec| - dep.name == installed_spec.name and - dep.requirement.satisfied_by? installed_spec.version - end - end + deps.each do |dep| + results = find_gems_with_sources(dep).reverse + + # FIX: throw in everything that satisfies, and let + # FIX: dependencylist reduce to the chosen few + results.reject! do |dep_spec,| + to_do.push dep_spec - results.each do |dep_spec, source_uri| - next if seen[dep_spec.name] - @specs_and_sources << [dep_spec, source_uri] - dependency_list.add dep_spec + # already locally installed + @source_index.any? do |_, installed_spec| + dep.name == installed_spec.name and + dep.requirement.satisfied_by? installed_spec.version end end + + results.each do |dep_spec, source_uri| + next if seen[dep_spec.name] + @specs_and_sources << [dep_spec, source_uri] + + # FIX: this is the bug + dependency_list.add dep_spec + end end end - - @gems_to_install = dependency_list.dependency_order.reverse end ## |