[rubygems/rubygems] Let resolver consider unique specs from the beginning
It results in more consistent error messages. https://github.com/rubygems/rubygems/commit/a4b34361cc
This commit is contained in:
parent
a333e867aa
commit
5fdfdc30f1
@ -79,7 +79,7 @@ module Bundler
|
|||||||
def solve_versions(root:, logger:)
|
def solve_versions(root:, logger:)
|
||||||
solver = PubGrub::VersionSolver.new(source: self, root: root, logger: logger)
|
solver = PubGrub::VersionSolver.new(source: self, root: root, logger: logger)
|
||||||
result = solver.solve
|
result = solver.solve
|
||||||
result.map {|package, version| version.to_specs(package) }.flatten.uniq
|
result.map {|package, version| version.to_specs(package) }.flatten
|
||||||
rescue PubGrub::SolveFailure => e
|
rescue PubGrub::SolveFailure => e
|
||||||
incompatibility = e.incompatibility
|
incompatibility = e.incompatibility
|
||||||
|
|
||||||
@ -270,6 +270,7 @@ module Bundler
|
|||||||
end
|
end
|
||||||
|
|
||||||
platform_specs.flatten!
|
platform_specs.flatten!
|
||||||
|
platform_specs.uniq!
|
||||||
|
|
||||||
ruby_specs = select_best_platform_match(specs, Gem::Platform::RUBY)
|
ruby_specs = select_best_platform_match(specs, Gem::Platform::RUBY)
|
||||||
groups << Resolver::Candidate.new(version, specs: ruby_specs) if ruby_specs.any?
|
groups << Resolver::Candidate.new(version, specs: ruby_specs) if ruby_specs.any?
|
||||||
|
@ -1467,9 +1467,7 @@ RSpec.describe "bundle lock" do
|
|||||||
#{Bundler::VERSION}
|
#{Bundler::VERSION}
|
||||||
L
|
L
|
||||||
|
|
||||||
bundle "lock", raise_on_error: false
|
expected_error = <<~ERR.strip
|
||||||
|
|
||||||
expect(err).to eq <<~ERR.strip
|
|
||||||
Could not find compatible versions
|
Could not find compatible versions
|
||||||
|
|
||||||
Because every version of activemodel depends on activesupport = 6.0.4
|
Because every version of activemodel depends on activesupport = 6.0.4
|
||||||
@ -1493,28 +1491,13 @@ RSpec.describe "bundle lock" do
|
|||||||
version solving has failed.
|
version solving has failed.
|
||||||
ERR
|
ERR
|
||||||
|
|
||||||
|
bundle "lock", raise_on_error: false
|
||||||
|
expect(err).to eq(expected_error)
|
||||||
|
|
||||||
lockfile lockfile.gsub(/PLATFORMS\n #{local_platform}/m, "PLATFORMS\n #{lockfile_platforms("ruby")}")
|
lockfile lockfile.gsub(/PLATFORMS\n #{local_platform}/m, "PLATFORMS\n #{lockfile_platforms("ruby")}")
|
||||||
|
|
||||||
bundle "lock", raise_on_error: false
|
bundle "lock", raise_on_error: false
|
||||||
|
expect(err).to eq(expected_error)
|
||||||
expect(err).to eq <<~ERR.strip
|
|
||||||
Could not find compatible versions
|
|
||||||
|
|
||||||
Because rails >= 7.0.3.1, < 7.0.4 depends on activemodel = 7.0.3.1
|
|
||||||
and rails >= 7.0.2.3, < 7.0.3.1 depends on activemodel = 7.0.2.3,
|
|
||||||
rails >= 7.0.2.3, < 7.0.4 requires activemodel = 7.0.2.3 OR = 7.0.3.1.
|
|
||||||
And because every version of activemodel depends on activesupport = 6.0.4,
|
|
||||||
rails >= 7.0.2.3, < 7.0.4 requires activesupport = 6.0.4.
|
|
||||||
Because rails >= 7.0.3.1, < 7.0.4 depends on activesupport = 7.0.3.1
|
|
||||||
and rails >= 7.0.2.3, < 7.0.3.1 depends on activesupport = 7.0.2.3,
|
|
||||||
rails >= 7.0.2.3, < 7.0.4 requires activesupport = 7.0.2.3 OR = 7.0.3.1.
|
|
||||||
Thus, rails >= 7.0.2.3, < 7.0.4 cannot be used.
|
|
||||||
And because rails >= 7.0.4 depends on activemodel = 7.0.4,
|
|
||||||
rails >= 7.0.2.3 requires activemodel = 7.0.4.
|
|
||||||
So, because activemodel = 7.0.4 could not be found in rubygems repository https://gem.repo4/ or installed locally
|
|
||||||
and Gemfile depends on rails >= 7.0.2.3,
|
|
||||||
version solving has failed.
|
|
||||||
ERR
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not accidentally resolves to prereleases" do
|
it "does not accidentally resolves to prereleases" do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user