1728 Commits

Author SHA1 Message Date
Mike McQuaid
a1f112f3fe
Move o* output methods to Utils::Output
This reduces the surface area of our `Kernel` monkeypatch and removes
the need to `include Kernel` in a bunch of modules.

While we're here, also move `Kernel#require?` to `Homebrew` and fully
scope the calls to it.
2025-08-20 19:20:19 +01:00
Carlo Cabrera
17435f583f
utils/wrapper.sh: fix source calls
We need to `source utils/helpers.sh` before calling `odie`. We also
don't need to `source utils/wrapper.sh` again here, because we are
already in `utils/wrapper.sh`.
2025-08-19 12:21:03 +08:00
Carlo Cabrera
145c65d811
Merge remote-tracking branch 'origin/main' into stricter-brew-wrappers 2025-08-18 18:41:19 +08:00
Carlo Cabrera
83d8a4118b
Move all wrapper checks to utils/wrapper.sh 2025-08-18 18:29:52 +08:00
Mike McQuaid
24057cc9a5
Merge pull request #20485 from SMillerDev/feat/audit/codeberg_audit
feat: audit codeberg repos
2025-08-18 07:50:25 +00:00
Sean Molenaar
b19ad2e796 feat: audit codeberg repos 2025-08-17 17:08:33 +02:00
Douglas Eichelberger
0e064fdc3a
Type remaining Kernel log extensions 2025-08-16 13:07:19 -07:00
Eric Knibbe
827480f06b
messages/comments: wording fixes 2025-08-16 00:57:59 -04:00
Carlo Cabrera
ead3af9feb
Deduplicate odie calls into utils/wrapper.sh 2025-08-16 09:31:57 +08:00
Carlo Cabrera
d9c661a34e
Fix brew style errors 2025-08-13 18:07:17 +08:00
Carlo Cabrera
a4ea97016a
Improve error handling when determining parent process path 2025-08-13 17:54:29 +08:00
Carlo Cabrera
e8828c152d
Apply review suggestions for pid_path.rb
Co-authored-by: MikeMcQuaid <125011+MikeMcQuaid@users.noreply.github.com>
2025-08-13 13:55:33 +08:00
Rylan Polster
0f9fb4f29a
Use API helper methods 2025-08-12 17:04:15 -04:00
Rylan Polster
ff5edb73c2
Don't query analytics for third-party formulae/casks in brew info 2025-08-11 18:54:09 -04:00
Rylan Polster
480eeb4246
Enable download queue for single formula/cask API fetches 2025-08-11 00:43:34 -04:00
Carlo Cabrera
a7c124c2d0
brew.sh: enforce HOMEBREW_FORCE_BREW_WRAPPER more strictly
`HOMEBREW_FORCE_BREW_WRAPPER` can be used as a security/compliance
feature, but allowing it to be disabled by setting
`HOMEBREW_NO_FORCE_BREW_WRAPPER` leaves a pretty large hole in it that
allows it to be sidestepped.

Let's fix that by actually checking the path of the process that called
`brew`, and the verify that that path matches the configured value of
`HOMEBREW_NO_FORCE_BREW_WRAPPER`.
2025-08-09 03:15:53 +08:00
Ruoyu Zhong
e8a892e2b0
utils/spdx: use refs/tags/ URL to fetch SPDX data 2025-08-08 16:01:51 +08:00
Eric Knibbe
6255263b51
output: express environment variables consistently 2025-08-04 09:50:06 -04:00
Carlo Cabrera
fb35add3b6
Replace ensure_formula_installed! with Formula#ensure_installed!
`ensure_formula_installed!` requires the `Formula` class to be loaded
before being called to work properly.

Let's guarantee that instead by implementing it as an instance method of
the `Formula` class.

