diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2022-07-23 11:58:53 +0200 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2022-08-02 16:10:14 +0900 |
commit | ed9bbfd7594f655702461067e3dc8106eec52385 (patch) | |
tree | 96d534df8d632c381d1f10e6341eed50275dab02 /lib/bundler/spec_set.rb | |
parent | 7cc5a657eed1a537b33b7b2ec71fdb5ad9323950 (diff) |
[rubygems/rubygems] Fix incorrect force_ruby_platform propagation
It was just working by chance.
(cherry picked from commit https://github.com/rubygems/rubygems/commit/16b2d6bfe893)
https://github.com/rubygems/rubygems/commit/8f922d980f
Diffstat (limited to 'lib/bundler/spec_set.rb')
-rw-r--r-- | lib/bundler/spec_set.rb | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/bundler/spec_set.rb b/lib/bundler/spec_set.rb index de2ad97330..6a3813eef8 100644 --- a/lib/bundler/spec_set.rb +++ b/lib/bundler/spec_set.rb @@ -13,14 +13,16 @@ module Bundler def for(dependencies, check = false, platforms = [nil]) handled = ["bundler"].product(platforms).map {|k| [k, true] }.to_h - deps = dependencies.product(platforms).map {|dep, platform| [dep.name, platform && dep.force_ruby_platform ? Gem::Platform::RUBY : platform] } + deps = dependencies.product(platforms) specs = [] loop do break unless dep = deps.shift - next if handled.key?(dep) - handled[dep] = true + key = [dep[0].name, dep[1]] + next if handled.key?(key) + + handled[key] = true specs_for_dep = specs_for_dependency(*dep) if specs_for_dep.any? @@ -28,10 +30,10 @@ module Bundler specs_for_dep.first.dependencies.each do |d| next if d.type == :development - deps << [d.name, dep[1]] + deps << [d, dep[1]] end elsif check - specs << IncompleteSpecification.new(*dep) + specs << IncompleteSpecification.new(*key) end end @@ -175,13 +177,12 @@ module Bundler @specs.sort_by(&:name).each {|s| yield s } end - def specs_for_dependency(name, platform) - specs_for_name = lookup[name] + def specs_for_dependency(dep, platform) + specs_for_name = lookup[dep.name] if platform.nil? GemHelpers.select_best_platform_match(specs_for_name.select {|s| Gem::Platform.match_spec?(s) }, Bundler.local_platform) else - specs_for_name_and_platform = GemHelpers.select_best_platform_match(specs_for_name, platform) - specs_for_name_and_platform.any? ? specs_for_name_and_platform : specs_for_name + GemHelpers.select_best_platform_match(specs_for_name, dep.force_ruby_platform ? Gem::Platform::RUBY : platform) end end |