ruby-changes:62968
From: Hiroshi <ko1@a...>
Date: Tue, 15 Sep 2020 21:17:46 +0900 (JST)
Subject: [ruby-changes:62968] 7d76314885 (ruby_2_7): Merge RubyGems 3.1.4
https://git.ruby-lang.org/ruby.git/commit/?id=7d76314885 From 7d76314885be3532999684356657ce36da84d04e Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA <hsbt@r...> Date: Tue, 30 Jun 2020 21:23:37 +0900 Subject: Merge RubyGems 3.1.4 diff --git a/lib/rubygems.rb b/lib/rubygems.rb index 57cb70c..94242a1 100644 --- a/lib/rubygems.rb +++ b/lib/rubygems.rb @@ -9,7 +9,7 @@ https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb#L9 require 'rbconfig' module Gem - VERSION = "3.1.2".freeze + VERSION = "3.1.4".freeze end # Must be first since it unloads the prelude from 1.9.2 @@ -26,19 +26,19 @@ require 'rubygems/errors' https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb#L26 # For user documentation, see: # # * <tt>gem help</tt> and <tt>gem help [command]</tt> -# * {RubyGems User Guide}[http://guides.rubygems.org/] -# * {Frequently Asked Questions}[http://guides.rubygems.org/faqs] +# * {RubyGems User Guide}[https://guides.rubygems.org/] +# * {Frequently Asked Questions}[https://guides.rubygems.org/faqs] # # For gem developer documentation see: # -# * {Creating Gems}[http://guides.rubygems.org/make-your-own-gem] +# * {Creating Gems}[https://guides.rubygems.org/make-your-own-gem] # * Gem::Specification # * Gem::Version for version dependency notes # # Further RubyGems documentation can be found at: # -# * {RubyGems Guides}[http://guides.rubygems.org] -# * {RubyGems API}[http://www.rubydoc.info/github/rubygems/rubygems] (also available from +# * {RubyGems Guides}[https://guides.rubygems.org] +# * {RubyGems API}[https://www.rubydoc.info/github/rubygems/rubygems] (also available from # <tt>gem server</tt>) # # == RubyGems Plugins @@ -189,6 +189,8 @@ module Gem https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb#L189 @pre_reset_hooks ||= [] @post_reset_hooks ||= [] + @default_source_date_epoch = nil + ## # Try to activate a gem containing +path+. Returns true if # activation succeeded or wasn't needed because it was already @@ -1236,20 +1238,43 @@ An Array (#{env.inspect}) was passed in from #{caller[3]} https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb#L1238 end ## - # The SOURCE_DATE_EPOCH environment variable (or, if that's not set, the current time), converted to Time object. - # This is used throughout RubyGems for enabling reproducible builds. + # If the SOURCE_DATE_EPOCH environment variable is set, returns it's value. + # Otherwise, returns the time that `Gem.source_date_epoch_string` was + # first called in the same format as SOURCE_DATE_EPOCH. # - # If it is not set as an environment variable already, this also sets it. + # NOTE(@duckinator): The implementation is a tad weird because we want to: + # 1. Make builds reproducible by default, by having this function always + # return the same result during a given run. + # 2. Allow changing ENV['SOURCE_DATE_EPOCH'] at runtime, since multiple + # tests that set this variable will be run in a single process. + # + # If you simplify this function and a lot of tests fail, that is likely + # due to #2 above. # # Details on SOURCE_DATE_EPOCH: # https://reproducible-builds.org/specs/source-date-epoch/ - def self.source_date_epoch - if ENV["SOURCE_DATE_EPOCH"].nil? || ENV["SOURCE_DATE_EPOCH"].empty? - ENV["SOURCE_DATE_EPOCH"] = Time.now.to_i.to_s - end + def self.source_date_epoch_string + # The value used if $SOURCE_DATE_EPOCH is not set. + @default_source_date_epoch ||= Time.now.to_i.to_s + + specified_epoch = ENV["SOURCE_DATE_EPOCH"] + + # If it's empty or just whitespace, treat it like it wasn't set at all. + specified_epoch = nil if !specified_epoch.nil? && specified_epoch.strip.empty? + + epoch = specified_epoch || @default_source_date_epoch - Time.at(ENV["SOURCE_DATE_EPOCH"].to_i).utc.freeze + epoch.strip + end + + ## + # Returns the value of Gem.source_date_epoch_string, as a Time object. + # + # This is used throughout RubyGems for enabling reproducible builds. + + def self.source_date_epoch + Time.at(self.source_date_epoch_string.to_i).utc.freeze end # FIX: Almost everywhere else we use the `def self.` way of defining class @@ -1281,10 +1306,11 @@ An Array (#{env.inspect}) was passed in from #{caller[3]} https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb#L1306 # def register_default_spec(spec) - new_format = spec.require_paths.any? {|path| spec.files.any? {|f| f.start_with? path } } + extended_require_paths = spec.require_paths.map {|f| f + "/"} + new_format = extended_require_paths.any? {|path| spec.files.any? {|f| f.start_with? path } } if new_format - prefix_group = spec.require_paths.map {|f| f + "/"}.join("|") + prefix_group = extended_require_paths.join("|") prefix_pattern = /^(#{prefix_group})/ end @@ -1366,23 +1392,24 @@ An Array (#{env.inspect}) was passed in from #{caller[3]} https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb#L1392 MARSHAL_SPEC_DIR = "quick/Marshal.#{Gem.marshal_version}/".freeze - autoload :BundlerVersionFinder, 'rubygems/bundler_version_finder' - autoload :ConfigFile, 'rubygems/config_file' - autoload :Dependency, 'rubygems/dependency' - autoload :DependencyList, 'rubygems/dependency_list' - autoload :Installer, 'rubygems/installer' - autoload :Licenses, 'rubygems/util/licenses' - autoload :PathSupport, 'rubygems/path_support' - autoload :Platform, 'rubygems/platform' - autoload :RequestSet, 'rubygems/request_set' - autoload :Requirement, 'rubygems/requirement' - autoload :Resolver, 'rubygems/resolver' - autoload :Source, 'rubygems/source' - autoload :SourceList, 'rubygems/source_list' - autoload :SpecFetcher, 'rubygems/spec_fetcher' - autoload :Specification, 'rubygems/specification' - autoload :Util, 'rubygems/util' - autoload :Version, 'rubygems/version' + autoload :BundlerVersionFinder, File.expand_path('rubygems/bundler_version_finder', __dir__) + autoload :ConfigFile, File.expand_path('rubygems/config_file', __dir__) + autoload :Dependency, File.expand_path('rubygems/dependency', __dir__) + autoload :DependencyList, File.expand_path('rubygems/dependency_list', __dir__) + autoload :Installer, File.expand_path('rubygems/installer', __dir__) + autoload :Licenses, File.expand_path('rubygems/util/licenses', __dir__) + autoload :NameTuple, File.expand_path('rubygems/name_tuple', __dir__) + autoload :PathSupport, File.expand_path('rubygems/path_support', __dir__) + autoload :Platform, File.expand_path('rubygems/platform', __dir__) + autoload :RequestSet, File.expand_path('rubygems/request_set', __dir__) + autoload :Requirement, File.expand_path('rubygems/requirement', __dir__) + autoload :Resolver, File.expand_path('rubygems/resolver', __dir__) + autoload :Source, File.expand_path('rubygems/source', __dir__) + autoload :SourceList, File.expand_path('rubygems/source_list', __dir__) + autoload :SpecFetcher, File.expand_path('rubygems/spec_fetcher', __dir__) + autoload :Specification, File.expand_path('rubygems/specification', __dir__) + autoload :Util, File.expand_path('rubygems/util', __dir__) + autoload :Version, File.expand_path('rubygems/version', __dir__) require "rubygems/specification" end diff --git a/lib/rubygems/basic_specification.rb b/lib/rubygems/basic_specification.rb index c6d63ac..339953e 100644 --- a/lib/rubygems/basic_specification.rb +++ b/lib/rubygems/basic_specification.rb @@ -78,7 +78,7 @@ class Gem::BasicSpecification https://github.com/ruby/ruby/blob/trunk/lib/rubygems/basic_specification.rb#L78 elsif missing_extensions? @ignored = true - if RUBY_ENGINE == platform || Gem::Platform.local === platform + if Gem::Platform::RUBY == platform || Gem::Platform.local === platform warn "Ignoring #{full_name} because its extensions are not built. " + "Try: gem pristine #{name} --version #{version}" end diff --git a/lib/rubygems/command.rb b/lib/rubygems/command.rb index c1e5e13..32ec0f8 100644 --- a/lib/rubygems/command.rb +++ b/lib/rubygems/command.rb @@ -646,7 +646,7 @@ basic help message containing pointers to more information. https://github.com/ruby/ruby/blob/trunk/lib/rubygems/command.rb#L646 http://localhost:8808/ with info about installed gems Further information: - http://guides.rubygems.org + https://guides.rubygems.org HELP # :startdoc: diff --git a/lib/rubygems/commands/help_command.rb b/lib/rubygems/commands/help_command.rb index 9f14e22..259e8b5 100644 --- a/lib/rubygems/commands/help_command.rb +++ b/lib/rubygems/commands/help_command.rb @@ -38,7 +38,7 @@ Some examples of 'gem' usage. https://github.com/ruby/ruby/blob/trunk/lib/rubygems/commands/help_command.rb#L38 * Create a gem: - See http://guides.rubygems.org/make-your-own-gem/ + See https://guides.rubygems.org/make-your-own-gem/ * See information about RubyGems: diff --git a/lib/rubygems/commands/sources_command.rb b/lib/rubygems/commands/sources_command.rb index feab232..ca9d425 100644 --- a/lib/rubygems/commands/sources_command.rb +++ b/lib/rubygems/commands/sources_command.rb @@ -136,7 +136,7 @@ RubyGems has been configured to serve gems via the following URLs through https://github.com/ruby/ruby/blob/trunk/lib/rubygems/commands/sources_command.rb#L136 its history: * http://gems.rubyforge.org (RubyGems 1.3.6 and earlier) -* http://rubygems.org (RubyGems 1.3.7 through 1.8.25) +* https://rubygems.org/ (RubyGems 1.3.7 through 1.8.25) * https://rubygems.org (RubyGems 2.0.1 and newer) Since all of these sources point to the same set of gems you only need one @@ (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/