Merge branch 'master' into cabal

This commit is contained in:
Bevan Kay 2025-05-29 22:44:20 +10:00 committed by GitHub
commit 6278ac1801
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
153 changed files with 1010 additions and 372 deletions

View File

@ -5,68 +5,86 @@ updates:
directory: / directory: /
schedule: schedule:
interval: weekly interval: weekly
day: "friday"
time: "08:00"
timezone: "Etc/UTC"
allow: allow:
- dependency-type: all - dependency-type: all
# The actions in triage-issues.yml are updated in the Homebrew/.github repo
ignore:
- dependency-name: actions/stale
groups: groups:
artifacts: github-actions:
patterns: patterns:
- actions/*-artifact - "*"
open-pull-requests-limit: 10
- package-ecosystem: bundler - package-ecosystem: bundler
directory: /Library/Homebrew directories:
- /
- /Library/Homebrew
schedule: schedule:
interval: daily interval: weekly
day: "friday"
time: "08:00"
timezone: "Etc/UTC"
allow: allow:
- dependency-type: all - dependency-type: all
groups: groups:
rspec: bundler:
patterns: patterns:
- "rspec*" - "*"
sorbet:
patterns:
- "sorbet*"
open-pull-requests-limit: 10
- package-ecosystem: npm - package-ecosystem: npm
directory: / directory: /
schedule: schedule:
interval: daily interval: weekly
day: "friday"
time: "08:00"
timezone: "Etc/UTC"
allow: allow:
- dependency-type: all - dependency-type: all
open-pull-requests-limit: 10 groups:
npm:
patterns:
- "*"
- package-ecosystem: docker - package-ecosystem: docker
directory: / directory: /
schedule: schedule:
interval: daily interval: weekly
day: "friday"
time: "08:00"
timezone: "Etc/UTC"
allow: allow:
- dependency-type: all - dependency-type: all
open-pull-requests-limit: 10 groups:
docker:
patterns:
- "*"
- package-ecosystem: devcontainers - package-ecosystem: devcontainers
directory: / directory: /
schedule: schedule:
interval: daily interval: weekly
day: "friday"
time: "08:00"
timezone: "Etc/UTC"
allow: allow:
- dependency-type: all - dependency-type: all
open-pull-requests-limit: 10 groups:
devcontainers:
patterns:
- "*"
- package-ecosystem: pip - package-ecosystem: pip
directory: / directories:
- /
- /Library/Homebrew/formula-analytics/
schedule: schedule:
interval: daily interval: weekly
day: "friday"
time: "08:00"
timezone: "Etc/UTC"
allow: allow:
- dependency-type: all - dependency-type: all
open-pull-requests-limit: 10 groups:
pip:
- package-ecosystem: pip patterns:
directory: /Library/Homebrew/formula-analytics/ - "*"
schedule:
interval: daily
allow:
- dependency-type: all
open-pull-requests-limit: 10

View File

@ -52,7 +52,7 @@ jobs:
run: vale docs/ run: vale docs/
- name: Install Ruby - name: Install Ruby
uses: ruby/setup-ruby@1a0ff446f5856bdfec298b61a09727c860d9d480 # v1.240.0 uses: ruby/setup-ruby@13e7a03dc3ac6c3798f4570bfead2aed4d96abfb # v1.244.0
with: with:
bundler-cache: true bundler-cache: true
working-directory: docs working-directory: docs

View File

@ -230,17 +230,15 @@ jobs:
--password "${PKG_APPLE_ID_APP_SPECIFIC_PASSWORD}" --password "${PKG_APPLE_ID_APP_SPECIFIC_PASSWORD}"
--wait --wait
- name: Install gh
run: brew install gh
- name: Upload installer to GitHub release - name: Upload installer to GitHub release
if: github.event_name == 'release' if: github.event_name == 'release'
env: env:
GH_TOKEN: ${{ github.token }} GH_TOKEN: ${{ github.token }}
INSTALLER_PATH: ${{ needs.build.outputs.installer_path }} INSTALLER_PATH: ${{ needs.build.outputs.installer_path }}
run: gh release upload --repo Homebrew/brew run: |
"${GITHUB_REF//refs\/tags\//}" VERSION="${INSTALLER_PATH#Homebrew-}"
"${INSTALLER_PATH}" VERSION="${VERSION%.pkg}"
gh release upload --repo Homebrew/brew "${VERSION}" "${INSTALLER_PATH}"
issue: issue:
needs: [build, test, upload] needs: [build, test, upload]

View File

@ -42,7 +42,7 @@ jobs:
persist-credentials: false persist-credentials: false
- name: Install Ruby - name: Install Ruby
uses: ruby/setup-ruby@1a0ff446f5856bdfec298b61a09727c860d9d480 # v1.240.0 uses: ruby/setup-ruby@13e7a03dc3ac6c3798f4570bfead2aed4d96abfb # v1.244.0
with: with:
bundler-cache: true bundler-cache: true
working-directory: rubydoc working-directory: rubydoc

View File

@ -335,7 +335,7 @@ jobs:
filenames=$(find Library/Homebrew/test/junit -name 'rspec*.xml' -print | tr '\n' ',') filenames=$(find Library/Homebrew/test/junit -name 'rspec*.xml' -print | tr '\n' ',')
echo "filenames=${filenames%,}" >> "$GITHUB_OUTPUT" echo "filenames=${filenames%,}" >> "$GITHUB_OUTPUT"
- uses: codecov/test-results-action@f2dba722c67b86c6caa034178c6e4d35335f6706 # v1.1.0 - uses: codecov/test-results-action@47f89e9acb64b76debcd5ea40642d25a4adced9f # v1.1.1
with: with:
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }} working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
files: ${{ steps.junit_xml.outputs.filenames }} files: ${{ steps.junit_xml.outputs.filenames }}

2
.gitignore vendored
View File

@ -164,6 +164,7 @@
!/completions !/completions
!/docs !/docs
!/manpages !/manpages
!/CODEOWNERS
# Unignore our packaging files # Unignore our packaging files
!/package !/package
@ -172,6 +173,7 @@
# Ignore generated documentation site # Ignore generated documentation site
/docs/_site /docs/_site
/docs/.jekyll-metadata /docs/.jekyll-metadata
/docs/tmp/.htmlproofer
/docs/vendor /docs/vendor
/docs/Gemfile.lock /docs/Gemfile.lock

11
CODEOWNERS Normal file
View File

@ -0,0 +1,11 @@
# Note that the naming of this file is incorrect for our case: these people do not "own" the provided files but are
# people with write-access to this repository who wish to approve changes to these files.
#
# Their review is required to merge PRs that change these files.
#
# To be explicit: we will never accept changes to this file adding people from outside the Homebrew GitHub
# organisation. If you are not a Homebrew maintainer: you do not personally "own" or "maintain" any files.
#
# Note: @Homebrew/plc does not have write-access to this repository, and therefore cannot be listed in this file.
docs/Support-Tiers.md @Homebrew/tsc @MikeMcQuaid

View File

@ -26,7 +26,7 @@ AllCops:
Include: Include:
- "**/*.rbi" - "**/*.rbi"
Exclude: Exclude:
- "Homebrew/sorbet/rbi/{dsl,gems}/**/*.rbi" - "Homebrew/sorbet/rbi/{annotations,dsl,gems}/**/*.rbi"
- "Homebrew/sorbet/rbi/parser*.rbi" - "Homebrew/sorbet/rbi/parser*.rbi"
- "Homebrew/bin/*" - "Homebrew/bin/*"
- "Homebrew/vendor/**/*" - "Homebrew/vendor/**/*"

View File

