41618 Commits

Author SHA1 Message Date
apainintheneck
60b8878f21 tap: share components of formula and cask file path regexes
The goal here is to make things easier to read by better
describing how different regexes are similar to each other.
2024-08-28 19:12:02 -07:00
apainintheneck
62a4734c90 tap: add tests for formula_file? and cask_file? 2024-08-27 00:36:23 -07:00
apainintheneck
cd430c4d34 cmd/update-report: improve formula file validation
Currently, ruby files that are not in the Cask directory are
considered to be formulae if a Formula or HomebrewFormula directory
doesn't exist  which doesn't make sense. We know that these should
only be in a few directories so we can check for that explicitly.

Beyond that the `Tap#cask_file?` and `Tap.formula_file?` methods
were only used inside update-report so it doesn't make sense to
turn them into pathnames and expand things when we know that
each string will be a relative path from a tap that we can just
check with a regex.

This change will stop other tap changes like new commands or
changes to other directories like lib/ from showing up as new formulae.

I tried opening a PR for this a long time ago but I got busy
with other things and it got closed by the stale bot.

- https://github.com/Homebrew/brew/pull/15489
2024-08-25 18:32:04 -07:00
Kevin
0c3104a8f2
Merge pull request #18165 from Homebrew/speed-up-loading-cask-and-formula-file-names_v2
Speed up the `Tap#formula_files` and `Tap#cask_files` methods
2024-08-25 17:53:10 -07:00
apainintheneck
f3a5a3c449 Speed up the Tap#formula_files and Tap#cask_files methods
These are slow because of some Pathname related reasons so it's been
changed up to use `Dir.glob` instead and that makes a large difference.

```
$ hyperfine --parameter-list branch master,speed-up-loading-cask-and-formula-file-names,speed-up-loading-cask-and-formula-file-names_v2 --warmup 5 --setup 'git switch {branch}' 'brew cat gimp'
Benchmark 1: brew cat gimp (branch = master)
  Time (mean ± σ):      2.150 s ±  0.014 s    [User: 1.369 s, System: 0.745 s]
  Range (min … max):    2.126 s …  2.174 s    10 runs

Benchmark 2: brew cat gimp (branch = speed-up-loading-cask-and-formula-file-names)
  Time (mean ± σ):      1.814 s ±  0.012 s    [User: 1.068 s, System: 0.711 s]
  Range (min … max):    1.797 s …  1.840 s    10 runs

Benchmark 3: brew cat gimp (branch = speed-up-loading-cask-and-formula-file-names_v2)
  Time (mean ± σ):      1.489 s ±  0.009 s    [User: 0.905 s, System: 0.550 s]
  Range (min … max):    1.478 s …  1.503 s    10 runs

Summary
  brew cat gimp (branch = speed-up-loading-cask-and-formula-file-names_v2) ran
    1.22 ± 0.01 times faster than brew cat gimp (branch = speed-up-loading-cask-and-formula-file-names)
    1.44 ± 0.01 times faster than brew cat gimp (branch = master)
```
2024-08-25 15:34:10 -07:00
Bo Anderson
17e3bee3da
Merge pull request #18162 from Homebrew/cc-LD_LIBRARY_PATH
shims/super/cc: unset `LD_LIBRARY_PATH`
2024-08-25 17:55:08 +01:00
Ruoyu Zhong
0b3b7d9bc3
shims/super/cc: only set HOMEBREW_LD_LIBRARY_PATH when needed
Co-authored-by: Bo Anderson <mail@boanderson.me>
2024-08-26 00:39:27 +08:00
Ruoyu Zhong
fb57604fe2
shims/super/cc: preserve LD_LIBRARY_PATH
This could be used by the linker [^1] so let's preserve it before
invoking the compiler/linker.

