ruby-changes:66781
From: Hiroshi <ko1@a...>
Date: Wed, 14 Jul 2021 10:48:29 +0900 (JST)
Subject: [ruby-changes:66781] 896bbb9fad (master): Merge RubyGems/Bundler master from 8459ebd6ad65ce3397233416dc64083ae7572bb9
https://git.ruby-lang.org/ruby.git/commit/?id=896bbb9fad From 896bbb9fadd10e1ad06ff3fd7d0608acda01ac06 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA <hsbt@r...> Date: Tue, 13 Jul 2021 20:58:08 +0900 Subject: Merge RubyGems/Bundler master from 8459ebd6ad65ce3397233416dc64083ae7572bb9 --- lib/bundler.rb | 9 +- lib/bundler/definition.rb | 59 +++++------ lib/bundler/dsl.rb | 36 +++---- lib/bundler/index.rb | 6 +- lib/bundler/installer/standalone.rb | 2 +- lib/bundler/plugin/installer.rb | 2 +- lib/bundler/rubygems_ext.rb | 28 +++-- lib/bundler/runtime.rb | 4 +- lib/bundler/settings.rb | 8 +- lib/bundler/spec_set.rb | 9 +- .../vendor/connection_pool/lib/connection_pool.rb | 113 +++++++-------------- .../lib/connection_pool/monotonic_time.rb | 66 ------------ .../lib/connection_pool/timed_stack.rb | 36 ++++--- .../connection_pool/lib/connection_pool/version.rb | 2 +- .../connection_pool/lib/connection_pool/wrapper.rb | 57 +++++++++++ lib/bundler/vendor/uri/lib/uri.rb | 1 - lib/bundler/vendor/uri/lib/uri/common.rb | 97 ++++-------------- lib/bundler/vendor/uri/lib/uri/ftp.rb | 1 - lib/bundler/vendor/uri/lib/uri/generic.rb | 11 +- lib/bundler/vendor/uri/lib/uri/http.rb | 1 - lib/bundler/vendor/uri/lib/uri/https.rb | 1 - lib/bundler/vendor/uri/lib/uri/ldap.rb | 2 +- lib/bundler/vendor/uri/lib/uri/mailto.rb | 1 - lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb | 15 +-- lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb | 13 +-- lib/bundler/vendor/uri/lib/uri/version.rb | 2 +- lib/bundler/vendor/uri/lib/uri/ws.rb | 84 +++++++++++++++ lib/bundler/vendor/uri/lib/uri/wss.rb | 22 ++++ lib/rubygems/exceptions.rb | 2 +- lib/rubygems/gemcutter_utilities.rb | 3 +- lib/rubygems/package/io_source.rb | 4 + spec/bundler/bundler/bundler_spec.rb | 21 ++-- spec/bundler/bundler/settings_spec.rb | 9 +- spec/bundler/commands/check_spec.rb | 28 +++++ spec/bundler/commands/exec_spec.rb | 10 ++ spec/bundler/commands/install_spec.rb | 96 ++++++++++------- spec/bundler/commands/newgem_spec.rb | 12 +-- .../install/gemfile/specific_platform_spec.rb | 32 ++++++ spec/bundler/plugins/install_spec.rb | 7 ++ spec/bundler/realworld/edgecases_spec.rb | 15 --- spec/bundler/runtime/setup_spec.rb | 19 ++++ spec/bundler/support/artifice/vcr.rb | 13 +++ spec/bundler/support/hax.rb | 4 + test/rubygems/test_exit.rb | 11 ++ test/rubygems/test_gem_package.rb | 7 ++ 45 files changed, 535 insertions(+), 446 deletions(-) delete mode 100644 lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb create mode 100644 lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb create mode 100644 lib/bundler/vendor/uri/lib/uri/ws.rb create mode 100644 lib/bundler/vendor/uri/lib/uri/wss.rb create mode 100644 test/rubygems/test_exit.rb diff --git a/lib/bundler.rb b/lib/bundler.rb index a7d5d1e..b88bab8 100644 --- a/lib/bundler.rb +++ b/lib/bundler.rb @@ -236,8 +236,9 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler.rb#L236 end if warning - user_home = tmp_home_path(warning) - Bundler.ui.warn "#{warning}\nBundler will use `#{user_home}' as your home directory temporarily.\n" + Bundler.ui.warn "#{warning}\n" + user_home = tmp_home_path + Bundler.ui.warn "Bundler will use `#{user_home}' as your home directory temporarily.\n" user_home else Pathname.new(home) @@ -684,15 +685,13 @@ EOF https://github.com/ruby/ruby/blob/trunk/lib/bundler.rb#L685 Bundler.rubygems.clear_paths end - def tmp_home_path(warning) + def tmp_home_path Kernel.send(:require, "tmpdir") SharedHelpers.filesystem_access(Dir.tmpdir) do path = Bundler.tmp at_exit { Bundler.rm_rf(path) } path end - rescue RuntimeError => e - raise e.exception("#{warning}\nBundler also failed to create a temporary home directory':\n#{e}") end # @param env [Hash] diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index 8998e3b..b585b06 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -138,7 +138,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/definition.rb#L138 @unlock[:gems] ||= @dependencies.map(&:name) else eager_unlock = expand_dependencies(@unlock[:gems] || [], true) - @unlock[:gems] = @locked_specs.for(eager_unlock, [], false, false, false).map(&:name) + @unlock[:gems] = @locked_specs.for(eager_unlock, false, false, false).map(&:name) end @dependency_changes = converge_dependencies @@ -190,25 +190,15 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/definition.rb#L190 # # @return [Bundler::SpecSet] def specs - @specs ||= begin - begin - specs = resolve.materialize(requested_dependencies) - rescue GemNotFound => e # Handle yanked gem - gem_name, gem_version = extract_gem_info(e) - locked_gem = @locked_specs[gem_name].last - raise if locked_gem.nil? || locked_gem.version.to_s != gem_version || !@remote - raise GemNotFound, "Your bundle is locked to #{locked_gem} from #{locked_gem.source}, but that version can " \ - "no longer be found in that source. That means the author of #{locked_gem} has removed it. " \ - "You'll need to update your bundle to a version other than #{locked_gem} that hasn't been " \ - "removed in order to install." - end - unless specs["bundler"].any? - bundler = sources.metadata_source.specs.search(Gem::Dependency.new("bundler", VERSION)).last - specs["bundler"] = bundler - end - - specs - end + @specs ||= add_bundler_to(resolve.materialize(requested_dependencies)) + rescue GemNotFound => e # Handle yanked gem + gem_name, gem_version = extract_gem_info(e) + locked_gem = @locked_specs[gem_name].last + raise if locked_gem.nil? || locked_gem.version.to_s != gem_version || !@remote + raise GemNotFound, "Your bundle is locked to #{locked_gem} from #{locked_gem.source}, but that version can " \ + "no longer be found in that source. That means the author of #{locked_gem} has removed it. " \ + "You'll need to update your bundle to a version other than #{locked_gem} that hasn't been " \ + "removed in order to install." end def new_specs @@ -240,17 +230,11 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/definition.rb#L230 end def requested_specs - @requested_specs ||= begin - groups = requested_groups - groups.map!(&:to_sym) - specs_for(groups) - end + specs_for(requested_groups) end def requested_dependencies - groups = requested_groups - groups.map!(&:to_sym) - dependencies_for(groups) + dependencies_for(requested_groups) end def current_dependencies @@ -260,11 +244,13 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/definition.rb#L244 end def specs_for(groups) + groups = requested_groups if groups.empty? deps = dependencies_for(groups) - SpecSet.new(specs.for(expand_dependencies(deps))) + add_bundler_to(resolve.materialize(expand_dependencies(deps))) end def dependencies_for(groups) + groups.map!(&:to_sym) current_dependencies.reject do |d| (d.groups & groups).empty? end @@ -514,6 +500,15 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/definition.rb#L500 private + def add_bundler_to(specs) + unless specs["bundler"].any? + bundler = sources.metadata_source.specs.search(Gem::Dependency.new("bundler", VERSION)).last + specs["bundler"] = bundler + end + + specs + end + def precompute_source_requirements_for_indirect_dependencies? sources.non_global_rubygems_sources.all?(&:dependency_api_available?) && !sources.aggregate_global_source? end @@ -742,7 +737,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/definition.rb#L737 # if we won't need the source (according to the lockfile), # don't error if the path/git source isn't available next if @locked_specs. - for(requested_dependencies, [], false, true, false). + for(requested_dependencies, false, true, false). none? {|locked_spec| locked_spec.source == s.source } raise @@ -761,8 +756,8 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/definition.rb#L756 end resolve = SpecSet.new(converged) - @locked_specs_incomplete_for_platform = !resolve.for(expand_dependencies(requested_dependencies & deps), @unlock[:gems], true, true) - resolve = SpecSet.new(resolve.for(expand_dependencies(deps, true), [], false, false, false).reject{|s| @unlock[:gems].include?(s.name) }) + @locked_specs_incomplete_for_platform = !resolve.for(expand_dependencies(requested_dependencies & deps), true, true) + (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/