Merge branch 'master' into portable-ruby-3.3.8

This commit is contained in:
Patrick Linnane 2025-04-11 13:12:28 -07:00 committed by GitHub
commit 053e3424fa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
103 changed files with 605 additions and 517 deletions

View File

@ -77,7 +77,7 @@ jobs:
path: results.sarif path: results.sarif
- name: Upload SARIF file - name: Upload SARIF file
uses: github/codeql-action/upload-sarif@fc7e4a0fa01c3cca5fd6a1fddec5c0740c977aa2 # v3.28.14 uses: github/codeql-action/upload-sarif@45775bd8235c68ba998cffa5171334d58593da47 # v3.28.15
with: with:
sarif_file: results.sarif sarif_file: results.sarif
category: zizmor category: zizmor

View File

@ -28,7 +28,7 @@ jobs:
persist-credentials: false persist-credentials: false
- name: Initialize CodeQL - name: Initialize CodeQL
uses: github/codeql-action/init@fc7e4a0fa01c3cca5fd6a1fddec5c0740c977aa2 # v3.28.14 uses: github/codeql-action/init@45775bd8235c68ba998cffa5171334d58593da47 # v3.28.15
with: with:
languages: ruby languages: ruby
config: | config: |
@ -36,4 +36,4 @@ jobs:
- Library/Homebrew/vendor - Library/Homebrew/vendor
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@fc7e4a0fa01c3cca5fd6a1fddec5c0740c977aa2 # v3.28.14 uses: github/codeql-action/analyze@45775bd8235c68ba998cffa5171334d58593da47 # v3.28.15

View File

@ -257,9 +257,6 @@ jobs:
test-flags: --coverage test-flags: --coverage
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: ghcr.io/homebrew/ubuntu20.04:latest container: ghcr.io/homebrew/ubuntu20.04:latest
- name: tests (macOS 13 x86_64)
test-flags: --coverage
runs-on: macos-13
- name: tests (macOS 15 arm64) - name: tests (macOS 15 arm64)
test-flags: --coverage test-flags: --coverage
runs-on: macos-15 runs-on: macos-15

View File

@ -47,7 +47,7 @@ GEM
pycall (1.5.2) pycall (1.5.2)
racc (1.8.1) racc (1.8.1)
rainbow (3.1.1) rainbow (3.1.1)
rbi (0.3.1) rbi (0.3.2)
prism (~> 1.0) prism (~> 1.0)
rbs (>= 3.4.4) rbs (>= 3.4.4)
sorbet-runtime (>= 0.5.9204) sorbet-runtime (>= 0.5.9204)
@ -103,7 +103,7 @@ GEM
rubocop (~> 1.72, >= 1.72.1) rubocop (~> 1.72, >= 1.72.1)
rubocop-sorbet (0.10.0) rubocop-sorbet (0.10.0)
rubocop (>= 1) rubocop (>= 1)
ruby-lsp (0.23.13) ruby-lsp (0.23.14)
language_server-protocol (~> 3.17.0) language_server-protocol (~> 3.17.0)
prism (>= 1.2, < 2.0) prism (>= 1.2, < 2.0)
rbs (>= 3, < 4) rbs (>= 3, < 4)
@ -121,15 +121,15 @@ GEM
simplecov-html (0.13.1) simplecov-html (0.13.1)
simplecov_json_formatter (0.1.4) simplecov_json_formatter (0.1.4)
simpleidn (0.2.3) simpleidn (0.2.3)
sorbet (0.5.11993) sorbet (0.5.12003)
sorbet-static (= 0.5.11993) sorbet-static (= 0.5.12003)
sorbet-runtime (0.5.11993) sorbet-runtime (0.5.12003)
sorbet-static (0.5.11993-aarch64-linux) sorbet-static (0.5.12003-aarch64-linux)
sorbet-static (0.5.11993-universal-darwin) sorbet-static (0.5.12003-universal-darwin)
sorbet-static (0.5.11993-x86_64-linux) sorbet-static (0.5.12003-x86_64-linux)
sorbet-static-and-runtime (0.5.11993) sorbet-static-and-runtime (0.5.12003)
sorbet (= 0.5.11993) sorbet (= 0.5.12003)
sorbet-runtime (= 0.5.11993) sorbet-runtime (= 0.5.12003)
spoom (1.6.1) spoom (1.6.1)
erubi (>= 1.10.0) erubi (>= 1.10.0)
prism (>= 0.28.0) prism (>= 0.28.0)

