Merge branch 'master' into caveats-remove-ansi

This commit is contained in:
Eric Knibbe 2025-03-25 07:54:52 -04:00 committed by GitHub
commit ffa83ea341
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
124 changed files with 280 additions and 121 deletions

View File

@ -57,7 +57,7 @@ jobs:
zizmor --format sarif . > results.sarif || true zizmor --format sarif . > results.sarif || true
- name: Upload SARIF file - name: Upload SARIF file
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with: with:
name: results.sarif name: results.sarif
path: results.sarif path: results.sarif
@ -72,13 +72,13 @@ jobs:
security-events: write security-events: write
steps: steps:
- name: Download SARIF file - name: Download SARIF file
uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9 uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
with: with:
name: results.sarif name: results.sarif
path: results.sarif path: results.sarif
- name: Upload SARIF file - name: Upload SARIF file
uses: github/codeql-action/upload-sarif@6bb031afdd8eb862ea3fc1848194185e076637e5 # v3.28.11 uses: github/codeql-action/upload-sarif@1b549b9259bda1cb5ddde3b41741a82a2d15a841 # v3.28.13
with: with:
sarif_file: results.sarif sarif_file: results.sarif
category: zizmor category: zizmor

View File

@ -34,7 +34,7 @@ jobs:
test-bot: true test-bot: true
- name: Cache Bundler RubyGems - name: Cache Bundler RubyGems
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with: with:
path: ${{ steps.set-up-homebrew.outputs.gems-path }} path: ${{ steps.set-up-homebrew.outputs.gems-path }}
key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }} key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }}

View File

@ -28,7 +28,7 @@ jobs:
persist-credentials: false persist-credentials: false
- name: Initialize CodeQL - name: Initialize CodeQL
uses: github/codeql-action/init@6bb031afdd8eb862ea3fc1848194185e076637e5 # v3.28.11 uses: github/codeql-action/init@1b549b9259bda1cb5ddde3b41741a82a2d15a841 # v3.28.13
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@6bb031afdd8eb862ea3fc1848194185e076637e5 # v3.28.11 uses: github/codeql-action/analyze@1b549b9259bda1cb5ddde3b41741a82a2d15a841 # v3.28.13

View File

