Merge pull request #17312 from Homebrew/portable-ruby-3.3.1

Portable Ruby 3.3.1
This commit is contained in:
Mike McQuaid 2024-05-17 12:42:34 +09:00 committed by GitHub
commit 23939d62d8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
212 changed files with 50 additions and 24 deletions

2
.gitignore vendored
View File

@ -40,7 +40,7 @@
# Ignore Ruby gems for versions other than we explicitly vendor. # Ignore Ruby gems for versions other than we explicitly vendor.
# Keep this in sync with the list in standalone/init.rb. # Keep this in sync with the list in standalone/init.rb.
**/vendor/bundle/ruby/*/ **/vendor/bundle/ruby/*/
!**/vendor/bundle/ruby/3.1.0/ !**/vendor/bundle/ruby/3.3.0/
# Ignore Bundler binary files # Ignore Bundler binary files
**/vendor/bundle/ruby/*/gems/**/*.bundle **/vendor/bundle/ruby/*/gems/**/*.bundle

View File

@ -221,7 +221,7 @@ Performance/MethodObjectAsBlock:
RSpec: RSpec:
Include: Include:
- 'Homebrew/test/**/*' - "Homebrew/test/**/*"
# Intentionally disabled as it doesn't fit with our code style. # Intentionally disabled as it doesn't fit with our code style.
RSpec/AnyInstance: RSpec/AnyInstance:
@ -284,6 +284,7 @@ Sorbet/TrueSigil:
- "/**/{Formula,Casks}/**/*.rb" - "/**/{Formula,Casks}/**/*.rb"
- "**/{Formula,Casks}/**/*.rb" - "**/{Formula,Casks}/**/*.rb"
- "Homebrew/test/**/*.rb" - "Homebrew/test/**/*.rb"
- "Homebrew/extend/pathname/rmtree.rb"
# Require &&/|| instead of and/or # Require &&/|| instead of and/or
Style/AndOr: Style/AndOr:

View File

@ -33,6 +33,7 @@ Style/Documentation:
- extend/ENV/super.rb - extend/ENV/super.rb
- extend/kernel.rb - extend/kernel.rb
- extend/pathname.rb - extend/pathname.rb
- extend/pathname/rmtree.rb
- formula.rb - formula.rb
- formula_assertions.rb - formula_assertions.rb
- formula_free_port.rb - formula_free_port.rb

View File

@ -5,9 +5,9 @@ source "https://rubygems.org"
# The default case (no envs), should always be a restrictive bound on the lowest supported minor version. # The default case (no envs), should always be a restrictive bound on the lowest supported minor version.
# This is the branch that Dependabot will use. # This is the branch that Dependabot will use.
if ENV.fetch("HOMEBREW_USE_RUBY_FROM_PATH", "").empty? if ENV.fetch("HOMEBREW_USE_RUBY_FROM_PATH", "").empty?
ruby "~> 3.1.0" ruby "~> 3.3.0"
else else
ruby ">= 3.1.0" ruby ">= 3.3.0"
end end
# disallowed gems (should not be used) # disallowed gems (should not be used)

View File

@ -206,7 +206,7 @@ DEPENDENCIES
yard-sorbet yard-sorbet
RUBY VERSION RUBY VERSION
ruby 3.1.4p223 ruby 3.3.1
BUNDLED WITH BUNDLED WITH
2.4.18 2.5.9

View File

