- 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
- 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>
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.
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).
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.
The default behaviour is too strict for unofficial taps. We can still
warn elsewhere but, given the potential for false positives, let's
loosen things a bit.
- do some optimisation of `require`s before Bootsnap
- remove `HOMEBREW_BOOTSTRAP` environment variable as it's set by
default
- add fast require in `bootsnap.rb` using logic from `ruby.sh`
- cleanup `bootsnap.rb` a bit
- remove setting `HOMEBREW_BOOTSNAP` in GitHub Actions
It's both unexpected and undesirable for `brew bundle (exec|env|sh)` to
filter the environment and makes these tools less useful.
Not filtering the environment, though, causes issues with the
`brew bundle sh` shell. Fix this up and, while we're here, also improve
the formatting for both `zsh` and `bash` (the default) to use nicer and
more consistent prompts and colours.
To simplify this, consolidate some logic in a new
`Utils::Shell.shell_with_prompt` method and add tests for it and a
similar notice for `brew bundle sh`.
Finally, avoid printing out the notice when `HOMEBREW_NO_ENV_HINTS` is
set.
`Livecheck::Strategy.page_headers` uses `Utils::Curl.curl_headers` but
the method only handles `HEAD` and `GET` requests. I recently added
`POST` support to livecheck but forgot to update `curl_headers` in the
process, so `livecheck` blocks using the `HeaderMatch` strategy along
with `post_form` or `post_json` will fail because curl doesn't allow
both `--head` and `--data`/`--json` arguments.
This addresses the issue by updating `curl_headers` to handle `POST`
requests and skip the `GET` retry logic.
This is particularly useful for third-party Python formulae that have a ton of resources, not all of which may adhere to homebrew/core's strict policies. See #19240 for context.
I've also added logic that ignores `--ignore-errors` on `homebrew/core`, although I personally think this new behavior is also useful for mainline formula creation.
Before: error out on a single non-conforming resource, zero resource blocks added to formula, scary stacktrace.
After: all conforming resources added, all non-conforming resources identified in comments, error message at end, `brew` exits non-zero without scary stacktrace:-
```
% brew update-python-resources --ignore-errors gromgit/test/auto-coder || echo OOPS
==> Retrieving PyPI dependencies for "auto-coder==0.1.243"...
==> Retrieving PyPI dependencies for excluded ""...
==> Getting PyPI info for "aiohappyeyeballs==2.4.4"
[200+ resource lines elided]
==> Getting PyPI info for "zhipuai==2.1.5.20250106"
==> Updating resource blocks
Error: Unable to resolve some dependencies. Please check /opt/homebrew/Library/Taps/gromgit/homebrew-test/Formula/auto-coder.rb for RESOURCE-ERROR comments.
OOPS
% brew cat gromgit/test/auto-coder | ggrep -C10 RESOURCE-ERROR
license "Apache-2.0"
depends_on "python@3.11"
# Additional dependency
# resource "" do
# url ""
# sha256 ""
# end
# RESOURCE-ERROR: Unable to resolve "azure-cognitiveservices-speech==1.42.0" (no suitable source distribution on PyPI)
# RESOURCE-ERROR: Unable to resolve "ray==2.42.0" (no suitable source distribution on PyPI)
resource "aiohappyeyeballs" do
url "e4373e888f/aiohappyeyeballs-2.4.4.tar.gz"
sha256 "5fdd7d87889c63183afc18ce9271f9b0a7d32c2303e394468dd45d514a757745"
end
resource "aiohttp" do
url "952d49c730/aiohttp-3.11.12.tar.gz"
sha256 "7603ca26d75b1b86160ce1bbe2787a0b706e592af5b2504e12caa88a217767b0"
end
```
Fixes:
Error: Parameter 'days': Expected type String, got type Integer with value 30
Caller: /opt/homebrew/Library/Homebrew/utils/analytics.rb:273
Definition: /opt/homebrew/Library/Homebrew/utils/analytics.rb:412 (Utils::Analytics.table_output)