View File

@ -1,6 +1,7 @@
# typed: false # rubocop:todo Sorbet/TrueSigil # typed: false # rubocop:todo Sorbet/TrueSigil
# frozen_string_literal: true # frozen_string_literal: true
require "English"
require "exceptions" require "exceptions"
require "extend/ENV" require "extend/ENV"
require "utils" require "utils"
@ -10,47 +11,9 @@ module Homebrew
module Bundle module Bundle
module Commands module Commands
module Exec module Exec
# Homebrew's global environment variables that we don't want to leak into
# the `brew bundle exec` environment.
HOMEBREW_ENV_CLEANUP = %w[
HOMEBREW_HELP_MESSAGE
HOMEBREW_API_DEFAULT_DOMAIN
HOMEBREW_BOTTLE_DEFAULT_DOMAIN
HOMEBREW_BREW_DEFAULT_GIT_REMOTE
HOMEBREW_CORE_DEFAULT_GIT_REMOTE
HOMEBREW_DEFAULT_CACHE
HOMEBREW_DEFAULT_LOGS
HOMEBREW_DEFAULT_TEMP
HOMEBREW_REQUIRED_RUBY_VERSION
HOMEBREW_PRODUCT
HOMEBREW_SYSTEM
HOMEBREW_PROCESSOR
HOMEBREW_PHYSICAL_PROCESSOR
HOMEBREW_BREWED_CURL_PATH
HOMEBREW_USER_AGENT_CURL
HOMEBREW_USER_AGENT
HOMEBREW_GENERIC_DEFAULT_PREFIX
HOMEBREW_GENERIC_DEFAULT_REPOSITORY
HOMEBREW_DEFAULT_PREFIX
HOMEBREW_DEFAULT_REPOSITORY
HOMEBREW_AUTO_UPDATE_COMMAND
HOMEBREW_BREW_GIT_REMOTE
HOMEBREW_COMMAND_DEPTH
HOMEBREW_CORE_GIT_REMOTE
HOMEBREW_MACOS_VERSION_NUMERIC
HOMEBREW_MINIMUM_GIT_VERSION
HOMEBREW_MACOS_NEWEST_UNSUPPORTED
HOMEBREW_MACOS_OLDEST_SUPPORTED
HOMEBREW_MACOS_OLDEST_ALLOWED
HOMEBREW_GITHUB_PACKAGES_AUTH
].freeze
PATH_LIKE_ENV_REGEX = /.+#{File::PATH_SEPARATOR}/ PATH_LIKE_ENV_REGEX = /.+#{File::PATH_SEPARATOR}/
def self.run(*args, global: false, file: nil, subcommand: "", services: false) def self.run(*args, global: false, file: nil, subcommand: "", services: false)
# Cleanup Homebrew's global environment
HOMEBREW_ENV_CLEANUP.each { |key| ENV.delete(key) }
# Store the old environment so we can check if things were already set # Store the old environment so we can check if things were already set
# before we start mutating it. # before we start mutating it.
old_env = ENV.to_h old_env = ENV.to_h
@ -153,11 +116,32 @@ module Homebrew
# No need to export empty values. # No need to export empty values.
next if value.blank? next if value.blank?
# Skip exporting non-Homebrew things that were already set in the old environment. # Skip exporting Homebrew internal variables that won't be used by other tools.
next if !key.start_with?("HOMEBREW_") && old_env.key?(key) && old_env[key] == value # Those Homebrew needs have already been set to global constants and/or are exported again later.
# Setting these globally can interfere with nested Homebrew invocations/environments.
next if key.start_with?("HOMEBREW_", "PORTABLE_RUBY_")
# Skip exporting things that were the same in the old environment.
old_value = old_env[key]
next if old_value == value
# Look for PATH-like environment variables
if key.include?("PATH") && value.match?(PATH_LIKE_ENV_REGEX)
old_values = old_value.to_s.split(File::PATH_SEPARATOR)
path = PATH.new(value)
.reject do |path_value|
# Exclude Homebrew shims from the PATH as they don't work
# without all Homebrew environment variables.
# Exclude existing/old values as they've already been exported.
path_value.include?("/Homebrew/shims/") || old_values.include?(path_value)
end
next if path.blank?
puts "export #{key}=\"#{Utils::Shell.sh_quote(path.to_s)}:${#{key}:-}\""
else
puts "export #{key}=\"#{Utils::Shell.sh_quote(value)}\"" puts "export #{key}=\"#{Utils::Shell.sh_quote(value)}\""
end end
end
return return
end end