@ -21,19 +21,19 @@ set_ruby_variables() {
# use a x86_64 Portable Ruby. # use a x86_64 Portable Ruby.
[[ "${VENDOR_PHYSICAL_PROCESSOR}" == "arm64" && "${HOMEBREW_PREFIX}" == "/usr/local" ]] [[ "${VENDOR_PHYSICAL_PROCESSOR}" == "arm64" && "${HOMEBREW_PREFIX}" == "/usr/local" ]]
then then
ruby_FILENAME="portable-ruby-3.1.4.el_capitan.bottle.tar.gz" ruby_FILENAME="portable-ruby-3.3.1.el_capitan.bottle.tar.gz"
ruby_SHA="02180ca8b8295422ae84921bcf034b7ee8ce5575488bd5e6a37a192e53cd5d34" ruby_SHA="34312337c0add491f876b04e8b273a258453d6b633226130ef3105373a97c950"
elif [[ "${VENDOR_PHYSICAL_PROCESSOR}" == "arm64" ]] elif [[ "${VENDOR_PHYSICAL_PROCESSOR}" == "arm64" ]]
then then
ruby_FILENAME="portable-ruby-3.1.4.arm64_big_sur.bottle.tar.gz" ruby_FILENAME="portable-ruby-3.3.1.arm64_big_sur.bottle.tar.gz"
ruby_SHA="d783cbeb6e6ef0d71c0b442317b54554370decd6fac66bf2d4938c07a63f67be" ruby_SHA="86ff822590529e8e9093cdc1702a1d3321678c85347d30f82db4f993db8f9eb1"
fi fi
elif [[ -n "${HOMEBREW_LINUX}" ]] elif [[ -n "${HOMEBREW_LINUX}" ]]
then then
case "${VENDOR_PROCESSOR}" in case "${VENDOR_PROCESSOR}" in
x86_64) x86_64)
ruby_FILENAME="portable-ruby-3.1.4.x86_64_linux.bottle.tar.gz" ruby_FILENAME="portable-ruby-3.3.1.x86_64_linux.bottle.tar.gz"
ruby_SHA="f7be167f7ac4f296b9f4c5874ceeea4aafd9999c3c7f2b0378cae7dd273e2322" ruby_SHA="f49956aa43522c8e86127f7f5d377af2651fe35da975f5993eb2d038865c118c"
;; ;;
*) ;; *) ;;
esac esac
@ -59,7 +59,7 @@ set_ruby_variables() {
fi fi
ruby_URLs+=( ruby_URLs+=(
"https://ghcr.io/v2/homebrew/portable-ruby/portable-ruby/blobs/sha256:${ruby_SHA}" "https://ghcr.io/v2/homebrew/portable-ruby/portable-ruby/blobs/sha256:${ruby_SHA}"
"https://github.com/Homebrew/homebrew-portable-ruby/releases/download/3.1.4/${ruby_FILENAME}" "https://github.com/Homebrew/homebrew-portable-ruby/releases/download/3.3.1/${ruby_FILENAME}"
) )
ruby_URL="${ruby_URLs[0]}" ruby_URL="${ruby_URLs[0]}"
fi fi

View File

@ -584,3 +584,5 @@ module ObserverPathnameExtension
puts "uninfo #{self}" if ObserverPathnameExtension.verbose? puts "uninfo #{self}" if ObserverPathnameExtension.verbose?
end end
end end
require "extend/pathname/rmtree"

View File

@ -0,0 +1,15 @@
# typed: false
# frozen_string_literal: true
class Pathname
# Like regular `rmtree`, except it never ignores errors.
#
# This was the default behaviour in Ruby 3.1 and earlier.
#
# @api public
def rmtree(noop: nil, verbose: nil, secure: nil)
# odeprecated "rmtree", "FileUtils#rm_r"
FileUtils.rm_r(@path, noop:, verbose:, secure:)
nil
end
end

View File

@ -17,7 +17,7 @@ else
end end
# This list should match .gitignore # This list should match .gitignore
vendored_versions = ["3.1"].freeze vendored_versions = ["3.3"].freeze
vendored_versions.include?("#{ruby_major}.#{ruby_minor}") vendored_versions.include?("#{ruby_major}.#{ruby_minor}")
end.freeze end.freeze
@ -43,8 +43,8 @@ if Pathname.new(RbConfig.ruby).to_s.include?("/vendor/portable-ruby/")
ruby_version = RbConfig::CONFIG["ruby_version"] ruby_version = RbConfig::CONFIG["ruby_version"]
ruby_path = "#{RbConfig::CONFIG["rubylibprefix"]}/gems/#{ruby_version}" ruby_path = "#{RbConfig::CONFIG["rubylibprefix"]}/gems/#{ruby_version}"
$LOAD_PATH.unshift "#{ruby_path}/extensions/#{Gem::Platform.local}/#{ruby_version}-static/debug-1.6.3" $LOAD_PATH.unshift "#{ruby_path}/extensions/#{Gem::Platform.local}/#{ruby_version}-static/debug-1.9.1"
$LOAD_PATH.unshift "#{ruby_path}/gems/debug-1.6.3/lib" $LOAD_PATH.unshift "#{ruby_path}/gems/debug-1.9.1/lib"
end end
unless $LOAD_PATH.include?(HOMEBREW_LIBRARY_PATH.to_s) unless $LOAD_PATH.include?(HOMEBREW_LIBRARY_PATH.to_s)

View File

@ -314,8 +314,8 @@ RSpec.shared_examples "#uninstall_phase or #zap_phase" do
before do before do
allow_any_instance_of(Cask::Artifact::AbstractUninstall).to receive(:trash_paths) allow_any_instance_of(Cask::Artifact::AbstractUninstall).to receive(:trash_paths)
.and_wrap_original do |method, *args| .and_wrap_original do |method, *args, **kwargs|
method.call(*args).tap do |trashed, _| method.call(*args, **kwargs).tap do |trashed, _|
FileUtils.rm_r trashed FileUtils.rm_r trashed
end end
end end

View File

@ -10,11 +10,11 @@ require "English"
module Homebrew module Homebrew
# Keep in sync with the `Gemfile.lock`'s BUNDLED WITH. # Keep in sync with the `Gemfile.lock`'s BUNDLED WITH.
# After updating this, run `brew vendor-gems --update=--bundler`. # After updating this, run `brew vendor-gems --update=--bundler`.
HOMEBREW_BUNDLER_VERSION = "2.4.18" HOMEBREW_BUNDLER_VERSION = "2.5.9"
# Bump this whenever a committed vendored gem is later added to or exclusion removed from gitignore. # Bump this whenever a committed vendored gem is later added to or exclusion removed from gitignore.
# This will trigger it to reinstall properly if `brew install-bundler-gems` needs it. # This will trigger it to reinstall properly if `brew install-bundler-gems` needs it.
VENDOR_VERSION = 6 VENDOR_VERSION = 7
private_constant :VENDOR_VERSION private_constant :VENDOR_VERSION
RUBY_BUNDLE_VENDOR_DIRECTORY = (HOMEBREW_LIBRARY_PATH/"vendor/bundle/ruby").freeze RUBY_BUNDLE_VENDOR_DIRECTORY = (HOMEBREW_LIBRARY_PATH/"vendor/bundle/ruby").freeze

View File

@ -1,6 +1,6 @@
# When bumping, run `brew vendor-gems --update=--ruby` # When bumping, run `brew vendor-gems --update=--ruby`
# When bumping to a new major/minor version, also update the bounds in the Gemfile # When bumping to a new major/minor version, also update the bounds in the Gemfile
export HOMEBREW_REQUIRED_RUBY_VERSION=3.1 export HOMEBREW_REQUIRED_RUBY_VERSION=3.3
# Disable Ruby options we don't need. # Disable Ruby options we don't need.
export HOMEBREW_RUBY_DISABLE_OPTIONS="--disable=gems,rubyopt" export HOMEBREW_RUBY_DISABLE_OPTIONS="--disable=gems,rubyopt"

View File

@ -1,4 +1,12 @@
require 'rbconfig' require 'rbconfig'
module Kernel
remove_method(:gem) if private_method_defined?(:gem)
def gem(*)
end
private :gem
end
unless defined?(Gem) unless defined?(Gem)
module Gem module Gem
def self.ruby_api_version def self.ruby_api_version
@ -17,8 +25,7 @@ end
if Gem.respond_to?(:discover_gems_on_require=) if Gem.respond_to?(:discover_gems_on_require=)
Gem.discover_gems_on_require = false Gem.discover_gems_on_require = false
else else
kernel = (class << ::Kernel; self; end) [::Kernel.singleton_class, ::Kernel].each do |k|
[kernel, ::Kernel].each do |k|
if k.private_method_defined?(:gem_original_require) if k.private_method_defined?(:gem_original_require)
private_require = k.private_method_defined?(:require) private_require = k.private_method_defined?(:require)
k.send(:remove_method, :require) k.send(:remove_method, :require)

Some files were not shown because too many files have changed in this diff Show More