@ -104,7 +104,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.20) ruby-lsp (0.23.21)
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)
@ -122,15 +122,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.12109) sorbet (0.5.12117)
sorbet-static (= 0.5.12109) sorbet-static (= 0.5.12117)
sorbet-runtime (0.5.12109) sorbet-runtime (0.5.12117)
sorbet-static (0.5.12109-aarch64-linux) sorbet-static (0.5.12117-aarch64-linux)
sorbet-static (0.5.12109-universal-darwin) sorbet-static (0.5.12117-universal-darwin)
sorbet-static (0.5.12109-x86_64-linux) sorbet-static (0.5.12117-x86_64-linux)
sorbet-static-and-runtime (0.5.12109) sorbet-static-and-runtime (0.5.12117)
sorbet (= 0.5.12109) sorbet (= 0.5.12117)
sorbet-runtime (= 0.5.12109) sorbet-runtime (= 0.5.12117)
spoom (1.6.3) spoom (1.6.3)
erubi (>= 1.10.0) erubi (>= 1.10.0)
prism (>= 0.28.0) prism (>= 0.28.0)

View File

@ -5,4 +5,7 @@
NO_AUTOBUMP_REASONS_LIST = T.let({ NO_AUTOBUMP_REASONS_LIST = T.let({
incompatible_version_format: "incompatible version format", incompatible_version_format: "incompatible version format",
bumped_by_upstream: "bumped by upstream", bumped_by_upstream: "bumped by upstream",
extract_plist: "livecheck uses `:extract_plist` strategy",
latest_version: "`version` is set to `:latest`",
requires_manual_review: "a manual review of this package is required for inclusion in autobump",
}.freeze, T::Hash[Symbol, String]) }.freeze, T::Hash[Symbol, String])

View File

@ -25,13 +25,14 @@ module Homebrew
Homebrew::Bundle::BrewServices.reset! Homebrew::Bundle::BrewServices.reset!
end end
def self.run(global: false, file: nil, force: false, zap: false, dsl: nil) def self.run(global: false, file: nil, force: false, zap: false, dsl: nil,
brews: true, casks: true, taps: true, vscode: true)
@dsl ||= dsl @dsl ||= dsl
casks = casks_to_uninstall(global:, file:) casks = casks ? casks_to_uninstall(global:, file:) : []
formulae = formulae_to_uninstall(global:, file:) formulae = brews ? formulae_to_uninstall(global:, file:) : []
taps = taps_to_untap(global:, file:) taps = taps ? taps_to_untap(global:, file:) : []
vscode_extensions = vscode_extensions_to_uninstall(global:, file:) vscode_extensions = vscode ? vscode_extensions_to_uninstall(global:, file:) : []
if force if force
if casks.any? if casks.any?
args = zap ? ["--zap"] : [] args = zap ? ["--zap"] : []

View File

@ -178,7 +178,9 @@ module Homebrew
exit_code = 0 exit_code = 0
run_services(@dsl.entries) do run_services(@dsl.entries) do
Kernel.system(*args) Kernel.system(*args)
exit_code = $CHILD_STATUS.exitstatus if (system_exit_code = $CHILD_STATUS&.exitstatus)
exit_code = system_exit_code
end
end end
exit!(exit_code) exit!(exit_code)
else else

View File

@ -606,7 +606,10 @@ module Cask
def audit_rosetta def audit_rosetta
return if (url = cask.url).nil? return if (url = cask.url).nil?
return unless online? return unless online?
# Rosetta 2 is only for ARM-capable macOS versions, which are Big Sur (11.x) and later
return if Homebrew::SimulateSystem.current_arch != :arm return if Homebrew::SimulateSystem.current_arch != :arm
return if MacOSVersion::SYMBOLS.fetch(Homebrew::SimulateSystem.current_os, "10") < "11"
return if cask.depends_on.macos&.maximum_version.to_s < "11"
odebug "Auditing Rosetta 2 requirement" odebug "Auditing Rosetta 2 requirement"
@ -640,7 +643,7 @@ module Cask
# binary stanza can contain shell scripts, so we just continue if lipo fails. # binary stanza can contain shell scripts, so we just continue if lipo fails.
next unless result.success? next unless result.success?
odebug result.merged_output odebug "Architectures: #{result.merged_output}"
unless /arm64|x86_64/.match?(result.merged_output) unless /arm64|x86_64/.match?(result.merged_output)
add_error "Artifacts architecture is no longer supported by macOS!", add_error "Artifacts architecture is no longer supported by macOS!",
@ -652,7 +655,7 @@ module Cask
mentions_rosetta = cask.caveats.include?("requires Rosetta 2") mentions_rosetta = cask.caveats.include?("requires Rosetta 2")
if supports_arm && mentions_rosetta if supports_arm && mentions_rosetta
add_error "Artifacts does not require Rosetta 2 but the caveats say otherwise!", add_error "Artifacts do not require Rosetta 2 but the caveats say otherwise!",
location: url.location location: url.location
elsif !supports_arm && !mentions_rosetta elsif !supports_arm && !mentions_rosetta
add_error "Artifacts require Rosetta 2 but this is not indicated by the caveats!", add_error "Artifacts require Rosetta 2 but this is not indicated by the caveats!",

View File

@ -351,6 +351,8 @@ module Cask
raise CaskInvalidError.new(cask, "invalid 'version' value: #{arg.inspect}") raise CaskInvalidError.new(cask, "invalid 'version' value: #{arg.inspect}")
end end
no_autobump! because: :latest_version if arg == :latest
DSL::Version.new(arg) DSL::Version.new(arg)
end end
end end
@ -536,6 +538,8 @@ module Cask
@livecheck_defined = true @livecheck_defined = true
@livecheck.instance_eval(&block) @livecheck.instance_eval(&block)
no_autobump! because: :extract_plist if @livecheck.strategy == :extract_plist
@livecheck
end end
# Whether the cask contains a `livecheck` block. This is a legacy alias # Whether the cask contains a `livecheck` block. This is a legacy alias

View File

@ -102,17 +102,17 @@ module Homebrew
switch "--all", switch "--all",
description: "`list` all dependencies." description: "`list` all dependencies."
switch "--formula", "--brews", switch "--formula", "--brews",
description: "`list` or `dump` Homebrew formula dependencies." description: "`list`, `dump` or `cleanup` Homebrew formula dependencies."
switch "--cask", "--casks", switch "--cask", "--casks",
description: "`list` or `dump` Homebrew cask dependencies." description: "`list`, `dump` or `cleanup` Homebrew cask dependencies."
switch "--tap", "--taps", switch "--tap", "--taps",
description: "`list` or `dump` Homebrew tap dependencies." description: "`list`, `dump` or `cleanup` Homebrew tap dependencies."
switch "--mas", switch "--mas",
description: "`list` or `dump` Mac App Store dependencies." description: "`list` or `dump` Mac App Store dependencies."
switch "--whalebrew", switch "--whalebrew",
description: "`list` or `dump` Whalebrew dependencies." description: "`list` or `dump` Whalebrew dependencies."
switch "--vscode", switch "--vscode",
description: "`list` or `dump` VSCode (and forks/variants) extensions." description: "`list`, `dump` or `cleanup` VSCode (and forks/variants) extensions."
switch "--no-vscode", switch "--no-vscode",
env: :bundle_dump_no_vscode, env: :bundle_dump_no_vscode,
description: "`dump` without VSCode (and forks/variants) extensions. " \ description: "`dump` without VSCode (and forks/variants) extensions. " \
@ -226,7 +226,13 @@ module Homebrew
exec_editor(Homebrew::Bundle::Brewfile.path(global:, file:)) exec_editor(Homebrew::Bundle::Brewfile.path(global:, file:))
when "cleanup" when "cleanup"
require "bundle/commands/cleanup" require "bundle/commands/cleanup"
Homebrew::Bundle::Commands::Cleanup.run(global:, file:, force:, zap:) Homebrew::Bundle::Commands::Cleanup.run(
global:, file:, force:, zap:,
brews: args.brews? || no_type_args,
casks: args.casks? || no_type_args,
taps: args.taps? || no_type_args,
vscode: args.vscode? || no_type_args
)
when "check" when "check"
require "bundle/commands/check" require "bundle/commands/check"
Homebrew::Bundle::Commands::Check.run(global:, file:, no_upgrade:, verbose:) Homebrew::Bundle::Commands::Check.run(global:, file:, no_upgrade:, verbose:)

