29216 Commits

Author SHA1 Message Date
Mike McQuaid
6918fb94ce
Enable Sorbet by default for Homebrew developers and developer commands.
I've been doing this personally for a few months and not hit any bugs.
We already do this for `brew tests`.

It will allow us to:

- remove manual type checks from all developer commands (Sorbet does a
  better job with these)
- better surface bugs
- better surface type signatures
- get closer to being able to enable this by default for everyone
2023-05-05 08:56:53 +01:00
Carlo Cabrera
54adebb1de
Merge pull request #15356 from carlocab/macos-timeout
github_runner_matrix: improve macOS timeout handling
2023-05-04 21:22:29 +08:00
Bo Anderson
7d8815cc9d
Merge pull request #15359 from samuello1228/samuello1228
bottle: some tar flags are not supported on Mojave
2023-05-04 12:49:00 +01:00
Mike McQuaid
0e387fee8c
Merge pull request #15138 from JBYoshi/cask-move-contents
Don't remove cask directories when upgrading.
2023-05-04 11:43:44 +01:00
Samuel Lo
41aab1490a bottle: some tar flags is not supported on Mojave 2023-05-04 04:01:51 +08:00
JBYoshi
3e249a9428
Improve styling. 2023-05-03 11:29:01 -05:00
Mike McQuaid
17911130b3
Merge pull request #15349 from Homebrew/dependabot/bundler/Library/Homebrew/rubocop-ast-1.28.1
build(deps): bump rubocop-ast from 1.28.0 to 1.28.1 in /Library/Homebrew
2023-05-03 11:52:45 +01:00
Carlo Cabrera
27eed480ee
github_runner_matrix: improve macOS timeout handling
1. Use the maximum timeout possible for GitHub-hosted macOS runners
2. When using a short timeout, use an even shorter timeout on ARM
   runners.

Our ARM runners are typically at least twice as fast as our Intel
runners on any given job. So, if it takes an ARM runner over half the
timeout to complete a job, it's almost certain that the Intel runner
will not complete the job within the timeout.

Setting an even shorter timeout on the ARM runners will help us abandon
jobs that are unlikely to be completed within the timeout well before we
hit the requested timeout.
2023-05-03 17:55:57 +08:00
Carlo Cabrera
9744b69071
github_packages: use exponential backoff when retrying
The retry behaviour in `publish_commit_bottles.yml` [1] is often
successful after the second try, so it's likely that we're not waiting
long enough in between retries here.

Let's fix that by retrying with exponential backoff instead of adding a
fixed interval of five seconds after each failure.

[1] 3241035b2a/.github/workflows/publish-commit-bottles.yml (L431-L443)
2023-05-03 16:58:16 +08:00
Carlo Cabrera
31a152208b
github_packages: improve upload error handling
Erroring out in the middle of uploading multiple bottles results in a
state that is tedious to recover from.

