1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Reverts the accidental commits for rubygems/bundler.

We stay to the stable version for releasing Ruby 3.1.0.

  Revert commits:
    b86a7ba492
    ef973aa7aa
This commit is contained in:
Hiroshi SHIBATA 2021-12-22 07:52:59 +09:00
parent d9570437e2
commit fff9b45fa9
No known key found for this signature in database
GPG key ID: F9CF13417264FAC2
2 changed files with 8 additions and 32 deletions

View file

@ -87,11 +87,10 @@ module Bundler
@platforms = @locked_platforms.dup
@locked_bundler_version = @locked_gems.bundler_version
@locked_ruby_version = @locked_gems.ruby_version
@originally_locked_specs = SpecSet.new(@locked_gems.specs)
if unlock != true
@locked_deps = @locked_gems.dependencies
@locked_specs = @originally_locked_specs
@locked_specs = SpecSet.new(@locked_gems.specs)
@locked_sources = @locked_gems.sources
else
@unlock = {}
@ -692,17 +691,14 @@ module Bundler
def converge_specs(specs)
deps = []
converged = []
@dependencies.each do |dep|
if specs[dep].any? {|s| s.satisfies?(dep) && (!dep.source || s.source.include?(dep.source)) }
deps << dep
end
end
specs.each do |s|
# Replace the locked dependency's source with the equivalent source from the Gemfile
dep = @dependencies.find {|d| s.satisfies?(d) }
if dep && (!dep.source || s.source.include?(dep.source))
deps << dep
end
s.source = (dep && dep.source) || sources.get(s.source) || sources.default_source unless Bundler.frozen_bundle?
next if @unlock[:sources].include?(s.source.name)
@ -834,7 +830,7 @@ module Bundler
def additional_base_requirements_for_resolve
return [] unless @locked_gems && unlocking? && !sources.expired_sources?(@locked_gems.sources)
converge_specs(@originally_locked_specs).map do |locked_spec|
converge_specs(@locked_gems.specs).map do |locked_spec|
name = locked_spec.name
dep = Gem::Dependency.new(name, ">= #{locked_spec.version}")
DepProxy.get_proxy(dep, locked_spec.platform)

View file

@ -364,9 +364,7 @@ RSpec.describe "bundle install with gem sources" do
end
it "throws a warning if a gem is added twice in Gemfile without version requirements" do
build_repo2
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
source "#{file_uri_for(gem_repo2)}"
gem "rack"
gem "rack"
@ -378,9 +376,7 @@ RSpec.describe "bundle install with gem sources" do
end
it "throws a warning if a gem is added twice in Gemfile with same versions" do
build_repo2
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
source "#{file_uri_for(gem_repo2)}"
gem "rack", "1.0"
gem "rack", "1.0"
@ -391,22 +387,6 @@ RSpec.describe "bundle install with gem sources" do
expect(err).to include("While it's not a problem now, it could cause errors if you change the version of one of them later.")
end
it "throws a warning if a gem is added twice under different platforms and does not crash when using the generated lockfile" do
build_repo2
install_gemfile <<-G
source "#{file_uri_for(gem_repo2)}"
gem "rack", :platform => :jruby
gem "rack"
G
bundle "install"
expect(err).to include("Your Gemfile lists the gem rack (>= 0) more than once.")
expect(err).to include("Remove any duplicate entries and specify the gem only once.")
expect(err).to include("While it's not a problem now, it could cause errors if you change the version of one of them later.")
end
it "does not throw a warning if a gem is added once in Gemfile and also inside a gemspec as a development dependency" do
build_lib "my-gem", :path => bundled_app do |s|
s.add_development_dependency "my-private-gem"