View File

@ -49,7 +49,6 @@ module Homebrew
description: "Use the specified GitHub organization for forking." description: "Use the specified GitHub organization for forking."
conflicts "--dry-run", "--write" conflicts "--dry-run", "--write"
conflicts "--no-audit", "--online"
conflicts "--version=", "--version-arm=" conflicts "--version=", "--version-arm="
conflicts "--version=", "--version-intel=" conflicts "--version=", "--version-intel="
@ -85,7 +84,9 @@ module Homebrew
method or 'livecheck' block with 'skip'.) method or 'livecheck' block with 'skip'.)
EOS EOS
odie "You have too many PRs open: close or merge some first!" if GitHub.too_many_open_prs?(cask.tap) if !args.write_only? && GitHub.too_many_open_prs?(cask.tap)
odie "You have too many PRs open: close or merge some first!"
end
new_version = BumpVersionParser.new( new_version = BumpVersionParser.new(
general: args.version, general: args.version,
@ -113,7 +114,7 @@ module Homebrew
raise UsageError, "No `--version`, `--url` or `--sha256` argument specified!" raise UsageError, "No `--version`, `--url` or `--sha256` argument specified!"
end end
check_pull_requests(cask, new_version:) check_pull_requests(cask, new_version:) unless args.write_only?
replacement_pairs ||= [] replacement_pairs ||= []
branch_name = "bump-#{cask.token}" branch_name = "bump-#{cask.token}"
@ -136,7 +137,7 @@ module Homebrew
end end
if new_version.present? if new_version.present?
# For simplicity, our naming defers to the arm version if we multiple architectures are specified # For simplicity, our naming defers to the arm version if multiple architectures are specified
branch_version = new_version.arm || new_version.general branch_version = new_version.arm || new_version.general
if branch_version.is_a?(Cask::DSL::Version) if branch_version.is_a?(Cask::DSL::Version)
commit_version = shortened_version(branch_version, cask:) commit_version = shortened_version(branch_version, cask:)
@ -171,7 +172,7 @@ module Homebrew
pr_title: commit_message, pr_title: commit_message,
} }
GitHub.create_bump_pr(pr_info, args:) GitHub.create_bump_pr(pr_info, args:) unless args.write_only?
end end
private private

View File

@ -121,7 +121,9 @@ module Homebrew
method or 'livecheck' block with 'skip'.) method or 'livecheck' block with 'skip'.)
EOS EOS
odie "You have too many PRs open: close or merge some first!" if GitHub.too_many_open_prs?(tap) if !args.write_only? && GitHub.too_many_open_prs?(tap)
odie "You have too many PRs open: close or merge some first!"
end
formula_spec = formula.stable formula_spec = formula.stable
odie "#{formula}: no stable specification found!" if formula_spec.blank? odie "#{formula}: no stable specification found!" if formula_spec.blank?
@ -135,7 +137,7 @@ module Homebrew
remote_branch = tap.git_repository.origin_branch_name remote_branch = tap.git_repository.origin_branch_name
previous_branch = "-" previous_branch = "-"
check_pull_requests(formula, tap_remote_repo, state: "open") check_pull_requests(formula, tap_remote_repo, state: "open") unless args.write_only?
all_formulae = [] all_formulae = []
if args.bump_synced.present? if args.bump_synced.present?
@ -159,6 +161,7 @@ module Homebrew
new_url = args.url new_url = args.url
new_version = args.version new_version = args.version
check_new_version(commit_formula, tap_remote_repo, version: new_version) if new_version.present? check_new_version(commit_formula, tap_remote_repo, version: new_version) if new_version.present?
opoo "This formula has patches that may be resolved upstream." if commit_formula.patchlist.present? opoo "This formula has patches that may be resolved upstream." if commit_formula.patchlist.present?
@ -174,6 +177,7 @@ module Homebrew
end end
old_hash = commit_formula_spec.checksum&.hexdigest old_hash = commit_formula_spec.checksum&.hexdigest
new_hash = args.sha256 new_hash = args.sha256
new_tag = args.tag new_tag = args.tag
new_revision = args.revision new_revision = args.revision
@ -213,10 +217,9 @@ module Homebrew
elsif new_url.blank? && new_version.blank? elsif new_url.blank? && new_version.blank?
raise UsageError, "#{commit_formula}: no `--url` or `--version` argument specified!" raise UsageError, "#{commit_formula}: no `--url` or `--version` argument specified!"
else else
next unless new_version.present? new_url ||= PyPI.update_pypi_url(old_url, new_version) if new_version.present?
new_url ||= PyPI.update_pypi_url(old_url, new_version) if new_url.blank? && new_version.present?
if new_url.blank?
new_url = update_url(old_url, old_version, new_version) new_url = update_url(old_url, old_version, new_version)
if new_mirrors.blank? && old_mirrors.present? if new_mirrors.blank? && old_mirrors.present?
new_mirrors = old_mirrors.map do |old_mirror| new_mirrors = old_mirrors.map do |old_mirror|
@ -231,6 +234,9 @@ module Homebrew
#{new_url} #{new_url}
EOS EOS
end end
if new_url.blank?
odie "There was an issue generating the updated url, you may need to create the PR manually"
end
check_new_version(commit_formula, tap_remote_repo, url: new_url) if new_version.blank? check_new_version(commit_formula, tap_remote_repo, url: new_url) if new_version.blank?
resource_path, forced_version = fetch_resource_and_forced_version(commit_formula, new_version, new_url) resource_path, forced_version = fetch_resource_and_forced_version(commit_formula, new_version, new_url)
Utils::Tar.validate_file(resource_path) Utils::Tar.validate_file(resource_path)
@ -395,10 +401,14 @@ module Homebrew
if github_release_data.present? if github_release_data.present?
pre = "pre" if github_release_data["prerelease"].present? pre = "pre" if github_release_data["prerelease"].present?
# maximum length of PR body is 65,536 characters so let's truncate release notes to half of that.
body = Formatter.truncate(github_release_data["body"], max: 32_768)
formula_pr_message += <<~XML formula_pr_message += <<~XML
<details> <details>
<summary>#{pre}release notes</summary> <summary>#{pre}release notes</summary>
<pre>#{github_release_data["body"]}</pre> <pre>#{body}</pre>
<p>View the full release notes at #{github_release_data["html_url"]}.</p>
</details> </details>
XML XML
end end
@ -407,7 +417,7 @@ module Homebrew
{ {
sourcefile_path: commit_formula.path, sourcefile_path: commit_formula.path,
old_contents:, old_contents:,
commit_message: "#{commit_formula.name} #{args.version}", commit_message: "#{commit_formula.name} #{new_formula_version}",
additional_files: alias_rename, additional_files: alias_rename,
formula_pr_message:, formula_pr_message:,
formula_name: commit_formula.name, formula_name: commit_formula.name,
@ -426,7 +436,7 @@ module Homebrew
# If `brew audit` fails, revert the changes made to any formula. # If `brew audit` fails, revert the changes made to any formula.
commits.each do |revert| commits.each do |revert|
revert_formula = Formula[revert[:formula_name]] revert_formula = Formula[revert[:formula_name]]
revert_formula.path.atomic_write(revert[:old_contents]) unless args.dry_run? revert_formula.path.atomic_write(revert[:old_contents]) if !args.dry_run? && !args.write_only?
revert_alias_rename = revert[:additional_files] revert_alias_rename = revert[:additional_files]
if revert_alias_rename && (source = revert_alias_rename.first) && (destination = revert_alias_rename.last) if revert_alias_rename && (source = revert_alias_rename.first) && (destination = revert_alias_rename.last)
FileUtils.mv source, destination FileUtils.mv source, destination
@ -437,6 +447,7 @@ module Homebrew
end end
new_formula_version = T.must(commits.first)[:new_version] new_formula_version = T.must(commits.first)[:new_version]
pr_title = if args.bump_synced.nil? pr_title = if args.bump_synced.nil?
"#{formula.name} #{new_formula_version}" "#{formula.name} #{new_formula_version}"
else else
@ -462,7 +473,7 @@ module Homebrew
tap_remote_repo:, tap_remote_repo:,
pr_message:, pr_message:,
} }
GitHub.create_bump_pr(pr_info, args:) GitHub.create_bump_pr(pr_info, args:) unless args.write_only?
end end
private private