Let's try to avoid these situations by performing checks for all the
bottles first before trying to upload any.
2023-05-03 16:40:42 +08:00
BrewTestBot
360a43ea7d
Update RBI files for rubocop-ast.
Autogenerated by the [vendor-gems](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/vendor-gems.yml) workflow.
2023-05-02 19:05:31 +00:00
BrewTestBot
001f5dad12
brew vendor-gems: commit updates. 2023-05-02 19:00:54 +00:00
dependabot[bot]
6557dfc5f2
build(deps): bump rubocop-ast from 1.28.0 to 1.28.1 in /Library/Homebrew
Bumps [rubocop-ast](https://github.com/rubocop/rubocop-ast) from 1.28.0 to 1.28.1.
- [Release notes](https://github.com/rubocop/rubocop-ast/releases)
- [Changelog](https://github.com/rubocop/rubocop-ast/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop-ast/compare/v1.28.0...v1.28.1)

---
updated-dependencies:
- dependency-name: rubocop-ast
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-02 18:58:35 +00:00
Mike McQuaid
e62a839001
Merge pull request #15345 from ZhongRuoyu/update-report-no-origin
cmd/update-report: do not fail when tap has no origin
2023-05-02 12:20:10 +01:00
Bo Anderson
5921aef55c
Fix DownloadError erroring itself 2023-05-02 02:09:53 +01:00
Ruoyu Zhong
5d9c3d0432
cmd/update-report: do not fail when tap has no origin
This fixes the following error:

    $ brew update
    Warning: No remote 'origin' in /usr/local/Homebrew/Library/Taps/foo/homebrew-bar, skipping update!
    Error: HOMEBREW_UPDATE_BEFORE_FOO_HOMEBREW_BAR is unset!
    /usr/local/Homebrew/Library/Homebrew/cmd/update-report.rb:361:in `initialize'
    /usr/local/Homebrew/Library/Homebrew/cmd/update-report.rb:187:in `new'
    /usr/local/Homebrew/Library/Homebrew/cmd/update-report.rb:187:in `block in output_update_report'
    /usr/local/Homebrew/Library/Homebrew/tap.rb:748:in `block (2 levels) in each'
    /usr/local/Homebrew/Library/Homebrew/tap.rb:747:in `each'
    /usr/local/Homebrew/Library/Homebrew/tap.rb:747:in `block in each'
    /usr/local/Homebrew/Library/Homebrew/tap.rb:746:in `each'
    /usr/local/Homebrew/Library/Homebrew/tap.rb:746:in `each'
    /usr/local/Homebrew/Library/Homebrew/cmd/update-report.rb:160:in `output_update_report'
    /usr/local/Homebrew/Library/Homebrew/cmd/update-report.rb:40:in `update_report'
    /usr/local/Homebrew/Library/Homebrew/brew.rb:94:in `<main>'
    Already up-to-date.

Signed-off-by: Ruoyu Zhong <zhongruoyu@outlook.com>
2023-05-01 23:37:01 +08:00
Sam Ford
ec2a7121ab
BazaarDownloadStrategy: Replace in-place sub
livecheck's `Git` strategy uses `DownloadStrategyDetector#detect`
in its `#match?` method to check if a URL is a Git repository. This
has historically worked fine but I've recently seen a `can't modify
frozen String` error for a few formulae (percona-toolkit,
schroedinger, squid) in relation to the in-place `sub` call in
`BazaarDownloadStrategy`'s initializer.

Other download strategies use a `@url = @url.sub(...)` pattern to
avoid this issue, so this commit resolves the issue by using the same
approach in `BazaarDownloadStrategy`.
2023-05-01 10:45:13 -04:00
Issy Long
a1da2bde3d
Appease brew style 2023-04-30 19:09:41 +01:00
Issy Long
e739a5c076
"A few small nits" from code review
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2023-04-30 19:06:07 +01:00
JBYoshi
4935a8fbb2
Remove unreachable warning. 2023-04-30 12:29:40 -05:00
Issy Long
40f697e96e
diagnostic: Check for unnecessary Core and Cask taps
- If the user doesn't have `HOMEBREW_DEVELOPER` or
  `HOMEBREW_NO_INSTALL_FROM_API` set but does have `homebrew/core` or
  `homebrew/cask` taps installed this can cause problems with installing
  outdated software.
- Hence, warn them in `brew doctor` if they have either of these taps
  installed, with instructions on how to remove them.
2023-04-30 15:25:56 +01:00
Ruoyu Zhong
254941c6f7
rubocops/service: check for more cellar paths
This is a follow-up to #15154. In addition to `bin`, the `service` block
can also reference other cellar paths like `libexec`. They don't work
with the API either, as reported in
https://github.com/orgs/Homebrew/discussions/4459.

Violations are already corrected in Homebrew/homebrew-core#129736
and Homebrew/homebrew-core#129737.

Signed-off-by: Ruoyu Zhong <zhongruoyu@outlook.com>
2023-04-30 07:39:25 +08:00
Sam Ford
a2e966c186
Xml: Move require outside of #parse_xml
Since we use `REXML::Document` in the type signature for `#parse_xml`,
we can encounter an `uninitialized constant
Homebrew::Livecheck::Strategy::Xml::REXML` error in strategies like
`Sparkle` that use `Xml#parse_xml` internally when the Sorbet runtime
is used. Moving the related require outside of the `#parse_xml` method
and into the `Xml` strategy proper resolves this issue.
2023-04-29 10:16:47 -04:00
Sam Ford
6597ee6fd3
Sparkle: Account for nil content value
`content` can be `nil` when a request doesn't succeed but
`#versions_from_content` expects a `String` value, so we need to
guard against a `nil` value like we do in other strategies.
2023-04-29 10:16:47 -04:00
Sam Ford
1c03018b6a
Launchpad: Use DEFAULT_REGEX as default regex arg
Using `DEFAULT_REGEX` as the default value of the `#find_versions`
`regex` parameter allows us to tighten the type.
2023-04-29 10:16:46 -04:00
Sam Ford
a28e1aa422
livecheck: Selectively pass args to #find_versions
The existing way of passing values to `#find_versions` methods in
strategies leads to type issues when the Sorbet runtime is enabled.
We've also recently talked about moving away from nilable args when
we can specify a default value but this doesn't work if we pass in a
`nil` value (like we're currently doing).

This commit aims to address both of those areas by better controlling
which arguments we're passing to `#find_versions`. This approach
naively handles `cask`/`url` arguments by special-casing
`ExtractPlist`.

However, we should be checking the strategy's `#find_versions`
method for a `cask` or `url` keyword parameter. The issue is that
`strategy.method(:find_versions).parameters` is returning
`[[:rest, :args], [:block, :blk]]` instead of the actual parameters
like `[[:keyreq, :url], [:key, :regex], [:keyrest, :unused],
[:block, :block]]`.
2023-04-29 10:16:45 -04:00
Mike McQuaid
cd683aefa8
Merge pull request #14629 from Kentzo/sudo-user
sudo: explicitly specify the root user where necessary
2023-04-29 11:17:21 +01:00
Markus Reiter
e666dd6b4f
Merge pull request #15332 from reitermarkus/typecheck-nested-url
Fix type for nested `url` blocks.
2023-04-29 12:13:06 +02:00
Mike McQuaid
ca155cba39
Merge pull request #15330 from Homebrew/dependabot/bundler/Library/Homebrew/zeitwerk-2.6.8
build(deps): bump zeitwerk from 2.6.7 to 2.6.8 in /Library/Homebrew
2023-04-29 11:11:58 +01:00
Mike McQuaid
4789d18c7c
Merge pull request #15328 from Kentzo/timeout-typo
download_strategy: Fix the timeout value.
2023-04-29 11:11:41 +01:00
Carlo Cabrera
f3724f00d2
determine-test-runners: fix test 2023-04-29 11:36:31 +08:00
Carlo Cabrera
50df7fab28
determine-test-runners: add debug output
The extra timeout on Intel Big Sur doesn't seem to be set, so I'm adding
this so I can have a closer look.
2023-04-29 11:03:27 +08:00
Markus Reiter
af1961d509
Fix type for nested url blocks. 2023-04-29 03:33:59 +02:00
BrewTestBot
811d755e7f
Update RBI files for zeitwerk.
Autogenerated by the [vendor-gems](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/vendor-gems.yml) workflow.
2023-04-28 19:06:59 +00:00
BrewTestBot
f47fc81dd9
brew vendor-gems: commit updates. 2023-04-28 19:02:30 +00:00
dependabot[bot]
2e947b9c35
build(deps): bump zeitwerk from 2.6.7 to 2.6.8 in /Library/Homebrew
Bumps [zeitwerk](https://github.com/fxn/zeitwerk) from 2.6.7 to 2.6.8.
- [Release notes](https://github.com/fxn/zeitwerk/releases)
- [Changelog](https://github.com/fxn/zeitwerk/blob/main/CHANGELOG.md)
- [Commits](https://github.com/fxn/zeitwerk/compare/v2.6.7...v2.6.8)

---
updated-dependencies:
- dependency-name: zeitwerk
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-28 18:59:56 +00:00
Ilya Kulakov
6a4322833f sudo: Fix tests. 2023-04-28 11:22:54 -07:00
Ilya Kulakov
476d97934f sudo: change sudo_user to sudo_as_root. 2023-04-28 11:22:54 -07:00
Ilya Kulakov
d470661b37 sudo: add the sudo_user arg to SystemCommand. 2023-04-28 11:11:53 -07:00
Ilya Kulakov
563387a7b4 sudo: explicitly specify the root user where necessary
With sudoers one may override default sudo user. This mostly works
provided the admin configured the replacement appropriately. However
there are exceptions that absolutely must be run by root such as
/usr/sbin/installer and, under certain circumstances, /bin/launchctl.
2023-04-28 11:11:53 -07:00
Ilya Kulakov
a63ccfa8ff download_strategy: Fix the timeout value. 2023-04-28 10:11:24 -07:00
Bo Anderson
44f058edb5
Refactor formula, cask and Ruby source downloads to use shared code 2023-04-27 23:23:07 +01:00
BrewTestBot
45308ed3eb
Update RBI files for i18n.
Autogenerated by the [vendor-gems](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/vendor-gems.yml) workflow.
2023-04-27 16:41:43 +00:00
BrewTestBot
a8f023f8bb
brew vendor-gems: commit updates. 2023-04-27 16:37:05 +00:00
dependabot[bot]
7945f0c123
build(deps): bump i18n from 1.12.0 to 1.13.0 in /Library/Homebrew
Bumps [i18n](https://github.com/ruby-i18n/i18n) from 1.12.0 to 1.13.0.
- [Release notes](https://github.com/ruby-i18n/i18n/releases)
- [Changelog](https://github.com/ruby-i18n/i18n/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ruby-i18n/i18n/compare/v1.12.0...v1.13.0)

---
updated-dependencies:
- dependency-name: i18n
  dependency-type: indirect
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-27 16:34:24 +00:00
William Woodruff
ea6423094b
pypi: normalize name in pypi_info
Signed-off-by: William Woodruff <william@yossarian.net>
2023-04-27 10:14:17 -06:00
JBYoshi
84fe93e5d7
Remove successor behavior for zapping. 2023-04-27 10:40:45 -05:00
Mike McQuaid
f543b6f53e
Merge pull request #15323 from Homebrew/sorbet-files-update
sorbet: Update RBI files.
2023-04-27 16:30:59 +01:00
Douglas Eichelberger
6bc94abadc Remove delegation of ReporterHub#empty? 2023-04-27 08:13:51 -07:00
Mike McQuaid
9d5b017bb9
Merge pull request #15322 from carlocab/rm-linux-cleanup
github_runner_matrix: remove `HOMEBREW_LINUX_CLEANUP`
2023-04-27 12:28:45 +01:00