зеркало из https://github.com/github/ruby.git
[rubygems/rubygems] Fix crash when printing resolution conflicts on metadata requirements
https://github.com/rubygems/rubygems/commit/b69e1e9374
This commit is contained in:
Родитель
08cee2bf80
Коммит
633608ebd4
|
@ -19,13 +19,15 @@ module Bundler
|
|||
# collection of gemspecs is returned. Otherwise, nil is returned.
|
||||
def self.resolve(requirements, source_requirements = {}, base = [], gem_version_promoter = GemVersionPromoter.new, additional_base_requirements = [], platforms = nil)
|
||||
base = SpecSet.new(base) unless base.is_a?(SpecSet)
|
||||
resolver = new(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms)
|
||||
metadata_requirements, regular_requirements = requirements.partition {|dep| dep.name.end_with?("\0") }
|
||||
resolver = new(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms, metadata_requirements)
|
||||
result = resolver.start(requirements)
|
||||
SpecSet.new(SpecSet.new(result).for(requirements.reject {|dep| dep.name.end_with?("\0") }))
|
||||
SpecSet.new(SpecSet.new(result).for(regular_requirements))
|
||||
end
|
||||
|
||||
def initialize(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms)
|
||||
def initialize(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms, metadata_requirements)
|
||||
@source_requirements = source_requirements
|
||||
@metadata_requirements = metadata_requirements
|
||||
@base = base
|
||||
@resolver = Molinillo::Resolver.new(self, self)
|
||||
@search_for = {}
|
||||
|
@ -344,8 +346,6 @@ module Bundler
|
|||
trees.sort_by! {|t| t.reverse.map(&:name) }
|
||||
end
|
||||
|
||||
metadata_requirements = {}
|
||||
|
||||
o << trees.map do |tree|
|
||||
t = "".dup
|
||||
depth = 2
|
||||
|
@ -354,7 +354,6 @@ module Bundler
|
|||
base_tree_name = base_tree.name
|
||||
|
||||
if base_tree_name.end_with?("\0")
|
||||
metadata_requirements[base_tree_name] = base_tree
|
||||
t = nil
|
||||
else
|
||||
tree.each do |req|
|
||||
|
@ -393,7 +392,7 @@ module Bundler
|
|||
end
|
||||
end
|
||||
elsif name.end_with?("\0")
|
||||
o << %(\n Current #{name} version:\n #{SharedHelpers.pretty_dependency(metadata_requirements[name])}\n\n)
|
||||
o << %(\n Current #{name} version:\n #{SharedHelpers.pretty_dependency(@metadata_requirements.find {|req| req.name == name })}\n\n)
|
||||
elsif conflict.locked_requirement
|
||||
o << "\n"
|
||||
o << %(Running `bundle update` will rebuild your snapshot from scratch, using only\n)
|
||||
|
|
|
@ -282,6 +282,27 @@ RSpec.describe "bundle install with install-time dependencies" do
|
|||
expect(err).not_to include("That means the author of parallel_tests (3.8.0) has removed it.")
|
||||
end
|
||||
|
||||
it "gives a meaningful error on ruby version mismatches between dependencies" do
|
||||
build_repo4 do
|
||||
build_gem "requires-old-ruby" do |s|
|
||||
s.required_ruby_version = "< #{RUBY_VERSION}"
|
||||
end
|
||||
end
|
||||
|
||||
build_lib("foo", :path => bundled_app) do |s|
|
||||
s.required_ruby_version = ">= #{RUBY_VERSION}"
|
||||
|
||||
s.add_dependency "requires-old-ruby"
|
||||
end
|
||||
|
||||
install_gemfile <<-G, :raise_on_error => false
|
||||
source "#{file_uri_for(gem_repo4)}"
|
||||
gemspec
|
||||
G
|
||||
|
||||
expect(err).to include("Bundler found conflicting requirements for the Ruby\0 version:")
|
||||
end
|
||||
|
||||
it "installs the older version under rate limiting conditions" do
|
||||
build_repo4 do
|
||||
build_gem "rack", "9001.0.0" do |s|
|
||||
|
|
Загрузка…
Ссылка в новой задаче