View File

@ -126,7 +126,7 @@ module Homebrew
echo "::add-mask::${base64_token}" echo "::add-mask::${base64_token}"
echo "token=${base64_token}" >> "${GITHUB_OUTPUT}" echo "token=${base64_token}" >> "${GITHUB_OUTPUT}"
<% end -%> <% end -%>
- run: brew test-bot --only-formulae<% if root_url %> --root-url='<%= root_url %>'<% end %> - run: brew test-bot --only-formulae#{" --root-url=#{root_url}" if root_url}
if: github.event_name == 'pull_request' if: github.event_name == 'pull_request'
<% if args.github_packages? -%> <% if args.github_packages? -%>
env: env:

View File

@ -60,6 +60,7 @@ module Homebrew
HOMEBREW_LIBRARY_PATH.cd do HOMEBREW_LIBRARY_PATH.cd do
if update if update
workers = args.debug? ? ["--workers=1"] : [] workers = args.debug? ? ["--workers=1"] : []
safe_system "bundle", "exec", "tapioca", "annotations"
safe_system "bundle", "exec", "tapioca", "dsl", *workers safe_system "bundle", "exec", "tapioca", "dsl", *workers
# Prefer adding args here: Library/Homebrew/sorbet/tapioca/config.yml # Prefer adding args here: Library/Homebrew/sorbet/tapioca/config.yml
tapioca_args = args.update_all? ? ["--all"] : [] tapioca_args = args.update_all? ? ["--all"] : []

View File

@ -21,12 +21,22 @@ module Homebrew
sig { override.void } sig { override.void }
def run def run
# Needed for Manpages.regenerate_man_pages below
Homebrew.install_bundler_gems!(groups: ["man"])
# We assume that only public members wish to be included in the README # We assume that only public members wish to be included in the README
public_members = GitHub.public_member_usernames("Homebrew") public_members = GitHub.public_member_usernames("Homebrew")
maintainers = GitHub.members_by_team("Homebrew", "maintainers") maintainers = GitHub.members_by_team("Homebrew", "maintainers")
# Not all PLC members are Homebrew GitHub organisation members any more
non_maintainer_plc_members = {
colindean: "Colin Dean",
mozzadrella: "Vanessa Gennarelli",
}.transform_keys(&:to_s)
public_members += non_maintainer_plc_members.keys
members = { members = {
plc: GitHub.members_by_team("Homebrew", "plc"), plc: GitHub.members_by_team("Homebrew", "plc").merge(non_maintainer_plc_members),
tsc: GitHub.members_by_team("Homebrew", "tsc"), tsc: GitHub.members_by_team("Homebrew", "tsc"),
maintainers:, maintainers:,
} }

View File

@ -703,7 +703,12 @@ class CurlGitHubPackagesDownloadStrategy < CurlDownloadStrategy
meta[:headers] ||= [] meta[:headers] ||= []
# GitHub Packages authorization header. # GitHub Packages authorization header.
# HOMEBREW_GITHUB_PACKAGES_AUTH set in brew.sh # HOMEBREW_GITHUB_PACKAGES_AUTH set in brew.sh
meta[:headers] << "Authorization: #{HOMEBREW_GITHUB_PACKAGES_AUTH}" # If using a private GHCR mirror with no Authentication set then do not add the header. In all other cases add it.
if !Homebrew::EnvConfig.artifact_domain.presence ||
Homebrew::EnvConfig.docker_registry_basic_auth_token.presence ||
Homebrew::EnvConfig.docker_registry_token.presence
meta[:headers] << "Authorization: #{HOMEBREW_GITHUB_PACKAGES_AUTH}"
end
super super
end end

View File

@ -8,9 +8,9 @@ certifi==2025.4.26 \
--hash=sha256:0a816057ea3cdefcef70270d2c515e4506bbc954f417fa5ade2021213bb8f0c6 \ --hash=sha256:0a816057ea3cdefcef70270d2c515e4506bbc954f417fa5ade2021213bb8f0c6 \
--hash=sha256:30350364dfe371162649852c63336a15c70c6510c2ad5015b21c2345311805f3 --hash=sha256:30350364dfe371162649852c63336a15c70c6510c2ad5015b21c2345311805f3
# via influxdb3-python # via influxdb3-python
influxdb3-python==0.12.0 \ influxdb3-python==0.13.0 \
--hash=sha256:991f756528280b376db162e26ad80096168917f294d62f449a70257e65014c03 \ --hash=sha256:616ee767286a81b6f575ea3de097bc095db724262586231ca8d7567dd2377a30 \
--hash=sha256:d82ec4193257e49ba7fee1dee940c951c949a8557d0cf2f7b9f817f940ebcf34 --hash=sha256:c039638fcb44dd7c9433ab19e8f05bb782fa13989cb8c74d90e1291ebcc67b3b
# via -r requirements.in # via -r requirements.in
pyarrow==20.0.0 \ pyarrow==20.0.0 \
--hash=sha256:00138f79ee1b5aca81e2bdedb91e3739b987245e11fa3c826f9e57c5d102fb75 \ --hash=sha256:00138f79ee1b5aca81e2bdedb91e3739b987245e11fa3c826f9e57c5d102fb75 \
@ -91,7 +91,7 @@ urllib3==2.4.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==80.7.1 \ setuptools==80.8.0 \
--hash=sha256:ca5cc1069b85dc23070a6628e6bcecb3292acac802399c7f8edc0100619f9009 \ --hash=sha256:49f7af965996f26d43c8ae34539c8d99c5042fbff34302ea151eaa9c207cd257 \
--hash=sha256:f6ffc5f0142b1bd8d0ca94ee91b30c0ca862ffd50826da1ea85258a06fd94552 --hash=sha256:95a60484590d24103af13b686121328cc2736bee85de8936383111e421b9edc0
# via influxdb3-python # via influxdb3-python

View File

@ -2126,7 +2126,7 @@ class Formula
bash: bash_completion/base_name, bash: bash_completion/base_name,
zsh: zsh_completion/"_#{base_name}", zsh: zsh_completion/"_#{base_name}",
fish: fish_completion/"#{base_name}.fish", fish: fish_completion/"#{base_name}.fish",
pwsh: pwsh_completion/"#{base_name}.ps1", pwsh: pwsh_completion/"_#{base_name}.ps1",
} }
shells.each do |shell| shells.each do |shell|

View File