See discussion at #20358.
2025-08-02 03:43:37 +08:00
Carlo Cabrera
cc5df09845
Ensure we require "formula" before doing ensure_formula_installed!
This is needed to avoid Sorbet runtime errors. See #20352.
2025-08-02 02:46:38 +08:00
Mike McQuaid
e3c3f5a356
Deprecate/disable/remove code for Homebrew 4.6
The next minor release will be Homebrew 4.6.0 so let's do the usual
deprecation/disable/remove code cycle.
2025-07-31 12:13:01 +01:00
Bo Anderson
888746ef54
utils/gems: use Homebrew-specific gem spec cache 2025-07-31 05:42:40 +01:00
Douglas Eichelberger
157992be17
Enable strict typing in Cask::Audit 2025-07-30 12:43:32 -07:00
Bo Anderson
1974b8c24c
Downgrade to Bundler 2.6.8 2025-07-25 17:06:11 +01:00
Bo Anderson
406b9c029b
Fix forbidding special license refs 2025-07-24 23:37:31 +01:00
botantony
5450e730ed
Audit no_autobump! reason for new packages
Signed-off-by: botantony <antonsm21@gmail.com>
2025-07-17 17:12:33 +02:00
Patrick Linnane
f19dc4556e
Merge pull request #20265 from Homebrew/portable-ruby-3.4.5
Portable Ruby 3.4.5
2025-07-16 16:23:11 +00:00
Patrick Linnane
af304da633
Portable Ruby 3.4.5
Signed-off-by: Patrick Linnane <patrick@linnane.io>
2025-07-16 08:58:14 -07:00
William Woodruff
78f3fdeed9
Merge branch 'main' into py3-whl 2025-07-16 11:32:22 -04:00
Matt Coster
41fce10dde
Ignore IP allow list errors in too_many_open_prs
Fixes https://github.com/orgs/Homebrew/discussions/6263. Even when SAML
passes, an IP allow list can still restrict access to organization
repos.
2025-07-16 13:52:39 +01:00
Mike McQuaid
be806e4350
Merge pull request #20218 from Homebrew/add-update-perl-resources
feat: add `update-perl-resources` dev-cmd
2025-07-15 08:28:04 +00:00
Patrick Linnane
4513a43d53
Fix RuboCop failures.
Co-authored-by: Patrick Linnane <patrick@linnane.io>
Co-authored-by: Carlo Cabrera <github@carlo.cab>
Co-authored-by: Thierry Moisan <thierry.moisan@gmail.com>
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2025-07-14 19:12:38 +01:00
Daeho Ro
04dcca8834
feat: update perl api and refactor name and regex 2025-07-14 21:20:00 +09:00
Daeho Ro
f89ead08c3
feat: add update-perl-resources dev-cmd 2025-07-06 16:23:31 +09:00
Mike McQuaid
f2103c7138
utils/github/api: fix Sorbet types.
Let's not use `T.unsafe(nil)` but instead an empty hash.
2025-06-17 14:59:46 +01:00
Mike McQuaid
7345607ca0
a*.rb: move to strict Sorbet sigil.
Co-authored-by: Rylan Polster <rslpolster@gmail.com>
2025-06-17 08:18:33 +01:00
Alex Gaynor
efa0c9554a fixes #19828 -- added a strict parameter to GitHub::check_for_duplicate_pull_requests 2025-06-12 08:45:16 -04:00
Dustin Rodrigues
3578b84053
utils/pypi: fix style issue 2025-06-10 00:59:28 -04:00
Dustin Rodrigues
e8f4a8e1a7
utils/pypi: further update pure Python wheel detection 2025-06-10 00:49:11 -04:00
Mike McQuaid
dc71b7c8f6
Cleanup extend/ directory usage.
- move some things out of `extend` that don't really fit there e.g.
  `Module`s that are included but not doing any
  overriding/monkeypatching
- move some code into `extend/os` to fix all remaining
  `rubocop:todo Homebrew/MoveToExtendOS`s
- remove some unneeded `bundle` skipper code that doesn't really make
  sense given our current bottling strategy
- extract some `Pathname` extensions to `extend/pathname` for separate
  files
