From 06cd5711e0afc6302052e847863a7fdcc42fe692 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Tue, 2 Mar 2021 20:38:16 +0900 Subject: Merge RubyGems-3.2.12 and Bundler-2.2.12 --- lib/bundler/definition.rb | 2 +- lib/bundler/installer.rb | 2 ++ lib/bundler/rubygems_gem_installer.rb | 47 +++++++++++++++++++++++++++++++++++ lib/bundler/stub_specification.rb | 8 ++++++ lib/bundler/version.rb | 2 +- lib/rubygems.rb | 2 +- 6 files changed, 60 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index 3c25149d33..3264cb074c 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -594,7 +594,7 @@ module Bundler deps_for_source = @dependencies.select {|s| s.source == source } locked_deps_for_source = @locked_deps.values.select {|dep| dep.source == locked_source } - deps_for_source.sort != locked_deps_for_source.sort + deps_for_source.uniq.sort != locked_deps_for_source.sort end def specs_for_source_changed?(source) diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb index 8d55784006..09c8b1c157 100644 --- a/lib/bundler/installer.rb +++ b/lib/bundler/installer.rb @@ -89,6 +89,8 @@ module Bundler end install(options) + Gem::Specification.reset # invalidate gem specification cache so that installed gems are immediately available + lock unless Bundler.frozen_bundle? Standalone.new(options[:standalone], @definition).generate if options[:standalone] end diff --git a/lib/bundler/rubygems_gem_installer.rb b/lib/bundler/rubygems_gem_installer.rb index cd5eb152f9..f5f3c53309 100644 --- a/lib/bundler/rubygems_gem_installer.rb +++ b/lib/bundler/rubygems_gem_installer.rb @@ -8,6 +8,53 @@ module Bundler # Bundler needs to install gems regardless of binstub overwriting end + def install + pre_install_checks + + run_pre_install_hooks + + spec.loaded_from = spec_file + + # Completely remove any previous gem files + FileUtils.rm_rf gem_dir + FileUtils.rm_rf spec.extension_dir + + FileUtils.mkdir_p gem_dir, :mode => 0o755 + + extract_files + + build_extensions + write_build_info_file + run_post_build_hooks + + generate_bin + generate_plugins + + write_spec + write_cache_file + + say spec.post_install_message unless spec.post_install_message.nil? + + run_post_install_hooks + + spec + end + + def generate_plugins + return unless Gem::Installer.instance_methods(false).include?(:generate_plugins) + + latest = Gem::Specification.stubs_for(spec.name).first + return if latest && latest.version > spec.version + + ensure_writable_dir @plugins_dir + + if spec.plugins.empty? + remove_plugins_for(spec, @plugins_dir) + else + regenerate_plugins_for(spec, @plugins_dir) + end + end + def pre_install_checks super && validate_bundler_checksum(options[:bundler_expected_checksum]) end diff --git a/lib/bundler/stub_specification.rb b/lib/bundler/stub_specification.rb index 2456d268da..fa071901e5 100644 --- a/lib/bundler/stub_specification.rb +++ b/lib/bundler/stub_specification.rb @@ -26,11 +26,19 @@ module Bundler # @!group Stub Delegates + def manually_installed? + # This is for manually installed gems which are gems that were fixed in place after a + # failed installation. Once the issue was resolved, the user then manually created + # the gem specification using the instructions provided by `gem help install` + installed_by_version == Gem::Version.new(0) + end + # This is defined directly to avoid having to loading the full spec def missing_extensions? return false if default_gem? return false if extensions.empty? return false if File.exist? gem_build_complete_path + return false if manually_installed? true end diff --git a/lib/bundler/version.rb b/lib/bundler/version.rb index 64c46ddb25..ef8a25a2ae 100644 --- a/lib/bundler/version.rb +++ b/lib/bundler/version.rb @@ -1,7 +1,7 @@ # frozen_string_literal: false module Bundler - VERSION = "2.2.11".freeze + VERSION = "2.2.12".freeze def self.bundler_major_version @bundler_major_version ||= VERSION.split(".").first.to_i diff --git a/lib/rubygems.rb b/lib/rubygems.rb index d5f6356822..c6c80637e7 100644 --- a/lib/rubygems.rb +++ b/lib/rubygems.rb @@ -8,7 +8,7 @@ require 'rbconfig' module Gem - VERSION = "3.2.11".freeze + VERSION = "3.2.12".freeze end # Must be first since it unloads the prelude from 1.9.2 -- cgit v1.2.3