[rubygems/rubygems] Delay and refactor verification of changed sources
https://github.com/rubygems/rubygems/commit/d5dce93167
This commit is contained in:
parent
cff18256ca
commit
def5fdf82a
@ -887,8 +887,6 @@ module Bundler
|
||||
converged = []
|
||||
deps = []
|
||||
|
||||
@specs_that_changed_sources = []
|
||||
|
||||
specs.each do |s|
|
||||
name = s.name
|
||||
dep = @dependencies.find {|d| s.satisfies?(d) }
|
||||
@ -897,7 +895,6 @@ module Bundler
|
||||
if dep
|
||||
gemfile_source = dep.source || default_source
|
||||
|
||||
@specs_that_changed_sources << s if gemfile_source != lockfile_source
|
||||
deps << dep if !dep.source || lockfile_source.include?(dep.source)
|
||||
@gems_to_unlock << name if lockfile_source.include?(dep.source) && lockfile_source != gemfile_source
|
||||
|
||||
@ -979,7 +976,6 @@ module Bundler
|
||||
source_requirements["bundler"] = sources.metadata_source # needs to come last to override
|
||||
end
|
||||
|
||||
verify_changed_sources!
|
||||
source_requirements
|
||||
end
|
||||
|
||||
@ -987,14 +983,6 @@ module Bundler
|
||||
sources.default_source
|
||||
end
|
||||
|
||||
def verify_changed_sources!
|
||||
@specs_that_changed_sources.each do |s|
|
||||
if s.source.specs.search(s.name).empty?
|
||||
raise GemNotFound, "Could not find gem '#{s.name}' in #{s.source}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def requested_groups
|
||||
values = groups - Bundler.settings[:without] - @optional_groups + Bundler.settings[:with]
|
||||
values &= Bundler.settings[:only] unless Bundler.settings[:only].empty?
|
||||
|
@ -28,10 +28,17 @@ module Bundler
|
||||
@required_ruby_version = Gem::Requirement.default
|
||||
@required_rubygems_version = Gem::Requirement.default
|
||||
@platform = platform || Gem::Platform::RUBY
|
||||
|
||||
@original_source = source
|
||||
@source = source
|
||||
|
||||
@force_ruby_platform = default_force_ruby_platform
|
||||
end
|
||||
|
||||
def source_changed?
|
||||
@original_source != source
|
||||
end
|
||||
|
||||
def full_name
|
||||
@full_name ||= if platform == Gem::Platform::RUBY
|
||||
"#{@name}-#{@version}"
|
||||
|
@ -107,6 +107,10 @@ module Bundler
|
||||
def build_base_requirements
|
||||
base_requirements = {}
|
||||
@base.each do |ls|
|
||||
if ls.source_changed? && ls.source.specs.search(ls.name).empty?
|
||||
raise GemNotFound, "Could not find gem '#{ls.name}' in #{ls.source}"
|
||||
end
|
||||
|
||||
req = Gem::Requirement.new(ls.version)
|
||||
base_requirements[ls.name] = req
|
||||
end
|
||||
|
@ -238,7 +238,7 @@ RSpec.describe "Resolving" do
|
||||
it "resolves foo only to latest patch - changing dependency declared case" do
|
||||
# bar is locked AND a declared dependency in the Gemfile, so it will not move, and therefore
|
||||
# foo can only move up to 1.4.4.
|
||||
@base << build_spec("bar", "2.0.3").first
|
||||
@base << Bundler::LazySpecification.new("bar", Gem::Version.new("2.0.3"), nil)
|
||||
should_conservative_resolve_and_include :patch, ["foo"], %w[foo-1.4.4 bar-2.0.3]
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user