Merge the latest stable versions of RubyGems and Bundler to Ruby 3.2.x (#7061)

[Bug #19350]

* Merge RubyGems-3.4.2 and Bundler-2.4.2

* Merge RubyGems-3.4.3 and Bundler-2.4.3

* Generate parser-text.rb of racc when sync it

* Ignore LICENSE files of libraries vendored in rubygems [ci skip]

* Adjust spec of bundler like as `sync_default_gems` [ci skip]

* Fixed a typo

* Removed vendored LICENSE file.

* Update LEGAL sections for pub_grub

* Merge RubyGems-3.4.4 and Bundler-2.4.4

* Merge RubyGems-3.4.5 and Bundler-2.4.5

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
This commit is contained in:
Hiroshi SHIBATA 2023-01-25 23:32:01 +09:00 committed by GitHub
parent fee5b8f263
commit a22eca8231
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
105 changed files with 1337 additions and 752 deletions

View file

@ -1,9 +1,4 @@
# frozen_string_literal: true
##
# RubyGems adds the #gem method to allow activation of specific gem versions
# and overrides the #require method on Kernel to make gems appear as if they
# live on the <code>$LOAD_PATH</code>. See the documentation of these methods
# for further detail.
module Kernel

View file

@ -13,12 +13,12 @@ module Kernel
# Make sure we have a reference to Ruby's original Kernel#require
unless defined?(gem_original_require)
# :stopdoc:
alias gem_original_require require
private :gem_original_require
# :startdoc:
end
file = Gem::KERNEL_WARN_IGNORES_INTERNAL_ENTRIES ? "<internal:#{__FILE__}>" : __FILE__
module_eval <<'RUBY', file, __LINE__ + 1 # rubocop:disable Style/EvalWithLocation
##
# When RubyGems is required, Kernel#require is replaced with our own which
# is capable of loading gems on demand.
@ -33,7 +33,7 @@ module Kernel
# The normal <tt>require</tt> functionality of returning false if
# that file has already been loaded is preserved.
def require(path)
def require(path) # :doc:
if RUBYGEMS_ACTIVATION_MONITOR.respond_to?(:mon_owned?)
monitor_owned = RUBYGEMS_ACTIVATION_MONITOR.mon_owned?
end
@ -147,17 +147,17 @@ module Kernel
RUBYGEMS_ACTIVATION_MONITOR.exit
return gem_original_require(path)
rescue LoadError => load_error
RUBYGEMS_ACTIVATION_MONITOR.enter
if load_error.path == path
RUBYGEMS_ACTIVATION_MONITOR.enter
begin
if load_error.path == path and Gem.try_activate(path)
require_again = true
begin
require_again = Gem.try_activate(path)
ensure
RUBYGEMS_ACTIVATION_MONITOR.exit
end
ensure
RUBYGEMS_ACTIVATION_MONITOR.exit
end
return gem_original_require(path) if require_again
return gem_original_require(path) if require_again
end
raise load_error
ensure
@ -168,7 +168,6 @@ module Kernel
end
end
end
RUBY
private :require

View file

@ -1,53 +1,50 @@
# frozen_string_literal: true
if !Gem::KERNEL_WARN_IGNORES_INTERNAL_ENTRIES
module Kernel
rubygems_path = "#{__dir__}/" # Frames to be skipped start with this path.
module Kernel
rubygems_path = "#{__dir__}/" # Frames to be skipped start with this path.
original_warn = instance_method(:warn)
original_warn = instance_method(:warn)
remove_method :warn
class << self
remove_method :warn
end
class << self
remove_method :warn
module_function define_method(:warn) {|*messages, **kw|
unless uplevel = kw[:uplevel]
if Gem.java_platform? && RUBY_VERSION < "3.1"
return original_warn.bind(self).call(*messages)
else
return original_warn.bind(self).call(*messages, **kw)
end
end
module_function define_method(:warn) {|*messages, **kw|
unless uplevel = kw[:uplevel]
if Gem.java_platform? && RUBY_VERSION < "3.1"
return original_warn.bind(self).call(*messages)
else
return original_warn.bind(self).call(*messages, **kw)
# Ensure `uplevel` fits a `long`
uplevel, = [uplevel].pack("l!").unpack("l!")
if uplevel >= 0
start = 0
while uplevel >= 0
loc, = caller_locations(start, 1)
unless loc
# No more backtrace
start += uplevel
break
end
end
# Ensure `uplevel` fits a `long`
uplevel, = [uplevel].pack("l!").unpack("l!")
start += 1
if uplevel >= 0
start = 0
while uplevel >= 0
loc, = caller_locations(start, 1)
unless loc
# No more backtrace
start += uplevel
break
end
start += 1
if path = loc.path
unless path.start_with?(rubygems_path) || path.start_with?("<internal:")
# Non-rubygems frames
uplevel -= 1
end
if path = loc.path
unless path.start_with?(rubygems_path) || path.start_with?("<internal:")
# Non-rubygems frames
uplevel -= 1
end
end
kw[:uplevel] = start
end
kw[:uplevel] = start
end
original_warn.bind(self).call(*messages, **kw)
}
end
original_warn.bind(self).call(*messages, **kw)
}
end