[^1]: https://sourceware.org/binutils/docs/ld/Options.html
2024-08-26 00:18:15 +08:00
Bo Anderson
47f5ed17f9
Merge pull request #18156 from Homebrew/stricter-sudo
bin/brew: improve `sudo` handling
2024-08-25 17:06:21 +01:00
Ruoyu Zhong
86de678086
shims/super/cc: unset LD_LIBRARY_PATH
A local `ruby` build failed while building extensions, with:

    *** Following extensions are not compiled:
    -test-/file:
      Could not be configured. It will not be installed.
      /tmp/ruby-20240824-893184-ehcnsa/ruby-3.3.4/lib/mkmf.rb:480: The compiler failed to generate an executable file.
      You have to install development tools first.
      Check ext/-test-/file/mkmf.log for more details.
    -test-/symbol:
      Could not be configured. It will not be installed.
      /tmp/ruby-20240824-893184-ehcnsa/ruby-3.3.4/lib/mkmf.rb:480: The compiler failed to generate an executable file.
      You have to install development tools first.
      Check ext/-test-/symbol/mkmf.log for more details.
    [...]

`mkmf.log` indicated that the compiler shim failed to load `pathname`:

    LD_LIBRARY_PATH=.:../../.. "gcc-13 -o conftest -I../../../.ext/include/aarch64-linux -I../../.././include -I../../.././ext/-test-/file -I/home/linuxbrew/.linuxbrew/opt/libyaml/include -I/home/linuxbrew/.linuxbrew/opt/openssl@3/include    -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef  -fPIC conftest.c  -L. -L../../.. -L/home/linuxbrew/.linuxbrew/opt/libyaml/lib -Wl,-rpath,/home/linuxbrew/.linuxbrew/opt/libyaml/lib -L/home/linuxbrew/.linuxbrew/opt/openssl@3/lib -Wl,-rpath,/home/linuxbrew/.linuxbrew/opt/openssl@3/lib -L. -fstack-protector-strong -L/home/linuxbrew/.linuxbrew/opt/libyaml/lib  -Wl,-rpath,/home/linuxbrew/.linuxbrew/opt/libyaml/lib -L/home/linuxbrew/.linuxbrew/opt/openssl@3/lib  -Wl,-rpath,/home/linuxbrew/.linuxbrew/opt/openssl@3/lib -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed     -Wl,-rpath,/home/linuxbrew/.linuxbrew/Cellar/ruby/3.3.4/lib -L/home/linuxbrew/.linuxbrew/Cellar/ruby/3.3.4/lib -lruby-static -lz -lrt -lrt -ldl -lcrypt -lm -lpthread   -lm -lpthread  -lc"
    /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/shims/linux/super/gcc-13:12:in `require': cannot load such file -- pathname (LoadError)
      from /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/shims/linux/super/gcc-13:12:in `<main>'