View File

@ -240,8 +240,7 @@ module Homebrew
sig { returns(T.nilable(String)) } sig { returns(T.nilable(String)) }
def __gets def __gets
gots = $stdin.gets.chomp $stdin.gets&.presence&.chomp
gots.empty? ? nil : gots
end end
end end
end end

View File

@ -63,16 +63,18 @@ module Homebrew
exec_editor(*paths) exec_editor(*paths)
if paths.any? do |path| is_formula = T.let(false, T::Boolean)
if !Homebrew::EnvConfig.no_env_hints? && paths.any? do |path|
next if path == "--project" next if path == "--project"
!Homebrew::EnvConfig.no_install_from_api? && is_formula = core_formula_path?(path)
!Homebrew::EnvConfig.no_env_hints? && is_formula || core_cask_path?(path) || core_formula_tap?(path) || core_cask_tap?(path)
(core_formula_path?(path) || core_cask_path?(path) || core_formula_tap?(path) || core_cask_tap?(path))
end end
opoo <<~EOS from_source = " --build-from-source" if is_formula
`brew install` ignores locally edited casks and formulae if no_api = "HOMEBREW_NO_INSTALL_FROM_API=1 " unless Homebrew::EnvConfig.no_install_from_api?
HOMEBREW_NO_INSTALL_FROM_API is not set. puts <<~EOS
To test your local edits, run:
#{no_api}brew install#{from_source} --verbose --debug #{args.named.join(" ")}
EOS EOS
end end
end end

View File

@ -28,6 +28,7 @@ module Homebrew
Homebrew.install_bundler! Homebrew.install_bundler!
ENV["BUNDLE_WITH"] = Homebrew.valid_gem_groups.join(":") ENV["BUNDLE_WITH"] = Homebrew.valid_gem_groups.join(":")
ENV["BUNDLER_VERSION"] = HOMEBREW_BUNDLER_VERSION
ohai "cd #{HOMEBREW_LIBRARY_PATH}" ohai "cd #{HOMEBREW_LIBRARY_PATH}"
HOMEBREW_LIBRARY_PATH.cd do HOMEBREW_LIBRARY_PATH.cd do

View File

@ -68,13 +68,13 @@ six==1.17.0 \
--hash=sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274 \ --hash=sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274 \
--hash=sha256:ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81 --hash=sha256:ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81
# via python-dateutil # via python-dateutil
typing-extensions==4.13.1 \ typing-extensions==4.13.2 \
--hash=sha256:4b6cf02909eb5495cfbc3f6e8fd49217e6cc7944e145cdda8caa3734777f9e69 \ --hash=sha256:a439e7c04b49fec3e5d3e2beaa21755cadbbdc391694e28ccdd36ca4a1408f8c \
--hash=sha256:98795af00fb9640edec5b8e31fc647597b4691f099ad75f469a2616be1a76dff --hash=sha256:e6c81219bd689f51865d9e372991c540bda33a0379d5573cddb9a3a23f7caaef
# via reactivex # via reactivex
urllib3==2.3.0 \ urllib3==2.4.0 \
--hash=sha256:1cee9ad369867bfdbbb48b7dd50374c0967a0bb7710050facf0dd6911440e3df \ --hash=sha256:414bc6535b787febd7567804cc015fee39daab8ad86268f1310a9250697de466 \
--hash=sha256:f8c5449b3cf0861679ce7e0503c7b44b5ec981bec0d1d3795a07f1ba96f0204d --hash=sha256:4e16665048960a0900c702d4a66415956a584919c03361cac9f1df5c5dd7e813
# via influxdb3-python # via influxdb3-python
# The following packages are considered to be unsafe in a requirements file: # The following packages are considered to be unsafe in a requirements file:

