diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2023-03-23 12:31:15 +0100 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2023-04-06 13:07:16 +0900 |
commit | c257380965bcf93c9bef330faa6762ed0be494b5 (patch) | |
tree | 5448d6dda45c6ebabfdeacf14ffa19be89734e2a /lib/bundler | |
parent | 192a3a6bfb6b69d1673ffa918bc78184de871c65 (diff) | |
download | ruby-c257380965bcf93c9bef330faa6762ed0be494b5.tar.gz |
Revert "Refactor incomplete specs handling"
This reverts commit 69580f8b72f41c58cae57d1ada4db909922b3891.
Diffstat (limited to 'lib/bundler')
-rw-r--r-- | lib/bundler/incomplete_specification.rb | 24 | ||||
-rw-r--r-- | lib/bundler/resolver/base.rb | 8 | ||||
-rw-r--r-- | lib/bundler/spec_set.rb | 19 |
3 files changed, 13 insertions, 38 deletions
diff --git a/lib/bundler/incomplete_specification.rb b/lib/bundler/incomplete_specification.rb deleted file mode 100644 index addf7554d8..0000000000 --- a/lib/bundler/incomplete_specification.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -module Bundler - # - # Represents a package name that was found to be incomplete when trying to - # materialize a fresh resolution or the lockfile. - # - # Holds the actual partially complete set of specifications for the name. - # These are used so that they can be unlocked in a future resolution, and fix - # the situation. - # - class IncompleteSpecification - attr_reader :name, :partially_complete_specs - - def initialize(name, partially_complete_specs = []) - @name = name - @partially_complete_specs = partially_complete_specs - end - - def ==(other) - partially_complete_specs == other.partially_complete_specs - end - end -end diff --git a/lib/bundler/resolver/base.rb b/lib/bundler/resolver/base.rb index e9ff43960c..c6afa82056 100644 --- a/lib/bundler/resolver/base.rb +++ b/lib/bundler/resolver/base.rb @@ -34,11 +34,9 @@ module Bundler @base[name] end - def delete(incomplete_specs) - incomplete_specs.each do |incomplete_spec| - incomplete_spec.partially_complete_specs.each do |spec| - @base.delete(spec) - end + def delete(specs) + specs.each do |spec| + @base.delete(spec) end end diff --git a/lib/bundler/spec_set.rb b/lib/bundler/spec_set.rb index 2361fc356c..cf63c16a70 100644 --- a/lib/bundler/spec_set.rb +++ b/lib/bundler/spec_set.rb @@ -7,8 +7,11 @@ module Bundler include Enumerable include TSort - def initialize(specs) + attr_reader :incomplete_specs + + def initialize(specs, incomplete_specs = []) @specs = specs + @incomplete_specs = incomplete_specs end def for(dependencies, check = false, platforms = [nil]) @@ -42,7 +45,7 @@ module Bundler end if incomplete && check - specs << IncompleteSpecification.new(name, lookup[name]) + @incomplete_specs += lookup[name].any? ? lookup[name] : [LazySpecification.new(name, nil, nil)] end end @@ -81,7 +84,7 @@ module Bundler def materialize(deps) materialized = self.for(deps, true) - SpecSet.new(materialized) + SpecSet.new(materialized, incomplete_specs) end # Materialize for all the specs in the spec set, regardless of what platform they're for @@ -100,19 +103,17 @@ module Bundler def incomplete_ruby_specs?(deps) return false if @specs.empty? - materialized = self.for(deps, true, [Gem::Platform::RUBY]) + @incomplete_specs = [] + + self.for(deps, true, [Gem::Platform::RUBY]) - SpecSet.new(materialized).incomplete_specs.any? + @incomplete_specs.any? end def missing_specs @specs.select {|s| s.is_a?(LazySpecification) } end - def incomplete_specs - @specs.select {|s| s.is_a?(IncompleteSpecification) } - end - def merge(set) arr = sorted.dup set.each do |set_spec| |