I believe this was due to `../../..` in `LD_LIBRARY_PATH` containing
`libruby.so`, causing the Ruby script to load the being-built Ruby
library instead of the system/portable one.
2024-08-25 23:50:13 +08:00
Patrick Linnane
e267c1f188
Merge pull request #18158 from Homebrew/dependabot/bundler/Library/Homebrew/sorbet-0.5.11545 2024-08-25 08:07:27 -07:00
Patrick Linnane
4fae2393b5
Merge pull request #18157 from Homebrew/dependabot/github_actions/github/codeql-action-3.26.5 2024-08-25 08:04:40 -07:00
BrewTestBot
057fe8b186
brew vendor-gems: commit updates. 2024-08-25 14:55:43 +00:00
dependabot[bot]
0392aa0582
build(deps-dev): bump sorbet in /Library/Homebrew
Bumps [sorbet](https://github.com/sorbet/sorbet) from 0.5.11537 to 0.5.11545.
- [Release notes](https://github.com/sorbet/sorbet/releases)
- [Commits](https://github.com/sorbet/sorbet/commits)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-25 14:54:29 +00:00
dependabot[bot]
46d8228db8
build(deps): bump github/codeql-action from 3.26.4 to 3.26.5
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.26.4 to 3.26.5.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](f0f3afee80...2c779ab0d0)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-25 14:54:25 +00:00
Carlo Cabrera
cd4f6eb2c0
bin/brew: improve sudo handling
- prioritise `/usr/bin/sudo` instead of any random `sudo` in `PATH`
2024-08-25 18:03:16 +08:00
Bo Anderson
36a0e539e4
Merge pull request #18155 from Homebrew/github-simplifications
utils/github: a few more simplifications
2024-08-25 00:50:45 +01:00
Carlo Cabrera
af4cd63408
Merge pull request #18154 from chenrui333/fix-tag-audit 2024-08-25 04:36:20 +08:00
Carlo Cabrera
43ec1fc38a
utils/github: a few more simplifications
Follow-up to #18150.
2024-08-25 04:33:42 +08:00
Rui Chen
a4dd50f6f1
formula_auditor: ensure tag is not nil when doing online audit
Signed-off-by: Rui Chen <rui@chenrui.dev>
2024-08-24 16:03:12 -04:00
Bo Anderson
ff8bb50cfa
Merge pull request #18151 from Homebrew/speed-up-cask-files-by-name
Speed up `CoreCaskTap#cask_files_by_name`
2024-08-24 20:17:11 +01:00
Bo Anderson
0408c184ac
Merge pull request #18152 from Homebrew/more-paginate-graphql
utils/github: use `paginate_graphql` in `sponsorships`
2024-08-24 20:17:02 +01:00
Bo Anderson
a208b1bee4
Merge pull request #18150 from Homebrew/pr-count-fix
utils/github: fix `too_many_open_prs?`
2024-08-24 20:16:54 +01:00
Bo Anderson
e521f3947b
Merge pull request #18149 from cho-m/perl-shebang-whitespaces
keg_relocate: allow spaces/tabs after shebang
2024-08-24 20:16:43 +01:00
Bo Anderson
720e867cbf
Merge pull request #18146 from Homebrew/shellcheck-brew.sh
brew.sh: remove some shellcheck disables
2024-08-24 20:16:29 +01:00
Carlo Cabrera
4a7579c693
utils/github: use paginate_graphql in sponsorships
`sponsorships` has its own implementation of GraphQL pagination. We can
simplify this by using `paginate_graphql` instead.
2024-08-25 01:34:36 +08:00
apainintheneck
fff4e0a8f0 Speed up Tap#cask_files_by_name
This is most noticeable when you have a large local tap and it ends
up taking a nontrivial percentage of the overall run time for simple
commands like `brew info gimp`. The improvement here is to just
create paths later on in the loop which copies what we already do
for formulae.

See b1ddb05

```console
$ hyperfine --parameter-list branch master,speed-up-cask-files-by-name --warmup 5 --setup 'git switch {branch}' 'brew info gimp'
Benchmark 1: brew info gimp (branch = master)
  Time (mean ± σ):      2.737 s ±  0.010 s    [User: 1.958 s, System: 0.732 s]
  Range (min … max):    2.720 s …  2.748 s    10 runs

Benchmark 2: brew info gimp (branch = speed-up-cask-files-by-name)
  Time (mean ± σ):      2.597 s ±  0.017 s    [User: 1.828 s, System: 0.724 s]
  Range (min … max):    2.577 s …  2.624 s    10 runs

Summary
  brew info gimp (branch = speed-up-cask-files-by-name) ran
    1.05 ± 0.01 times faster than brew info gimp (branch = master)
```
2024-08-24 10:15:09 -07:00
Carlo Cabrera
03d9a3dda5
utils/github: use #fetch
Co-authored-by: Markus Reiter <me@reitermark.us>
2024-08-24 23:10:39 +08:00
Carlo Cabrera
f873835b97
utils/github: fix too_many_open_prs?
This doesn't count PRs from forks, so it only works correctly for
maintainers (and only if they use non-fork branches).

Let's fix that, and:
- simplify the logic by using `paginate_graphql`
- return early if it's impossible for them to have too many open PRs
2024-08-24 22:51:23 +08:00
Michael Cho
04381b26dd
keg_relocate: allow spaces/tabs after shebang 2024-08-23 22:56:15 -04:00
Carlo Cabrera
019fc519da
Merge pull request #18145 from Homebrew/sorbet-files-update 2024-08-24 08:50:47 +08:00
BrewTestBot
e63748bf03
sorbet: Update RBI files.
Autogenerated by the [sorbet](https://github.com/Homebrew/brew/blob/master/.github/workflows/sorbet.yml) workflow.
2024-08-24 00:21:44 +00:00
Carlo Cabrera
97403cd309
brew.sh: remove some shellcheck disables
We don't need these, so let's remove them.
2024-08-24 08:21:43 +08:00
Carlo Cabrera
1871e822ec
Merge pull request #18140 from Homebrew/dependabot/bundler/Library/Homebrew/sorbet-0.5.11537 2024-08-24 02:57:22 +08:00
Carlo Cabrera
6c5bf07432
Merge pull request #18142 from Homebrew/dependabot/bundler/Library/Homebrew/rbs-3.5.3 2024-08-24 02:53:23 +08:00
BrewTestBot
fc6742d464
brew vendor-gems: commit updates. 2024-08-23 18:43:44 +00:00
dependabot[bot]
db08466d35
build(deps-dev): bump rbs from 3.5.2 to 3.5.3 in /Library/Homebrew
Bumps [rbs](https://github.com/ruby/rbs) from 3.5.2 to 3.5.3.
- [Release notes](https://github.com/ruby/rbs/releases)
- [Changelog](https://github.com/ruby/rbs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ruby/rbs/compare/v3.5.2...v3.5.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-23 18:12:03 +00:00
dependabot[bot]
75d24d7bd9
build(deps-dev): bump sorbet in /Library/Homebrew
Bumps [sorbet](https://github.com/sorbet/sorbet) from 0.5.11535 to 0.5.11537.
- [Release notes](https://github.com/sorbet/sorbet/releases)
- [Commits](https://github.com/sorbet/sorbet/commits)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-23 18:11:27 +00:00
Mike McQuaid
72dec98721
Merge pull request #18138 from cho-m/gnu-tar-bottle 2024-08-23 17:22:16 +01:00
Mike McQuaid
c61b2557c2
Merge pull request #18139 from Homebrew/cask-url-type 2024-08-23 16:55:20 +01:00
Bo Anderson
0ae1dbeacf
Add typing for Cask#url and fix detected issues 2024-08-23 16:39:23 +01:00
Mike McQuaid
89a3473975
Merge pull request #18137 from cho-m/linux-note 2024-08-23 16:19:22 +01:00
Michael Cho
f627c70b71
dev-cmd/bottle: use default tar when bottling gnu-tar 2024-08-23 11:14:34 -04:00
Michael Cho
4d537fe6da
docs: use NOTE rather than NOTICE 2024-08-23 11:04:28 -04:00
Ruoyu Zhong
7bb07b88a4
Merge pull request #18136 from Homebrew/audit-typecheck
formula_auditor: fix typechecking failure
2024-08-23 17:31:32 +08:00
Carlo Cabrera
54f73e5ec8
formula_auditor: fix typechecking failure
Seen at Homebrew/homebrew-core#182065.

https://github.com/Homebrew/homebrew-core/actions/runs/10522724092/job/29156069899?pr=182065#step:3:44
2024-08-23 17:19:02 +08:00
Mike McQuaid
0a94d225b6
Merge pull request #18135 from Homebrew/sponsors-maintainers-man-completions 2024-08-23 08:37:09 +01:00
Mike McQuaid
d1e0c078bc
Merge pull request #18128 from cho-m/python-avoid-modifying-all-links 2024-08-23 08:07:45 +01:00
BrewTestBot
0267484403
Update manpage and completions.
Autogenerated by the [sponsors-maintainers-man-completions](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/sponsors-maintainers-man-completions.yml) workflow.
2024-08-23 07:07:41 +00:00
Mike McQuaid
69ae7eecd6
Merge pull request #18129 from cho-m/python-macos-linux-diffs 2024-08-23 08:07:25 +01:00