View File

@ -31,6 +31,7 @@ require "migrator"
require "linkage_checker" require "linkage_checker"
require "extend/ENV" require "extend/ENV"
require "language/java" require "language/java"
require "language/php"
require "language/python" require "language/python"
require "tab" require "tab"
require "mktemp" require "mktemp"

View File

@ -65,12 +65,10 @@ RSpec.describe Homebrew::Bundle::Commands::Exec do
context "with env command" do context "with env command" do
it "outputs the environment variables" do it "outputs the environment variables" do
ENV["HOMEBREW_PREFIX"] = "/opt/homebrew"
ENV["HOMEBREW_PATH"] = "/usr/bin"
allow(OS).to receive(:linux?).and_return(true) allow(OS).to receive(:linux?).and_return(true)
expect { described_class.run("env", subcommand: "env") }.to \ expect { described_class.run("env", subcommand: "env") }.to \
output(/HOMEBREW_PREFIX="#{ENV.fetch("HOMEBREW_PREFIX")}"/).to_stdout output(/export PATH=".+:\${PATH:-}"/).to_stdout
end end
end end

View File

@ -54,19 +54,11 @@ RSpec.describe Homebrew::Cmd::UpgradeCmd do
regex = / regex = /
Formulae\s*\(3\):\s* Formulae\s*\(3\):\s*
( (testball|testball5|testball4)
testball|testball5|testball4
)
\s*,\s* \s*,\s*
(?!\1) ((?!\1)testball|testball5|testball4)
(
testball|testball5|testball4
)
\s*,\s* \s*,\s*
(?!\1|\2) ((?!\1|\2)testball|testball5|testball4)
(
testball|testball5|testball4
)
/x /x
expect do expect do
brew "upgrade", "--ask" brew "upgrade", "--ask"

View File

@ -77,8 +77,8 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rainbow-3.1.1/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rainbow-3.1.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/rbs-3.9.2") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/rbs-3.9.2")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rbs-3.9.2/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rbs-3.9.2/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-runtime-0.5.11993/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-runtime-0.5.12003/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rbi-0.3.1/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rbi-0.3.2/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/redcarpet-3.6.1") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/redcarpet-3.6.1")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/redcarpet-3.6.1/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/redcarpet-3.6.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-support-3.13.2/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rspec-support-3.13.2/lib")
@ -99,7 +99,7 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-performance-1.25.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-performance-1.25.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rspec-3.5.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rspec-3.5.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-sorbet-0.10.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-sorbet-0.10.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-lsp-0.23.13/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-lsp-0.23.14/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-macho-4.1.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-macho-4.1.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/ruby-prof-1.7.1") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/ruby-prof-1.7.1")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-prof-1.7.1/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-prof-1.7.1/lib")
@ -107,9 +107,9 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/simplecov_json_formatter-0.1.4/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/simplecov_json_formatter-0.1.4/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/simplecov-0.22.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/simplecov-0.22.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/simplecov-cobertura-2.1.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/simplecov-cobertura-2.1.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-static-0.5.11993-universal-darwin/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-static-0.5.12003-universal-darwin/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-0.5.11993/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-0.5.12003/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-static-and-runtime-0.5.11993/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-static-and-runtime-0.5.12003/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/thor-1.3.2/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/thor-1.3.2/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/spoom-1.6.1/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/spoom-1.6.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/stackprof-0.2.27") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/stackprof-0.2.27")

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