@ -222,11 +222,14 @@ module Homebrew
<% elsif @mode == :python %> <% elsif @mode == :python %>
virtualenv_install_with_resources virtualenv_install_with_resources
<% elsif @mode == :ruby %> <% elsif @mode == :ruby %>
ENV["BUNDLE_VERSION"] = "system" # Avoid installing Bundler into the keg
ENV["GEM_HOME"] = libexec ENV["GEM_HOME"] = libexec
system "bundle", "install", "-without", "development", "test" system "bundle", "config", "set", "without", "development", "test"
system "bundle", "install"
system "gem", "build", "\#{name}.gemspec" system "gem", "build", "\#{name}.gemspec"
system "gem", "install", "\#{name}-\#{version}.gem" system "gem", "install", "\#{name}-\#{version}.gem"
bin.install libexec/"bin/\#{name}" bin.install libexec/"bin/\#{name}"
bin.env_script_all_files(libexec/"bin", GEM_HOME: ENV["GEM_HOME"]) bin.env_script_all_files(libexec/"bin", GEM_HOME: ENV["GEM_HOME"])
<% elsif @mode == :rust %> <% elsif @mode == :rust %>

View File

@ -68,14 +68,14 @@ module Homebrew
# `/get/` archives are Git tag snapshots, so we need to check that tab # `/get/` archives are Git tag snapshots, so we need to check that tab
# instead of the main `/downloads/` page # instead of the main `/downloads/` page
if match[:dl_type] == "get" if match[:dl_type] == "get"
values[:url] = "https://bitbucket.org/#{match[:path]}/downloads/?tab=tags" values[:url] = "https://bitbucket.org/#{match[:path]}/downloads/?tab=tags&iframe=true&spa=0"
# Example tag regexes: # Example tag regexes:
# * `/<td[^>]*?class="name"[^>]*?>\s*v?(\d+(?:\.\d+)+)\s*?</im` # * `/<td[^>]*?class="name"[^>]*?>\s*v?(\d+(?:\.\d+)+)\s*?</im`
# * `/<td[^>]*?class="name"[^>]*?>\s*abc-v?(\d+(?:\.\d+)+)\s*?</im` # * `/<td[^>]*?class="name"[^>]*?>\s*abc-v?(\d+(?:\.\d+)+)\s*?</im`
values[:regex] = /<td[^>]*?class="name"[^>]*?>\s*#{regex_prefix}v?(\d+(?:\.\d+)+)\s*?</im values[:regex] = /<td[^>]*?class="name"[^>]*?>\s*#{regex_prefix}v?(\d+(?:\.\d+)+)\s*?</im
else else
values[:url] = "https://bitbucket.org/#{match[:path]}/downloads/" values[:url] = "https://bitbucket.org/#{match[:path]}/downloads/?iframe=true&spa=0"
# Use `\.t` instead of specific tarball extensions (e.g. .tar.gz) # Use `\.t` instead of specific tarball extensions (e.g. .tar.gz)
suffix = T.must(match[:suffix]).sub(Strategy::TARBALL_EXTENSION_REGEX, ".t") suffix = T.must(match[:suffix]).sub(Strategy::TARBALL_EXTENSION_REGEX, ".t")

View File

@ -68,6 +68,13 @@ class MacOSRequirement < Requirement
@version @version
end end
def maximum_version
return MacOSVersion.new(HOMEBREW_MACOS_NEWEST_UNSUPPORTED) if @comparator == ">=" || !version_specified?
return @version.max if @version.respond_to?(:to_ary)
@version
end
def allows?(other) def allows?(other)
return true unless version_specified? return true unless version_specified?

View File

