diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2021-03-24 04:52:19 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-24 04:52:19 +0900 |
commit | 2efda212b0d9ad5ec265271db25ad51d796fde44 (patch) | |
tree | b2667694205da0fd71dfa8dafc2655f6d464896e /lib/bundler | |
parent | ff2ea4daeb795ebb3d0afa8c57d86a4af9757e50 (diff) |
Merge RubyGems-3.2.15 and Bundler-2.2.15 (#4311)
Diffstat (limited to 'lib/bundler')
-rw-r--r-- | lib/bundler/installer/parallel_installer.rb | 37 | ||||
-rw-r--r-- | lib/bundler/lazy_specification.rb | 7 | ||||
-rw-r--r-- | lib/bundler/source/path.rb | 4 | ||||
-rw-r--r-- | lib/bundler/source/path/installer.rb | 2 | ||||
-rw-r--r-- | lib/bundler/source_list.rb | 2 | ||||
-rw-r--r-- | lib/bundler/version.rb | 2 |
6 files changed, 42 insertions, 12 deletions
diff --git a/lib/bundler/installer/parallel_installer.rb b/lib/bundler/installer/parallel_installer.rb index c3bf5843b7..5b6680e5e1 100644 --- a/lib/bundler/installer/parallel_installer.rb +++ b/lib/bundler/installer/parallel_installer.rb @@ -6,10 +6,11 @@ require_relative "gem_installer" module Bundler class ParallelInstaller class SpecInstallation - attr_accessor :spec, :name, :post_install_message, :state, :error + attr_accessor :spec, :name, :full_name, :post_install_message, :state, :error def initialize(spec) @spec = spec @name = spec.name + @full_name = spec.full_name @state = :none @post_install_message = "" @error = nil @@ -49,14 +50,11 @@ module Bundler # Represents only the non-development dependencies, the ones that are # itself and are in the total list. def dependencies - @dependencies ||= begin - all_dependencies.reject {|dep| ignorable_dependency? dep } - end + @dependencies ||= all_dependencies.reject {|dep| ignorable_dependency? dep } end def missing_lockfile_dependencies(all_spec_names) - deps = all_dependencies.reject {|dep| ignorable_dependency? dep } - deps.reject {|dep| all_spec_names.include? dep.name } + dependencies.reject {|dep| all_spec_names.include? dep.name } end # Represents all dependencies @@ -65,7 +63,7 @@ module Bundler end def to_s - "#<#{self.class} #{@spec.full_name} (#{state})>" + "#<#{self.class} #{full_name} (#{state})>" end end @@ -99,12 +97,37 @@ module Bundler install_serially end + check_for_unmet_dependencies + handle_error if failed_specs.any? @specs ensure worker_pool && worker_pool.stop end + def check_for_unmet_dependencies + unmet_dependencies = @specs.map do |s| + [ + s, + s.dependencies.reject {|dep| @specs.any? {|spec| dep.matches_spec?(spec.spec) } }, + ] + end.reject {|a| a.last.empty? } + return if unmet_dependencies.empty? + + warning = [] + warning << "Your lockfile doesn't include a valid resolution." + warning << "You can fix this by regenerating your lockfile or trying to manually editing the bad locked gems to a version that satisfies all dependencies." + warning << "The unmet dependencies are:" + + unmet_dependencies.each do |spec, unmet_spec_dependencies| + unmet_spec_dependencies.each do |unmet_spec_dependency| + warning << "* #{unmet_spec_dependency}, depended upon #{spec.full_name}, unsatisfied by #{@specs.find {|s| s.name == unmet_spec_dependency.name && !unmet_spec_dependency.matches_spec?(s.spec) }.full_name}" + end + end + + Bundler.ui.warn(warning.join("\n")) + end + def check_for_corrupt_lockfile missing_dependencies = @specs.map do |s| [ diff --git a/lib/bundler/lazy_specification.rb b/lib/bundler/lazy_specification.rb index 04ba2a2364..7cd7e4254d 100644 --- a/lib/bundler/lazy_specification.rb +++ b/lib/bundler/lazy_specification.rb @@ -73,7 +73,12 @@ module Bundler same_platform_candidates = candidates.select do |spec| MatchPlatform.platforms_match?(spec.platform, platform_object) end - search = same_platform_candidates.last || candidates.last + installable_candidates = same_platform_candidates.select do |spec| + !spec.is_a?(RemoteSpecification) && + spec.required_ruby_version.satisfied_by?(Gem.ruby_version) && + spec.required_rubygems_version.satisfied_by?(Gem.rubygems_version) + end + search = installable_candidates.last || same_platform_candidates.last search.dependencies = dependencies if search && (search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification)) search end diff --git a/lib/bundler/source/path.rb b/lib/bundler/source/path.rb index 2c2e9023b3..01f89b204d 100644 --- a/lib/bundler/source/path.rb +++ b/lib/bundler/source/path.rb @@ -82,7 +82,9 @@ module Bundler end def install(spec, options = {}) - print_using_message "Using #{version_message(spec)} from #{self}" + using_message = "Using #{version_message(spec)} from #{self}" + using_message += " and installing its executables" unless spec.executables.empty? + print_using_message using_message generate_bin(spec, :disable_extensions => true) nil # no post-install message end diff --git a/lib/bundler/source/path/installer.rb b/lib/bundler/source/path/installer.rb index 72bfbb4836..a70973bde7 100644 --- a/lib/bundler/source/path/installer.rb +++ b/lib/bundler/source/path/installer.rb @@ -35,7 +35,7 @@ module Bundler run_hooks(:post_build) end - generate_bin unless spec.executables.nil? || spec.executables.empty? + generate_bin unless spec.executables.empty? run_hooks(:post_install) ensure diff --git a/lib/bundler/source_list.rb b/lib/bundler/source_list.rb index 51698af46e..6f5636f41e 100644 --- a/lib/bundler/source_list.rb +++ b/lib/bundler/source_list.rb @@ -88,7 +88,7 @@ module Bundler def lock_sources lock_sources = (path_sources + git_sources + plugin_sources).sort_by(&:to_s) if disable_multisource? - lock_sources + rubygems_sources.sort_by(&:to_s) + lock_sources + rubygems_sources.sort_by(&:to_s).uniq else lock_sources << combine_rubygems_sources end diff --git a/lib/bundler/version.rb b/lib/bundler/version.rb index 5e71e22df8..5b6473c465 100644 --- a/lib/bundler/version.rb +++ b/lib/bundler/version.rb @@ -1,7 +1,7 @@ # frozen_string_literal: false module Bundler - VERSION = "2.2.14".freeze + VERSION = "2.2.15".freeze def self.bundler_major_version @bundler_major_version ||= VERSION.split(".").first.to_i |