@ -234,7 +234,7 @@ jobs:
- name: Upload the Docker image digest - name: Upload the Docker image digest
if: fromJSON(steps.attributes.outputs.push) if: fromJSON(steps.attributes.outputs.push)
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with: with:
name: digest-${{ matrix.version }}-${{ matrix.arch }} name: digest-${{ matrix.version }}-${{ matrix.arch }}
path: ${{ runner.temp }}/digests/* path: ${{ runner.temp }}/digests/*
@ -254,7 +254,7 @@ jobs:
cache-binary: false cache-binary: false
- name: Download Docker image digests - name: Download Docker image digests
uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9 uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
with: with:
path: ${{ runner.temp }}/digests path: ${{ runner.temp }}/digests
pattern: digest-${{ matrix.version }}-* pattern: digest-${{ matrix.version }}-*

View File

@ -53,7 +53,7 @@ jobs:
run: vale docs/ run: vale docs/
- name: Install Ruby - name: Install Ruby
uses: ruby/setup-ruby@922ebc4c5262cd14e07bb0e1db020984b6c064fe # v1.226.0 uses: ruby/setup-ruby@1a615958ad9d422dd932dc1d5823942ee002799f # v1.227.0
with: with:
bundler-cache: true bundler-cache: true
working-directory: docs working-directory: docs

View File

@ -138,7 +138,7 @@ jobs:
subject-path: Homebrew-${{ steps.homebrew-version.outputs.version }}.pkg subject-path: Homebrew-${{ steps.homebrew-version.outputs.version }}.pkg
- name: Upload installer to GitHub Actions - name: Upload installer to GitHub Actions
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with: with:
name: Homebrew-${{ steps.homebrew-version.outputs.version }}.pkg name: Homebrew-${{ steps.homebrew-version.outputs.version }}.pkg
path: Homebrew-${{ steps.homebrew-version.outputs.version }}.pkg path: Homebrew-${{ steps.homebrew-version.outputs.version }}.pkg
@ -160,7 +160,7 @@ jobs:
name: macos-15-arm64 name: macos-15-arm64
steps: steps:
- name: Download installer from GitHub Actions - name: Download installer from GitHub Actions
uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9 uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
with: with:
name: "${{ needs.build.outputs.installer_path }}" name: "${{ needs.build.outputs.installer_path }}"
@ -213,7 +213,7 @@ jobs:
contents: write contents: write
steps: steps:
- name: Download installer from GitHub Actions - name: Download installer from GitHub Actions
uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9 uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
with: with:
name: "${{ needs.build.outputs.installer_path }}" name: "${{ needs.build.outputs.installer_path }}"

View File

@ -43,7 +43,7 @@ jobs:
persist-credentials: false persist-credentials: false
- name: Install Ruby - name: Install Ruby
uses: ruby/setup-ruby@922ebc4c5262cd14e07bb0e1db020984b6c064fe # v1.226.0 uses: ruby/setup-ruby@1a615958ad9d422dd932dc1d5823942ee002799f # v1.227.0
with: with:
bundler-cache: true bundler-cache: true
working-directory: rubydoc working-directory: rubydoc

View File

@ -50,7 +50,7 @@ jobs:
signing_key: ${{ secrets.BREWTESTBOT_SSH_SIGNING_KEY }} signing_key: ${{ secrets.BREWTESTBOT_SSH_SIGNING_KEY }}
- name: Cache Bundler RubyGems - name: Cache Bundler RubyGems
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with: with:
path: ${{ steps.set-up-homebrew.outputs.gems-path }} path: ${{ steps.set-up-homebrew.outputs.gems-path }}
key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }} key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }}

View File

@ -40,7 +40,7 @@ jobs:
test-bot: false test-bot: false
- name: Cache Bundler RubyGems - name: Cache Bundler RubyGems
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with: with:
path: ${{ steps.set-up-homebrew.outputs.gems-path }} path: ${{ steps.set-up-homebrew.outputs.gems-path }}
key: ${{ runner.os }}-rubygems-syntax-${{ steps.set-up-homebrew.outputs.gems-hash }} key: ${{ runner.os }}-rubygems-syntax-${{ steps.set-up-homebrew.outputs.gems-hash }}
@ -53,7 +53,7 @@ jobs:
run: brew install shellcheck shfmt run: brew install shellcheck shfmt
- name: Cache style cache - name: Cache style cache
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with: with:
path: ~/.cache/Homebrew/style path: ~/.cache/Homebrew/style
key: syntax-style-cache-${{ github.sha }} key: syntax-style-cache-${{ github.sha }}
@ -92,7 +92,7 @@ jobs:
test-bot: true test-bot: true
- name: Cache Bundler RubyGems - name: Cache Bundler RubyGems
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with: with:
path: ${{ steps.set-up-homebrew.outputs.gems-path }} path: ${{ steps.set-up-homebrew.outputs.gems-path }}
key: ${{ runner.os }}-rubygems-tap-syntax-${{ steps.set-up-homebrew.outputs.gems-hash }} key: ${{ runner.os }}-rubygems-tap-syntax-${{ steps.set-up-homebrew.outputs.gems-hash }}
@ -102,7 +102,7 @@ jobs:
run: brew install-bundler-gems --groups=style run: brew install-bundler-gems --groups=style
- name: Cache style cache - name: Cache style cache
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with: with:
path: ~/.cache/Homebrew/style path: ~/.cache/Homebrew/style
key: tap-syntax-style-cache-${{ github.sha }} key: tap-syntax-style-cache-${{ github.sha }}
@ -277,7 +277,7 @@ jobs:
test-bot: false test-bot: false
- name: Cache Bundler RubyGems - name: Cache Bundler RubyGems
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with: with:
path: ${{ steps.set-up-homebrew.outputs.gems-path }} path: ${{ steps.set-up-homebrew.outputs.gems-path }}
key: ${{ matrix.runs-on }}-tests-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }} key: ${{ matrix.runs-on }}-tests-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }}
@ -292,7 +292,7 @@ jobs:
run: mkdir tests run: mkdir tests
- name: Cache parallel tests log - name: Cache parallel tests log
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with: with:
path: tests path: tests
key: ${{ runner.os }}-${{ matrix.test-flags }}-parallel_runtime_rspec-${{ github.sha }} key: ${{ runner.os }}-${{ matrix.test-flags }}-parallel_runtime_rspec-${{ github.sha }}
@ -416,7 +416,7 @@ jobs:
- name: Cache Homebrew Bundler RubyGems - name: Cache Homebrew Bundler RubyGems
id: cache id: cache
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with: with:
path: ${{ steps.set-up-homebrew.outputs.gems-path }} path: ${{ steps.set-up-homebrew.outputs.gems-path }}
key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }} key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }}

View File

@ -92,7 +92,7 @@ jobs:
fi fi
- name: Generate push token - name: Generate push token
uses: actions/create-github-app-token@21cfef2b496dd8ef5b904c159339626a10ad380e # v1.11.6 uses: actions/create-github-app-token@af35edadc00be37caa72ed9f3e6d5f7801bfdf09 # v1.11.7
id: app-token id: app-token
if: github.event_name == 'workflow_dispatch' if: github.event_name == 'workflow_dispatch'
with: with:

View File

@ -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.11952) sorbet (0.5.11953)
sorbet-static (= 0.5.11952) sorbet-static (= 0.5.11953)
sorbet-runtime (0.5.11952) sorbet-runtime (0.5.11953)
sorbet-static (0.5.11952-aarch64-linux) sorbet-static (0.5.11953-aarch64-linux)
sorbet-static (0.5.11952-universal-darwin) sorbet-static (0.5.11953-universal-darwin)
sorbet-static (0.5.11952-x86_64-linux) sorbet-static (0.5.11953-x86_64-linux)
sorbet-static-and-runtime (0.5.11952) sorbet-static-and-runtime (0.5.11953)
sorbet (= 0.5.11952) sorbet (= 0.5.11953)
sorbet-runtime (= 0.5.11952) sorbet-runtime (= 0.5.11953)
spoom (1.6.1) spoom (1.6.1)
erubi (>= 1.10.0) erubi (>= 1.10.0)
prism (>= 0.28.0) prism (>= 0.28.0)
@ -151,7 +151,7 @@ GEM
unicode-display_width (3.1.4) unicode-display_width (3.1.4)
unicode-emoji (~> 4.0, >= 4.0.4) unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4) unicode-emoji (4.0.4)
vernier (1.5.0) vernier (1.6.0)
warning (1.5.0) warning (1.5.0)
yard (0.9.37) yard (0.9.37)
yard-sorbet (0.9.0) yard-sorbet (0.9.0)

View File

@ -82,6 +82,34 @@ module Homebrew
return_value return_value
end end
def formula_versions_from_env
@formula_versions_from_env ||= begin
formula_versions = {}
ENV.each do |key, value|
match = key.match(/^HOMEBREW_BUNDLE_EXEC_FORMULA_VERSION_(.+)$/)
next if match.blank?
formula_name = match[1]
next if formula_name.blank?
ENV.delete(key)
formula_versions[formula_name.downcase] = value
end
formula_versions
end
end
sig { void }
def reset!
@mas_installed = nil
@vscode_installed = nil
@whalebrew_installed = nil
@cask_installed = nil
@formula_versions_from_env = nil
end
end end
end end
end end

View File

@ -27,6 +27,7 @@ module Homebrew
@start_service = options.fetch(:start_service, @restart_service) @start_service = options.fetch(:start_service, @restart_service)
@link = options.fetch(:link, nil) @link = options.fetch(:link, nil)
@postinstall = options.fetch(:postinstall, nil) @postinstall = options.fetch(:postinstall, nil)
@version_file = options.fetch(:version_file, nil)
@changed = nil @changed = nil
end end
@ -57,6 +58,19 @@ module Homebrew
postinstall_result = postinstall_change_state!(verbose:) postinstall_result = postinstall_change_state!(verbose:)
result &&= postinstall_result result &&= postinstall_result
if result && @version_file.present?
# Use the version from the environment if it hasn't changed.
version = if !changed? && (env_version = Bundle.formula_versions_from_env[@name])
env_version
else
Formula[@full_name].version.to_s
end
version_path = Pathname.new(@version_file)
version_path.write("#{version}\n")
puts "Wrote #{@name} version #{version} to #{@version_file}" if verbose
end
end end
result result

View File

@ -108,18 +108,7 @@ module Homebrew
end end
# Replace the formula versions from the environment variables # Replace the formula versions from the environment variables
formula_versions = {} Bundle.formula_versions_from_env.each do |formula_name, formula_version|
ENV.each do |key, value|
match = key.match(/^HOMEBREW_BUNDLE_EXEC_FORMULA_VERSION_(.+)$/)
next if match.blank?
formula_name = match[1]
next if formula_name.blank?
ENV.delete(key)
formula_versions[formula_name.downcase] = value
end
formula_versions.each do |formula_name, formula_version|
ENV.each do |key, value| ENV.each do |key, value|
opt = %r{/opt/#{formula_name}([/:$])} opt = %r{/opt/#{formula_name}([/:$])}
next unless value.match(opt) next unless value.match(opt)

View File

@ -217,18 +217,17 @@ module Homebrew
_subcommand, *named_args = args.named _subcommand, *named_args = args.named
named_args named_args
when "sh" when "sh"
preferred_shell = Utils::Shell.preferred_path(default: "/bin/bash") preferred_path = Utils::Shell.preferred_path(default: "/bin/bash")
subshell = case Utils::Shell.preferred notice = unless Homebrew::EnvConfig.no_env_hints?
when :zsh <<~EOS
"PS1='brew bundle %B%F{green}%~%f%b$ ' #{preferred_shell} -d -f" Your shell has been configured to use a build environment from your `Brewfile`.
when :bash This should help you build stuff.
"PS1=\"brew bundle \\[\\033[1;32m\\]\\w\\[\\033[0m\\]$ \" #{preferred_shell} --noprofile --norc" Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
else When done, type `exit`.
"PS1=\"brew bundle \\[\\033[1;32m\\]\\w\\[\\033[0m\\]$ \" #{preferred_shell}" EOS
end end
$stdout.flush
ENV["HOMEBREW_FORCE_API_AUTO_UPDATE"] = nil ENV["HOMEBREW_FORCE_API_AUTO_UPDATE"] = nil
[subshell] [Utils::Shell.shell_with_prompt("brew bundle", preferred_path:, notice:)]
when "env" when "env"
["env"] ["env"]
end end

View File

@ -55,14 +55,24 @@ module Homebrew
minor_version = version.minor.to_i || 0 minor_version = version.minor.to_i || 0
patch_version = version.patch.to_i || 0 patch_version = version.patch.to_i || 0
(0..minor_version).each do |minor| minor_version_range, patch_version_range = if Homebrew::EnvConfig.env_sync_strict?
(0..patch_version).each do |patch| # Only create symlinks for the exact installed patch version.
# e.g. 23.9.0 => 23.9.0
[[minor_version], [patch_version]]
else
# Create folder symlinks for all patch versions to the latest patch version
# e.g. 23.9.0 => 23.10.1
[0..minor_version, 0..patch_version]
end
minor_version_range.each do |minor|
patch_version_range.each do |patch|
link_path = nodenv_versions/"#{major_version}.#{minor}.#{patch}" link_path = nodenv_versions/"#{major_version}.#{minor}.#{patch}"
# Don't clobber existing user installations. # Don't clobber existing user installations.
next if link_path.exist? && !link_path.symlink? next if link_path.exist? && !link_path.symlink?
FileUtils.rm_f link_path FileUtils.rm_f link_path
FileUtils.ln_sf path, link_path FileUtils.ln_s path, link_path
end end
end end
end end

View File

@ -54,22 +54,29 @@ module Homebrew
minor_version = version.minor.to_i minor_version = version.minor.to_i
patch_version = version.patch.to_i patch_version = version.patch.to_i
(0..patch_version).each do |patch| patch_version_range = if Homebrew::EnvConfig.env_sync_strict?
# Only create symlinks for the exact installed patch version.
# e.g. 3.11.0 => 3.11.0
[patch_version]
else
# Create folder symlinks for all patch versions to the latest patch version # Create folder symlinks for all patch versions to the latest patch version
# (eg. 3.11.0 -> 3.11.3). # e.g. 3.11.0 => 3.11.3
0..patch_version
end
patch_version_range.each do |patch|
link_path = pyenv_versions/"#{major_version}.#{minor_version}.#{patch}" link_path = pyenv_versions/"#{major_version}.#{minor_version}.#{patch}"
# Don't clobber existing user installations. # Don't clobber existing user installations.
next if link_path.exist? && !link_path.symlink? next if link_path.exist? && !link_path.symlink?
FileUtils.rm_f link_path FileUtils.rm_f link_path
FileUtils.ln_sf path, link_path FileUtils.ln_s path, link_path
# Create an unversioned symlinks # Create an unversioned symlinks
# This is what pyenv expects to find in ~/.pyenv/versions/___/bin'. # This is what pyenv expects to find in ~/.pyenv/versions/___/bin'.
# Without this, `python3`, `pip3` do not exist and pyenv falls back to system Python. # Without this, `python3`, `pip3` do not exist and pyenv falls back to system Python.
# (eg. python3 -> python3.11, pip3 -> pip3.11) # (eg. python3 -> python3.11, pip3 -> pip3.11)
executables = %w[python3 pip3 wheel3 idle3 pydoc3] executables = %w[python3 pip3 wheel3 idle3 pydoc3]
executables.each do |executable| executables.each do |executable|
major_link_path = link_path/"bin/#{executable}" major_link_path = link_path/"bin/#{executable}"
@ -77,8 +84,14 @@ module Homebrew
# Don't clobber existing user installations. # Don't clobber existing user installations.
next if major_link_path.exist? && !major_link_path.symlink? next if major_link_path.exist? && !major_link_path.symlink?
executable_link_path = link_path/"bin/#{executable}.#{minor_version}"
FileUtils.rm_f major_link_path FileUtils.rm_f major_link_path
FileUtils.ln_s link_path/"bin/#{executable}.#{minor_version}", major_link_path
begin
FileUtils.ln_s executable_link_path, major_link_path
rescue => e
opoo "Failed to link #{executable_link_path} to #{major_link_path}: #{e}"
end
end end
end end
end end

View File

@ -55,13 +55,23 @@ module Homebrew
minor_version = version.minor.to_i minor_version = version.minor.to_i
patch_version = version.patch.to_i || 0 patch_version = version.patch.to_i || 0
(0..patch_version).each do |patch| patch_version_range = if Homebrew::EnvConfig.env_sync_strict?
# Only create symlinks for the exact installed patch version.
# e.g. 3.4.0 => 3.4.0
[patch_version]
else
# Create folder symlinks for all patch versions to the latest patch version
# e.g. 3.4.0 => 3.4.2
0..patch_version
end
patch_version_range.each do |patch|
link_path = rbenv_versions/"#{major_version}.#{minor_version}.#{patch}" link_path = rbenv_versions/"#{major_version}.#{minor_version}.#{patch}"
# Don't clobber existing user installations. # Don't clobber existing user installations.
next if link_path.exist? && !link_path.symlink? next if link_path.exist? && !link_path.symlink?
FileUtils.rm_f link_path FileUtils.rm_f link_path
FileUtils.ln_sf path, link_path FileUtils.ln_s path, link_path
end end
end end
end end

View File

@ -26,9 +26,11 @@ module Homebrew
switch "--upload", switch "--upload",
description: "Upload built bottles." description: "Upload built bottles."
switch "--linux", switch "--linux",
description: "Dispatch bottle for Linux (using GitHub runners)." description: "Dispatch bottle for Linux x86_64 (using GitHub runners)."
switch "--linux-arm64",
description: "Dispatch bottle for Linux arm64 (using GitHub runners)."
switch "--linux-self-hosted", switch "--linux-self-hosted",
description: "Dispatch bottle for Linux (using self-hosted runner)." description: "Dispatch bottle for Linux x86_64 (using self-hosted runner)."
switch "--linux-wheezy", switch "--linux-wheezy",
description: "Use Debian Wheezy container for building the bottle on Linux." description: "Use Debian Wheezy container for building the bottle on Linux."
@ -70,7 +72,11 @@ module Homebrew
runners << "linux-self-hosted-1" runners << "linux-self-hosted-1"
end end
raise UsageError, "Must specify `--macos`, `--linux` or `--linux-self-hosted` option." if runners.empty? runners << "ubuntu-22.04-arm" if args.linux_arm64?
if runners.empty?
raise UsageError, "Must specify `--macos`, `--linux`, `--linux-arm64`, or `--linux-self-hosted` option."
end
args.named.to_resolved_formulae.each do |formula| args.named.to_resolved_formulae.each do |formula|
# Required inputs # Required inputs

View File

@ -39,32 +39,25 @@ module Homebrew
ENV["VERBOSE"] = "1" if args.verbose? ENV["VERBOSE"] = "1" if args.verbose?
preferred_shell = Utils::Shell.preferred_path(default: "/bin/bash") preferred_path = Utils::Shell.preferred_path(default: "/bin/bash")
if args.cmd.present? if args.cmd.present?
safe_system(preferred_shell, "-c", args.cmd) safe_system(preferred_path, "-c", args.cmd)
elsif args.named.present? elsif args.named.present?
safe_system(preferred_shell, args.named.first) safe_system(preferred_path, args.named.first)
else else
shell_type = Utils::Shell.preferred notice = unless Homebrew::EnvConfig.no_env_hints?
subshell = case shell_type <<~EOS
when :zsh Your shell has been configured to use Homebrew's build environment;
"PS1='brew %B%F{green}%~%f%b$ ' #{preferred_shell} -d -f" this should help you build stuff. Notably though, the system versions of
when :bash gem and pip will ignore our configuration and insist on using the
"PS1=\"brew \\[\\033[1;32m\\]\\w\\[\\033[0m\\]$ \" #{preferred_shell} --noprofile --norc" environment they were built under (mostly). Sadly, scons will also
else ignore our configuration.
"PS1=\"brew \\[\\033[1;32m\\]\\w\\[\\033[0m\\]$ \" #{preferred_shell}" Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
When done, type `exit`.
EOS
end end
puts <<~EOS system Utils::Shell.shell_with_prompt("brew", preferred_path:, notice:)
Your shell has been configured to use Homebrew's build environment;
this should help you build stuff. Notably though, the system versions of
gem and pip will ignore our configuration and insist on using the
environment they were built under (mostly). Sadly, scons will also
ignore our configuration.
When done, type `exit`.
EOS
$stdout.flush
safe_system subshell
end end
end end
end end

View File

@ -195,6 +195,10 @@ module Homebrew
"editors will do strange things in this case.", "editors will do strange things in this case.",
default_text: "`$EDITOR` or `$VISUAL`.", default_text: "`$EDITOR` or `$VISUAL`.",
}, },
HOMEBREW_ENV_SYNC_STRICT: {
description: "If set, `brew *env-sync` will only sync the exact installed versions of formulae.",
boolean: true,
},
HOMEBREW_EVAL_ALL: { HOMEBREW_EVAL_ALL: {
description: "If set, `brew` commands evaluate all formulae and casks, executing their arbitrary code, by " \ description: "If set, `brew` commands evaluate all formulae and casks, executing their arbitrary code, by " \
"default without requiring `--eval-all`. Required to cache formula and cask descriptions.", "default without requiring `--eval-all`. Required to cache formula and cask descriptions.",

View File

@ -78,7 +78,7 @@ urllib3==2.3.0 \
# 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:
setuptools==77.0.3 \ setuptools==78.0.1 \
--hash=sha256:583b361c8da8de57403743e756609670de6fb2345920e36dc5c2d914c319c945 \ --hash=sha256:1cc9b32ee94f93224d6c80193cbb768004667aa2f2732a473d6949b0236c1d4e \
--hash=sha256:67122e78221da5cf550ddd04cf8742c8fe12094483749a792d56cd669d6cf58c --hash=sha256:4321d2dc2157b976dee03e1037c9f2bc5fea503c0c47d3c9458e0e8e49e659ce
# via influxdb3-python # via influxdb3-python

View File

@ -17,6 +17,9 @@ class Homebrew::DevCmd::DispatchBuildBottle::Args < Homebrew::CLI::Args
sig { returns(T::Boolean) } sig { returns(T::Boolean) }
def linux?; end def linux?; end
sig { returns(T::Boolean) }
def linux_arm64?; end
sig { returns(T::Boolean) } sig { returns(T::Boolean) }
def linux_self_hosted?; end def linux_self_hosted?; end

View File

@ -115,6 +115,9 @@ module Homebrew::EnvConfig
sig { returns(T.nilable(::String)) } sig { returns(T.nilable(::String)) }
def editor; end def editor; end
sig { returns(T::Boolean) }
def env_sync_strict?; end
sig { returns(T::Boolean) } sig { returns(T::Boolean) }
def eval_all?; end def eval_all?; end

View File

@ -180,52 +180,64 @@ end
# source://vernier//lib/vernier/output/filename_filter.rb#4 # source://vernier//lib/vernier/output/filename_filter.rb#4
module Vernier::Output; end module Vernier::Output; end
# source://vernier//lib/vernier/output/file_listing.rb#7 # source://vernier//lib/vernier/output/file_listing.rb#8
class Vernier::Output::FileListing class Vernier::Output::FileListing
# @return [FileListing] a new instance of FileListing # @return [FileListing] a new instance of FileListing
# #
# source://vernier//lib/vernier/output/file_listing.rb#22 # source://vernier//lib/vernier/output/file_listing.rb#23
def initialize(profile); end def initialize(profile); end
# source://vernier//lib/vernier/output/file_listing.rb#95 # source://vernier//lib/vernier/output/file_listing.rb#105
def format_file(output, filename, all_samples, total:); end def format_file(output, filename, all_samples, total:); end
# source://vernier//lib/vernier/output/file_listing.rb#26 # source://vernier//lib/vernier/output/file_listing.rb#134
def output; end def format_file_html(output, filename, relevant_files); end
# source://vernier//lib/vernier/output/file_listing.rb#122
def html_output(output, relevant_files); end
# source://vernier//lib/vernier/output/file_listing.rb#77
def output(template: T.unsafe(nil)); end
# source://vernier//lib/vernier/output/file_listing.rb#27
def samples_by_file; end
# source://vernier//lib/vernier/output/file_listing.rb#100
def total; end
end end
# source://vernier//lib/vernier/output/file_listing.rb#8 # source://vernier//lib/vernier/output/file_listing.rb#9
class Vernier::Output::FileListing::SamplesByLocation class Vernier::Output::FileListing::SamplesByLocation
# @return [SamplesByLocation] a new instance of SamplesByLocation # @return [SamplesByLocation] a new instance of SamplesByLocation
# #
# source://vernier//lib/vernier/output/file_listing.rb#10 # source://vernier//lib/vernier/output/file_listing.rb#11
def initialize; end def initialize; end
# source://vernier//lib/vernier/output/file_listing.rb#14 # source://vernier//lib/vernier/output/file_listing.rb#15
def +(other); end def +(other); end
# Returns the value of attribute self. # Returns the value of attribute self.
# #
# source://vernier//lib/vernier/output/file_listing.rb#9 # source://vernier//lib/vernier/output/file_listing.rb#10
def self; end def self; end
# Sets the attribute self # Sets the attribute self
# #
# @param value the value to set the attribute self to. # @param value the value to set the attribute self to.
# #
# source://vernier//lib/vernier/output/file_listing.rb#9 # source://vernier//lib/vernier/output/file_listing.rb#10
def self=(_arg0); end def self=(_arg0); end
# Returns the value of attribute total. # Returns the value of attribute total.
# #
# source://vernier//lib/vernier/output/file_listing.rb#9 # source://vernier//lib/vernier/output/file_listing.rb#10
def total; end def total; end
# Sets the attribute total # Sets the attribute total
# #
# @param value the value to set the attribute total to. # @param value the value to set the attribute total to.
# #
# source://vernier//lib/vernier/output/file_listing.rb#9 # source://vernier//lib/vernier/output/file_listing.rb#10
def total=(_arg0); end def total=(_arg0); end
end end
@ -380,7 +392,7 @@ class Vernier::Output::Firefox::Thread
# source://vernier//lib/vernier/output/firefox.rb#487 # source://vernier//lib/vernier/output/firefox.rb#487
def frame_table; end def frame_table; end
# source://vernier//lib/vernier/output/firefox.rb#511 # source://vernier//lib/vernier/output/firefox.rb#515
def func_table; end def func_table; end
# Returns the value of attribute is_start. # Returns the value of attribute is_start.
@ -402,15 +414,15 @@ class Vernier::Output::Firefox::Thread
# source://vernier//lib/vernier/output/firefox.rb#462 # source://vernier//lib/vernier/output/firefox.rb#462
def stack_table; end def stack_table; end
# source://vernier//lib/vernier/output/firefox.rb#536 # source://vernier//lib/vernier/output/firefox.rb#540
def string_table; end def string_table; end
private private
# source://vernier//lib/vernier/output/firefox.rb#558 # source://vernier//lib/vernier/output/firefox.rb#562
def gc_category; end def gc_category; end
# source://vernier//lib/vernier/output/firefox.rb#562 # source://vernier//lib/vernier/output/firefox.rb#566
def thread_category; end def thread_category; end
end end
@ -727,7 +739,7 @@ module Vernier::StackTableHelpers
# source://vernier//lib/vernier/stack_table_helpers.rb#3 # source://vernier//lib/vernier/stack_table_helpers.rb#3
def inspect; end def inspect; end
# source://vernier//lib/vernier/stack_table_helpers.rb#125 # source://vernier//lib/vernier/stack_table_helpers.rb#136
def stack(idx); end def stack(idx); end
# source://vernier//lib/vernier/stack_table_helpers.rb#7 # source://vernier//lib/vernier/stack_table_helpers.rb#7
@ -793,19 +805,27 @@ end
# source://vernier//lib/vernier/stack_table_helpers.rb#92 # source://vernier//lib/vernier/stack_table_helpers.rb#92
class Vernier::StackTableHelpers::Stack < ::Vernier::StackTableHelpers::BaseType class Vernier::StackTableHelpers::Stack < ::Vernier::StackTableHelpers::BaseType
# @raise [RangeError]
#
# source://vernier//lib/vernier/stack_table_helpers.rb#105
def [](n); end
# source://vernier//lib/vernier/stack_table_helpers.rb#93
def each; end
# source://vernier//lib/vernier/stack_table_helpers.rb#93 # source://vernier//lib/vernier/stack_table_helpers.rb#93
def each_frame; end def each_frame; end
# source://vernier//lib/vernier/stack_table_helpers.rb#112 # source://vernier//lib/vernier/stack_table_helpers.rb#123
def frames; end def frames; end
# source://vernier//lib/vernier/stack_table_helpers.rb#108 # source://vernier//lib/vernier/stack_table_helpers.rb#119
def leaf_frame; end def leaf_frame; end
# source://vernier//lib/vernier/stack_table_helpers.rb#104 # source://vernier//lib/vernier/stack_table_helpers.rb#115
def leaf_frame_idx; end def leaf_frame_idx; end
# source://vernier//lib/vernier/stack_table_helpers.rb#116 # source://vernier//lib/vernier/stack_table_helpers.rb#127
def to_s; end def to_s; end
end end

View File

@ -100,9 +100,10 @@ class AbstractTab
"full_name" => formula.full_name, "full_name" => formula.full_name,
"version" => formula.version.to_s, "version" => formula.version.to_s,
"revision" => formula.revision, "revision" => formula.revision,
"bottle_rebuild" => formula.bottle&.rebuild,
"pkg_version" => formula.pkg_version.to_s, "pkg_version" => formula.pkg_version.to_s,
"declared_directly" => declared_deps.include?(formula.full_name), "declared_directly" => declared_deps.include?(formula.full_name),
} }.compact
end end
private_class_method :formula_to_dep_hash private_class_method :formula_to_dep_hash

View File

@ -6,6 +6,7 @@ require "bundle/brew_checker"
require "bundle/mac_app_store_checker" require "bundle/mac_app_store_checker"
require "bundle/vscode_extension_checker" require "bundle/vscode_extension_checker"
require "bundle/brew_installer" require "bundle/brew_installer"
require "bundle/cask_installer"
require "bundle/mac_app_store_installer" require "bundle/mac_app_store_installer"
RSpec.describe Homebrew::Bundle::Commands::Check do RSpec.describe Homebrew::Bundle::Commands::Check do

View File

@ -29,6 +29,7 @@ RSpec.describe Homebrew::Bundle::Commands::Exec do
context "with valid command setup" do context "with valid command setup" do
before do before do
allow(described_class).to receive(:exec).and_return(nil) allow(described_class).to receive(:exec).and_return(nil)
Homebrew::Bundle.reset!
end end
it "does not raise an error" do it "does not raise an error" do

View File

@ -2,6 +2,7 @@
require "bundle" require "bundle"
require "bundle/whalebrew_installer" require "bundle/whalebrew_installer"
require "bundle/whalebrew_dumper"
RSpec.describe Homebrew::Bundle::WhalebrewInstaller do RSpec.describe Homebrew::Bundle::WhalebrewInstaller do
before do before do

View File

@ -105,4 +105,26 @@ RSpec.describe Utils::Shell do
.to eq("fish_add_path #{path}") .to eq("fish_add_path #{path}")
end end
end end
describe "::shell_with_prompt" do
it "returns zsh-specific prompt configuration" do
ENV["SHELL"] = "/bin/zsh"
expect(described_class.shell_with_prompt("test", preferred_path: "/bin/zsh", notice: "")).to eq(
"PROMPT='%B%F{green}test%f %F{blue}$%f%b ' RPROMPT='[%B%F{red}%~%f%b]' /bin/zsh -f",
)
end
it "returns generic shell prompt configuration" do
ENV["SHELL"] = "/bin/bash"
expect(described_class.shell_with_prompt("test", preferred_path: "/bin/bash", notice: "")).to eq(
"PS1=\"\\[\\033[1;32m\\]brew \\[\\033[1;31m\\]\\w \\[\\033[1;34m\\]$\\[\\033[0m\\] \" /bin/bash",
)
end
it "outputs notice when provided" do
notice = "Test Notice"
expect { described_class.shell_with_prompt("test", preferred_path: "/bin/bash", notice: notice) }
.to output("#{notice}\n").to_stdout
end
end
end end

View File

@ -51,13 +51,18 @@ module Utils
yield pipe yield pipe
else else
options[:err] ||= File::NULL unless ENV["HOMEBREW_STDERR"] options[:err] ||= File::NULL unless ENV["HOMEBREW_STDERR"]
cmd = if args[0].is_a? Hash
args[1]
else
args[0]
end
begin begin
exec(*args, options) exec(*args, options)
rescue Errno::ENOENT rescue Errno::ENOENT
$stderr.puts "brew: command not found: #{args[0]}" if options[:err] != :close $stderr.puts "brew: command not found: #{cmd}" if options[:err] != :close
exit! 127 exit! 127
rescue SystemCallError rescue SystemCallError
$stderr.puts "brew: exec failed: #{args[0]}" if options[:err] != :close $stderr.puts "brew: exec failed: #{cmd}" if options[:err] != :close
exit! 1 exit! 1
end end
end end

View File

@ -152,5 +152,21 @@ module Utils
str.gsub!("\n", "'\n'") str.gsub!("\n", "'\n'")
str str
end end
sig { params(type: String, preferred_path: String, notice: T.nilable(String)).returns(String) }
def shell_with_prompt(type, preferred_path:, notice:)
preferred = from_path(preferred_path)
subshell = case preferred
when :zsh
"PROMPT='%B%F{green}#{type}%f %F{blue}$%f%b ' RPROMPT='[%B%F{red}%~%f%b]' #{preferred_path} -f"
else
"PS1=\"\\[\\033[1;32m\\]brew \\[\\033[1;31m\\]\\w \\[\\033[1;34m\\]$\\[\\033[0m\\] \" #{preferred_path}"
end
puts notice if notice.present?
$stdout.flush
subshell
end
end end
end end

View File

@ -77,7 +77,7 @@ $:.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.0") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/rbs-3.9.0")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rbs-3.9.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rbs-3.9.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-runtime-0.5.11952/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-runtime-0.5.11953/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.1/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")
@ -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.11952-universal-darwin/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-static-0.5.11953-universal-darwin/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-0.5.11952/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-0.5.11953/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-static-and-runtime-0.5.11952/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-static-and-runtime-0.5.11953/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")
@ -117,6 +117,6 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/yard-0.9.37/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/yard-0.9.37/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/yard-sorbet-0.9.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/yard-sorbet-0.9.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/tapioca-0.16.11/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/tapioca-0.16.11/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/vernier-1.5.0") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/vernier-1.6.0")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/vernier-1.5.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/vernier-1.6.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/warning-1.5.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/warning-1.5.0/lib")

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