@ -35,6 +35,12 @@ module RuboCop
def audit_url(type, urls, mirrors, livecheck_url: false) def audit_url(type, urls, mirrors, livecheck_url: false)
@type = type @type = type
# URLs must be ASCII; IDNs must be punycode
ascii_pattern = /[^\p{ASCII}]+/
audit_urls(urls, ascii_pattern) do |_, url|
problem "Please use the ASCII (Punycode encoded host, URL-encoded path and query) version of #{url}."
end
# GNU URLs; doesn't apply to mirrors # GNU URLs; doesn't apply to mirrors
gnu_pattern = %r{^(?:https?|ftp)://ftpmirror\.gnu\.org/(.*)} gnu_pattern = %r{^(?:https?|ftp)://ftpmirror\.gnu\.org/(.*)}
audit_urls(urls, gnu_pattern) do |match, url| audit_urls(urls, gnu_pattern) do |match, url|

View File

@ -0,0 +1 @@
**/*.rbi linguist-vendored=true

View File

@ -0,0 +1,119 @@
# typed: true
# DO NOT EDIT MANUALLY
# This file was pulled from a central RBI files repository.
# Please run `bin/tapioca annotations` to update it.
module Minitest::Assertions
sig { params(test: T.anything, msg: T.anything).returns(TrueClass) }
def assert(test, msg = nil); end
sig { params(obj: T.anything, msg: T.anything).returns(TrueClass) }
def assert_empty(obj, msg = nil); end
sig { params(exp: T.anything, act: T.anything, msg: T.anything).returns(TrueClass) }
def assert_equal(exp, act, msg = nil); end
sig { params(exp: T.anything, act: T.anything, delta: Numeric, msg: T.anything).returns(TrueClass) }
def assert_in_delta(exp, act, delta = T.unsafe(nil), msg = nil); end
sig { params(a: T.anything, b: T.anything, epsilon: Numeric, msg: T.anything).returns(TrueClass) }
def assert_in_epsilon(a, b, epsilon = T.unsafe(nil), msg = nil); end
sig { params(collection: T.anything, obj: T.anything, msg: T.anything).returns(TrueClass) }
def assert_includes(collection, obj, msg = nil); end
sig { params(cls: T.anything, obj: T.anything, msg: T.anything).returns(TrueClass) }
def assert_instance_of(cls, obj, msg = nil); end
sig { params(cls: T.anything, obj: T.anything, msg: T.anything).returns(TrueClass) }
def assert_kind_of(cls, obj, msg = nil); end
sig { params(matcher: T.any(String, Regexp), obj: T.anything, msg: T.anything).returns(MatchData) }
def assert_match(matcher, obj, msg = nil); end
sig { params(obj: T.anything, msg: T.anything).returns(TrueClass) }
def assert_nil(obj, msg = nil); end
sig { params(o1: T.anything, op: T.any(Symbol, String), o2: T.anything, msg: T.anything).returns(TrueClass) }
def assert_operator(o1, op, o2 = T.unsafe(nil), msg = nil); end
sig { params(stdout: T.nilable(T.any(String, Regexp)), stderr: T.nilable(T.any(String, Regexp)), block: T.proc.void).returns(T::Boolean) }
def assert_output(stdout = nil, stderr = nil, &block); end
sig { params(path: T.any(String, Pathname), msg: T.anything).returns(TrueClass) }
def assert_path_exists(path, msg = nil); end
sig { params(block: T.proc.void).returns(TrueClass) }
def assert_pattern(&block); end
sig { params(o1: T.anything, op: T.any(String, Symbol), msg: T.anything).returns(TrueClass) }
def assert_predicate(o1, op, msg = nil); end
sig { params(exp: NilClass, block: T.proc.void).returns(StandardError) }
sig { type_parameters(:T).params(exp: T.any(T::Class[T.type_parameter(:T)], Regexp, String), block: T.proc.void).returns(T.type_parameter(:T)) }
def assert_raises(*exp, &block); end
sig { params(obj: T.anything, meth: T.any(String, Symbol), msg: T.anything, include_all: T::Boolean).returns(TrueClass) }
def assert_respond_to(obj, meth, msg = nil, include_all: false); end
sig { params(exp: T.anything, act: T.anything, msg: T.anything).returns(TrueClass) }
def assert_same(exp, act, msg = nil); end
sig { params(send_ary: T::Array[T.anything], m: T.anything).returns(T::Boolean) }
def assert_send(send_ary, m = nil); end
sig { params(block: T.proc.void).returns(T::Boolean) }
def assert_silent(&block); end
sig { params(sym: Symbol, msg: T.anything, block: T.proc.void).returns(T.anything) }
def assert_throws(sym, msg = nil, &block); end
sig { params(test: T.anything, msg: T.anything).returns(TrueClass) }
def refute(test, msg = nil); end
sig { params(obj: T.anything, msg: T.anything).returns(TrueClass) }
def refute_empty(obj, msg = nil); end
sig { params(exp: T.anything, act: T.anything, msg: T.anything).returns(TrueClass) }
def refute_equal(exp, act, msg = nil); end
sig { params(exp: T.anything, act: T.anything, delta: Numeric, msg: T.anything).returns(TrueClass) }
def refute_in_delta(exp, act, delta = T.unsafe(nil), msg = nil); end
sig { params(a: T.anything, b: T.anything, epsilon: Numeric, msg: T.anything).returns(TrueClass) }
def refute_in_epsilon(a, b, epsilon = T.unsafe(nil), msg = nil); end
sig { params(collection: T.anything, obj: T.anything, msg: T.anything).returns(TrueClass) }
def refute_includes(collection, obj, msg = nil); end
sig { params(cls: T.anything, obj: T.anything, msg: T.anything).returns(TrueClass) }
def refute_instance_of(cls, obj, msg = nil); end
sig { params(cls: T.anything, obj: T.anything, msg: T.anything).returns(TrueClass) }
def refute_kind_of(cls, obj, msg = nil); end
sig { params(matcher: T.any(String, Regexp), obj: T.anything, msg: T.anything).returns(TrueClass) }
def refute_match(matcher, obj, msg = nil); end
sig { params(obj: T.anything, msg: T.anything).returns(TrueClass) }
def refute_nil(obj, msg = nil); end
sig { params(block: T.proc.void).returns(TrueClass) }
def refute_pattern(&block); end
sig { params(o1: T.anything, op: T.any(Symbol, String), o2: T.anything, msg: T.anything).returns(TrueClass) }
def refute_operator(o1, op, o2 = T.unsafe(nil), msg = nil); end
sig { params(path: T.any(String, Pathname), msg: T.anything).returns(TrueClass) }
def refute_path_exists(path, msg = nil); end
sig { params(o1: T.anything, op: T.any(String, Symbol), msg: T.anything).returns(TrueClass) }
def refute_predicate(o1, op, msg = nil); end
sig { params(obj: T.anything, meth: T.any(String, Symbol), msg: T.anything, include_all: T::Boolean).returns(TrueClass) }
def refute_respond_to(obj, meth, msg = nil, include_all: false); end
sig { params(exp: T.anything, act: T.anything, msg: T.anything).returns(TrueClass) }
def refute_same(exp, act, msg = nil); end
end

View File

@ -0,0 +1,269 @@
# typed: true
# DO NOT EDIT MANUALLY
# This file was pulled from a central RBI files repository.
# Please run `bin/tapioca annotations` to update it.
module Rainbow
# @shim: https://github.com/sickill/rainbow/blob/master/lib/rainbow.rb#L10-L12
sig { returns(T::Boolean) }
attr_accessor :enabled
class Color
sig { returns(Symbol) }
attr_reader :ground
sig { params(ground: Symbol, values: T.any([Integer], [Integer, Integer, Integer])).returns(Color) }
def self.build(ground, values); end
sig { params(hex: String).returns([Integer, Integer, Integer]) }
def self.parse_hex_color(hex); end
class Indexed < Rainbow::Color
sig { returns(Integer) }
attr_reader :num
sig { params(ground: Symbol, num: Integer).void }
def initialize(ground, num); end
sig { returns(T::Array[Integer]) }
def codes; end
end
class Named < Rainbow::Color::Indexed
NAMES = T.let(nil, T::Hash[Symbol, Integer])
sig { params(ground: Symbol, name: Symbol).void }
def initialize(ground, name); end
sig { returns(T::Array[Symbol]) }
def self.color_names; end
sig { returns(String) }
def self.valid_names; end
end
class RGB < Rainbow::Color::Indexed
sig { returns(Integer) }
attr_reader :r, :g, :b
sig { params(ground: Symbol, values: Integer).void }
def initialize(ground, *values); end
sig { returns(T::Array[Integer]) }
def codes; end
sig { params(value: Numeric).returns(Integer) }
def self.to_ansi_domain(value); end
end
class X11Named < Rainbow::Color::RGB
include Rainbow::X11ColorNames
sig { params(ground: Symbol, name: Symbol).void }
def initialize(ground, name); end
sig { returns(T::Array[Symbol]) }
def self.color_names; end
sig { returns(String) }
def self.valid_names; end
end
end
sig { returns(Wrapper) }
def self.global; end
sig { returns(T::Boolean) }
def self.enabled; end
sig { params(value: T::Boolean).returns(T::Boolean) }
def self.enabled=(value); end
sig { params(string: String).returns(String) }
def self.uncolor(string); end
class NullPresenter < String
sig { params(values: T.any([Integer], [Integer, Integer, Integer])).returns(NullPresenter) }
def color(*values); end
sig { params(values: T.any([Integer], [Integer, Integer, Integer])).returns(NullPresenter) }
def foreground(*values); end
sig { params(values: T.any([Integer], [Integer, Integer, Integer])).returns(NullPresenter) }
def fg(*values); end
sig { params(values: T.any([Integer], [Integer, Integer, Integer])).returns(NullPresenter) }
def background(*values); end
sig { params(values: T.any([Integer], [Integer, Integer, Integer])).returns(NullPresenter) }
def bg(*values); end
sig { returns(NullPresenter) }
def reset; end
sig { returns(NullPresenter) }
def bright; end
sig { returns(NullPresenter) }
def faint; end
sig { returns(NullPresenter) }
def italic; end
sig { returns(NullPresenter) }
def underline; end
sig { returns(NullPresenter) }
def blink; end
sig { returns(NullPresenter) }
def inverse; end
sig { returns(NullPresenter) }
def hide; end
sig { returns(NullPresenter) }
def cross_out; end
sig { returns(NullPresenter) }
def black; end
sig { returns(NullPresenter) }
def red; end
sig { returns(NullPresenter) }
def green; end
sig { returns(NullPresenter) }
def yellow; end
sig { returns(NullPresenter) }
def blue; end
sig { returns(NullPresenter) }
def magenta; end
sig { returns(NullPresenter) }
def cyan; end
sig { returns(NullPresenter) }
def white; end
sig { returns(NullPresenter) }
def bold; end
sig { returns(NullPresenter) }
def dark; end
sig { returns(NullPresenter) }
def strike; end
end
class Presenter < String
TERM_EFFECTS = T.let(nil, T::Hash[Symbol, Integer])
sig { params(values: T.any([Integer], [Integer, Integer, Integer])).returns(Presenter) }
def color(*values); end
sig { params(values: T.any([Integer], [Integer, Integer, Integer])).returns(Presenter) }
def foreground(*values); end
sig { params(values: T.any([Integer], [Integer, Integer, Integer])).returns(Presenter) }
def fg(*values); end
sig { params(values: T.any([Integer], [Integer, Integer, Integer])).returns(Presenter) }
def background(*values); end
sig { params(values: T.any([Integer], [Integer, Integer, Integer])).returns(Presenter) }
def bg(*values); end
sig { returns(Presenter) }
def reset; end
sig { returns(Presenter) }
def bright; end
sig { returns(Presenter) }
def faint; end
sig { returns(Presenter) }
def italic; end
sig { returns(Presenter) }
def underline; end
sig { returns(Presenter) }
def blink; end
sig { returns(Presenter) }
def inverse; end
sig { returns(Presenter) }
def hide; end
sig { returns(Presenter) }
def cross_out; end
sig { returns(Presenter) }
def black; end
sig { returns(Presenter) }
def red; end
sig { returns(Presenter) }
def green; end
sig { returns(Presenter) }
def yellow; end
sig { returns(Presenter) }
def blue; end
sig { returns(Presenter) }
def magenta; end
sig { returns(Presenter) }
def cyan; end
sig { returns(Presenter) }
def white; end
sig { returns(Presenter) }
def bold; end
sig { returns(Presenter) }
def dark; end
sig { returns(Presenter) }
def strike; end
end
class StringUtils
sig { params(string: String, codes: T::Array[Integer]).returns(String) }
def self.wrap_with_sgr(string, codes); end
sig { params(string: String).returns(String) }
def self.uncolor(string); end
end
VERSION = T.let(nil, String)
class Wrapper
sig { returns(T::Boolean) }
attr_accessor :enabled
sig { params(enabled: T::Boolean).void }
def initialize(enabled = true); end
sig { params(string: String).returns(T.any(Rainbow::Presenter, Rainbow::NullPresenter)) }
def wrap(string); end
end
module X11ColorNames
NAMES = T.let(nil, T::Hash[Symbol, [Integer, Integer, Integer]])
end
end
sig { params(string: String).returns(Rainbow::Presenter) }
def Rainbow(string); end

View File

@ -590,8 +590,9 @@ class Tap
end end
return unless remote return unless remote
current_upstream_head = T.must(git_repository.origin_branch_name) current_upstream_head = git_repository.origin_branch_name
return if requested_remote.blank? && git_repository.origin_has_branch?(current_upstream_head) return if current_upstream_head.present? && requested_remote.blank? &&
git_repository.origin_has_branch?(current_upstream_head)
args = %w[fetch] args = %w[fetch]
args << "--quiet" if quiet args << "--quiet" if quiet
@ -600,6 +601,8 @@ class Tap
safe_system "git", "-C", path, *args safe_system "git", "-C", path, *args
git_repository.set_head_origin_auto git_repository.set_head_origin_auto
current_upstream_head ||= T.must(git_repository.origin_branch_name)
new_upstream_head = T.must(git_repository.origin_branch_name) new_upstream_head = T.must(git_repository.origin_branch_name)
return if new_upstream_head == current_upstream_head return if new_upstream_head == current_upstream_head

View File

@ -158,6 +158,12 @@ RSpec.describe Homebrew::Bundle::Commands::Cleanup do
expect(described_class).to receive(:system_output_no_stderr).and_return("") expect(described_class).to receive(:system_output_no_stderr).and_return("")
expect { described_class.run(force: true) }.to output(/Uninstalled 2 casks/).to_stdout expect { described_class.run(force: true) }.to output(/Uninstalled 2 casks/).to_stdout
end end
it "does not uninstall casks if --brews is disabled" do
expect(Kernel).not_to receive(:system)
expect(described_class).to receive(:system_output_no_stderr).and_return("")
expect { described_class.run(force: true, casks: false) }.not_to output.to_stdout
end
end end
context "when there are casks to zap" do context "when there are casks to zap" do
@ -174,6 +180,12 @@ RSpec.describe Homebrew::Bundle::Commands::Cleanup do
expect(described_class).to receive(:system_output_no_stderr).and_return("") expect(described_class).to receive(:system_output_no_stderr).and_return("")
expect { described_class.run(force: true, zap: true) }.to output(/Uninstalled 2 casks/).to_stdout expect { described_class.run(force: true, zap: true) }.to output(/Uninstalled 2 casks/).to_stdout
end end
it "does not uninstall casks if --casks is disabled" do
expect(Kernel).not_to receive(:system)
expect(described_class).to receive(:system_output_no_stderr).and_return("")
expect { described_class.run(force: true, zap: true, casks: false) }.not_to output.to_stdout
end
end end
context "when there are formulae to uninstall" do context "when there are formulae to uninstall" do
@ -190,6 +202,12 @@ RSpec.describe Homebrew::Bundle::Commands::Cleanup do
expect(described_class).to receive(:system_output_no_stderr).and_return("") expect(described_class).to receive(:system_output_no_stderr).and_return("")
expect { described_class.run(force: true) }.to output(/Uninstalled 2 formulae/).to_stdout expect { described_class.run(force: true) }.to output(/Uninstalled 2 formulae/).to_stdout
end end
it "does not uninstall formulae if --casks is disabled" do
expect(Kernel).not_to receive(:system)
expect(described_class).to receive(:system_output_no_stderr).and_return("")
expect { described_class.run(force: true, brews: false) }.not_to output.to_stdout
end
end end
context "when there are taps to untap" do context "when there are taps to untap" do
@ -206,6 +224,12 @@ RSpec.describe Homebrew::Bundle::Commands::Cleanup do
expect(described_class).to receive(:system_output_no_stderr).and_return("") expect(described_class).to receive(:system_output_no_stderr).and_return("")
described_class.run(force: true) described_class.run(force: true)
end end
it "does not untap taps if --taps is disabled" do
expect(Kernel).not_to receive(:system)
expect(described_class).to receive(:system_output_no_stderr).and_return("")
described_class.run(force: true, taps: false)
end
end end
context "when there are VSCode extensions to uninstall" do context "when there are VSCode extensions to uninstall" do
@ -223,6 +247,12 @@ RSpec.describe Homebrew::Bundle::Commands::Cleanup do
expect(described_class).to receive(:system_output_no_stderr).and_return("") expect(described_class).to receive(:system_output_no_stderr).and_return("")
described_class.run(force: true) described_class.run(force: true)
end end
it "does not uninstall extensions if --vscode is disabled" do
expect(Kernel).not_to receive(:system)
expect(described_class).to receive(:system_output_no_stderr).and_return("")
described_class.run(force: true, vscode: false)
end
end end
context "when there are casks and formulae to uninstall and taps to untap but without passing `--force`" do context "when there are casks and formulae to uninstall and taps to untap but without passing `--force`" do

View File

@ -110,4 +110,18 @@ RSpec.describe Formatter do
expect(described_class.format_help_text(text, width: 80)).to eq expected expect(described_class.format_help_text(text, width: 80)).to eq expected
end end
end end
describe "::truncate" do
it "returns the original string if it's shorter than max length" do
expect(described_class.truncate("short", max: 10)).to eq("short")
end
it "truncates strings longer than max length" do
expect(described_class.truncate("this is a long string", max: 10)).to eq("this is...")
end
it "uses custom omission string" do
expect(described_class.truncate("this is a long string", max: 10, omission: " [...]")).to eq("this [...]")
end
end
end end

View File

@ -16,11 +16,11 @@ RSpec.describe Homebrew::Livecheck::Strategy::Bitbucket do
let(:generated) do let(:generated) do
{ {
get: { get: {
url: "https://bitbucket.org/abc/def/downloads/?tab=tags", url: "https://bitbucket.org/abc/def/downloads/?tab=tags&iframe=true&spa=0",
regex: /<td[^>]*?class="name"[^>]*?>\s*v?(\d+(?:\.\d+)+)\s*?</im, regex: /<td[^>]*?class="name"[^>]*?>\s*v?(\d+(?:\.\d+)+)\s*?</im,
}, },
downloads: { downloads: {
url: "https://bitbucket.org/abc/def/downloads/", url: "https://bitbucket.org/abc/def/downloads/?iframe=true&spa=0",
regex: /href=.*?ghi-v?(\d+(?:\.\d+)+)\.t/i, regex: /href=.*?ghi-v?(\d+(?:\.\d+)+)\.t/i,
}, },
} }

View File

@ -6,6 +6,7 @@ RSpec.describe MacOSRequirement do
subject(:requirement) { described_class.new } subject(:requirement) { described_class.new }
let(:macos_oldest_allowed) { MacOSVersion.new(HOMEBREW_MACOS_OLDEST_ALLOWED) } let(:macos_oldest_allowed) { MacOSVersion.new(HOMEBREW_MACOS_OLDEST_ALLOWED) }
let(:macos_newest_allowed) { MacOSVersion.new(HOMEBREW_MACOS_NEWEST_UNSUPPORTED) }
let(:big_sur_major) { MacOSVersion.new("11.0") } let(:big_sur_major) { MacOSVersion.new("11.0") }
describe "#satisfied?" do describe "#satisfied?" do
@ -37,6 +38,19 @@ RSpec.describe MacOSRequirement do
expect(range_requirement.minimum_version).to eq big_sur_major expect(range_requirement.minimum_version).to eq big_sur_major
end end
specify "#maximum_version" do
no_requirement = described_class.new
max_requirement = described_class.new([:big_sur], comparator: "<=")
min_requirement = described_class.new([:big_sur], comparator: ">=")
exact_requirement = described_class.new([:big_sur], comparator: "==")
range_requirement = described_class.new([[:catalina, :big_sur]], comparator: "==")
expect(no_requirement.maximum_version).to eq macos_newest_allowed
expect(max_requirement.maximum_version).to eq big_sur_major
expect(min_requirement.maximum_version).to eq macos_newest_allowed
expect(exact_requirement.maximum_version).to eq big_sur_major
expect(range_requirement.maximum_version).to eq big_sur_major
end
specify "#allows?" do specify "#allows?" do
no_requirement = described_class.new no_requirement = described_class.new
max_requirement = described_class.new([:mojave], comparator: "<=") max_requirement = described_class.new([:mojave], comparator: "<=")

View File

@ -177,6 +177,14 @@ RSpec.describe RuboCop::Cop::FormulaAudit::Urls do
"url" => "svn+http://brew.sh/foo/bar", "url" => "svn+http://brew.sh/foo/bar",
"msg" => "Use of the svn+http:// scheme is deprecated, pass `:using => :svn` instead", "msg" => "Use of the svn+http:// scheme is deprecated, pass `:using => :svn` instead",
"col" => 2, "col" => 2,
}, {
"url" => "https://🫠.sh/foo/bar",
"msg" => "Please use the ASCII (Punycode encoded host, URL-encoded path and query) version of https://🫠.sh/foo/bar.",
"col" => 2,
}, {
"url" => "https://ßre.sh/foo/bar",
"msg" => "Please use the ASCII (Punycode encoded host, URL-encoded path and query) version of https://ßre.sh/foo/bar.",
"col" => 2,
}] }]
end end

View File

@ -71,14 +71,6 @@ RSpec.describe GitHub do
) )
expect(urls).to eq(["https://api.github.com/repos/Homebrew/homebrew-core/actions/artifacts/1969725476/zip"]) expect(urls).to eq(["https://api.github.com/repos/Homebrew/homebrew-core/actions/artifacts/1969725476/zip"])
end end
it "supports pattern matching" do
urls = described_class.get_artifact_urls(
described_class.get_workflow_run("Homebrew", "brew", "17068",
workflow_id: "pkg-installer.yml", artifact_pattern: "Homebrew-*.pkg"),
)
expect(urls).to eq(["https://api.github.com/repos/Homebrew/brew/actions/artifacts/1405050842/zip"])
end
end end
describe "::pull_request_commits", :needs_network do describe "::pull_request_commits", :needs_network do

View File

@ -67,7 +67,18 @@ module Homebrew
end end
unversioned_name = f.name.gsub(/@.+$/, "") unversioned_name = f.name.gsub(/@.+$/, "")
maybe_paths = Dir.glob("#{f.etc}/*#{unversioned_name}*") maybe_paths = Dir.glob("#{f.etc}/#{unversioned_name}*")
excluded_names = Homebrew::API::Formula.all_formulae.keys
maybe_paths = maybe_paths.reject do |path|
# Remove extension only if a file
# (f.e. directory with name "openssl@1.1" will be trimmed to "openssl@1")
basename = if File.directory?(path)
File.basename(path)
else
File.basename(path, ".*")
end
excluded_names.include?(basename)
end
maybe_paths -= paths if paths.present? maybe_paths -= paths if paths.present?
if maybe_paths.present? if maybe_paths.present?
puts puts

View File

@ -54,6 +54,19 @@ module Formatter
label(label, string, :red) label(label, string, :red)
end end
# Truncate a string to a specific length.
#
# @api internal
sig { params(string: String, max: Integer, omission: String).returns(String) }
def self.truncate(string, max: 30, omission: "...")
return string if string.length <= max
length_with_room_for_omission = max - omission.length
truncated = string[0, length_with_room_for_omission]
"#{truncated}#{omission}"
end
# Wraps text to fit within a given number of columns using regular expressions that: # Wraps text to fit within a given number of columns using regular expressions that:
# #
# 1. convert hard-wrapped paragraphs to a single line # 1. convert hard-wrapped paragraphs to a single line

View File

@ -87,7 +87,7 @@ module SPDX
return ALLOWED_LICENSE_SYMBOLS.include? license if license.is_a? Symbol return ALLOWED_LICENSE_SYMBOLS.include? license if license.is_a? Symbol
license = license.delete_suffix "+" license = license.delete_suffix "+"
license_data["licenses"].any? { |spdx_license| spdx_license["licenseId"] == license } license_data["licenses"].any? { |spdx_license| spdx_license["licenseId"].downcase == license.downcase }
end end
sig { params(license: T.any(String, Symbol)).returns(T::Boolean) } sig { params(license: T.any(String, Symbol)).returns(T::Boolean) }
@ -97,14 +97,14 @@ module SPDX
license = license.to_s.delete_suffix "+" license = license.to_s.delete_suffix "+"
license_data["licenses"].none? do |spdx_license| license_data["licenses"].none? do |spdx_license|
spdx_license["licenseId"] == license && !spdx_license["isDeprecatedLicenseId"] spdx_license["licenseId"].downcase == license.downcase && !spdx_license["isDeprecatedLicenseId"]
end end
end end
sig { params(exception: String).returns(T::Boolean) } sig { params(exception: String).returns(T::Boolean) }
def valid_license_exception?(exception) def valid_license_exception?(exception)
exception_data["exceptions"].any? do |spdx_exception| exception_data["exceptions"].any? do |spdx_exception|
spdx_exception["licenseExceptionId"] == exception && !spdx_exception["isDeprecatedLicenseId"] spdx_exception["licenseExceptionId"].downcase == exception.downcase && !spdx_exception["isDeprecatedLicenseId"]
end end
end end

View File

@ -78,7 +78,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.4") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/rbs-3.9.4")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rbs-3.9.4/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rbs-3.9.4/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-runtime-0.5.12109/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-runtime-0.5.12117/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rbi-0.3.3/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rbi-0.3.3/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")
@ -100,7 +100,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.6.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubocop-rspec-3.6.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.20/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ruby-lsp-0.23.21/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")
@ -108,9 +108,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.12109-universal-darwin/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-static-0.5.12117-universal-darwin/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-0.5.12109/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-0.5.12117/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-static-and-runtime-0.5.12109/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-static-and-runtime-0.5.12117/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.3/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/spoom-1.6.3/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