- move a `ENV` `Kernel` extension into `kernel.rb`
- `odeprecate` a seemingly unused backwards compatibility method
- move `readline_nonblock` from a monkeypatch to a
  `ReadlineNonblock.read` method as its only used in one place
- fix up a link in documentation
2025-06-09 19:06:16 +01:00
Mike McQuaid
cc03340af3
Reduce Homebrew/brew CI warnings
- Remove a bunch of non-actionable/unnecessary noise in GitHub Actions
  CI.
- Limit number of threads used to generate analytics API data to avoid
  reproducible failures producing errors and requiring retries.
- Move to Debian Old Stable for testing non-system `glibc`.
- Remove unneeded core taps/updates.
- Improve naming of CI jobs to clarify purpose i.e. we're testing
  things work on Linux, not Ubuntu specifically.
- Remove dedicated non-online/non-generic Linux `brew tests` jobs from
  3 to 1.

Co-authored-by: Rylan Polster <rslpolster@gmail.com>
2025-06-09 12:47:22 +01:00
Mike McQuaid
5fe43ed3f2
brew (bundle|) sh: use user's configuration but override prompts.
This was more painful that I expected but will allow `brew bundle sh`
and `brew sh` to use the user's configuration but use our custom prompt
for Bash and ZSH.
2025-06-05 15:43:34 +01:00
Dustin Rodrigues
073903958f
utils/pypi: update pure Python wheel detection 2025-05-31 21:12:27 -04:00
Mike McQuaid
4aa7f83954
dev-cmd/bump-formula-pr: use Formatter.truncate.
Add new `Formatter.truncate` method, tests and use it.
2025-05-21 17:02:18 +01:00
Dustin Rodrigues
5593a5cab9
utils/pypi: ensure pure Python wheels support py3 2025-05-20 23:14:14 -04:00
Mike McQuaid
7173f1fb60
utils/spdx: do case insensitive comparison.
Various places that use SPDX licenses specify them as downcased strings
so let's be more permissive in our comparisons/validations.
2025-05-20 12:12:55 +01:00
Mike McQuaid
faf27ae35f
utils/github: improve PR creation error message.
This may help with debugging why this has failed.
2025-05-06 10:11:10 +01:00
Patrick Linnane
c6a2fa335d
brew style --fix 2025-05-05 14:35:08 -07:00
Sam Ford
69dcbacb71
shared_audits: prevent duplicate eol_data fetches
The `eol_data` method uses `@eol_data["#{product}/#{cycle}"] ||=`,
which can unncessarily allow a duplicate API call if the same
product/cycle combination was previously tried but returned a 404
(Not Found) response. In this scenario, the value would be `nil` but
the existing logic doesn't check whether this is a missing key or a
`nil` value. If the key is present, we shouldn't make the same
request again.

This updates the method to return the existing value if the key
exists, which effectively prevents duplicate fetches. This new logic
only modifies `@eol_data` if `curl` is successful, so it does allow
the request to be made again if it failed before.

That said, this shouldn't normally be an issue and this is mostly
about refactoring the method to allow for nicer code organization.
This approach reduces the `begin` block to only the `JSON.parse` call,
which allows us to use `return unless result.status.success?` (this
previously led to a RuboCop offense because it was called within a
`begin` block).
2025-05-03 21:15:11 -04:00
Sam Ford
85684f43bd
Update eol_data for API changes
The endoflife.date API has been updated, so this modifies the URL in
`SharedAudits.eol_data` to use the up to date URL and modifies the
related logic in `FormulaAuditor.audit_eol` to work with the new
response format. Specifically, there is now an `isEol` boolean value
and the EOL date is found in `eolFrom`.

One wrinkle of the new setup is that 404 responses now return HTML
content even if the request includes an `Accept: application/json`
header. This handles these types of responses by catching
`JSON::ParserError` but ideally we would parse the response headers
and use `Utils::Curl.http_status_ok?` to check for a good response
status before trying to parse the response body as JSON.
2025-05-03 12:26:54 -04:00