1652 Commits

Author SHA1 Message Date
Douglas Eichelberger
afbc1dab54 Clean up OnSystem rbis 2025-02-13 16:33:59 -08:00
Branch Vincent
3d7c6fa10f
utils/pypi: remove extra newline when updating resources 2025-02-08 09:43:47 -08:00
Adrian Ho
956b71eeed update-python-resources: add option to ignore errors
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
```
2025-02-06 21:20:55 +08:00
William Woodruff
46d67ba560
utils/pypi: warn when pypi_info fails due to missing sources
Signed-off-by: William Woodruff <william@yossarian.net>
2025-02-05 15:25:38 -05:00
Mike McQuaid
791194865f
Merge pull request #19188 from Homebrew/arm64_linux-tag
Rename aarch64_linux tag to arm64_linux
2025-02-03 13:21:59 +00:00
Markus Reiter
3e8709e4da
Use full terminal height for concurrent output. 2025-02-01 17:58:54 +01:00
Bo Anderson
fed5321969
Rename aarch64_linux tag to arm64_linux 2025-02-01 13:03:58 +01:00
zyoshoka
8aa22ea939
utils/github: fix GraphQL error log
The key `type` is not included in the response, making the log look weird.
2025-02-01 00:39:58 +09:00
zyoshoka
9e93b52371
utils/curl: fix user_agent types
`user_agent` should also allow strings and nil.
2025-01-30 19:20:58 +09:00
Michka Popoff
d436eb2e51
analytics: fix type error
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)
2025-01-26 16:30:30 +01:00
Caleb Xu
2373b6d586
utils: add check_binary_linkage function 2025-01-23 11:26:38 -05:00
Issy Long
66e50846e2
Only need a single, more readable, print_stderr 2025-01-22 22:03:28 +00:00
Issy Long
34b4cc796f
Early return if Shell#profile's preferred is nil 2025-01-22 22:01:34 +00:00
Issy Long
f3a68b616c
Early return in Tty#color? for nil @stream 2025-01-22 22:01:34 +00:00
Issy Long
599616e8e0
Apply easy to understand Sorbet typing corrections
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2025-01-22 22:01:34 +00:00
Issy Long
7a88125df0
The Style/AvoidDoubleNegation RuboCop is insistent 2025-01-22 22:01:34 +00:00
Issy Long
975a707b3c
Bump some utils/ files to Sorbet typed: strict 2025-01-22 22:01:34 +00:00
Sam Ford
d8125322e1
Curl: expand test coverage
This adds more tests to `curl_spec.rb` to increase test coverage.
This brings almost all of the methods that don't make network
requests up to 100% line and branch coverage (the exception being
some guards in `parse_curl_output` that shouldn't happen under
normal circumstances).

In the process of writing more tests for `parse_curl_response`, I
made some tweaks to remove checks for conditions that shouldn't ever
be true (e.g., `match["code"]` isn't optional, so it will be present
if `HTTP_STATUS_LINE_REGEX` matches) and to refactor some others. I
contributed this method a while back (9171eb2), so this is me coming
back to clarify some behavior.
2025-01-14 08:14:39 -05:00
Sam Ford
cf22382921
Curl: use typed: strict
This upgrades `utils/curl.rb` to `typed: strict`, which requires
a number of changes to pass `brew typecheck`. The most
straightforward are adding type signatures to methods, adding type
annotations (e.g., `T.let`) to variables that need them, and ensuring
that methods always use the expected return type.

I had to refactor areas where we call a `Utils::Curl` method and use
array destructuring on a `SystemCommand::Result` return value
(e.g., `output, errors, status = curl_output(...)`), as Sorbet
doesn't understand implicit array conversion. As suggested by Markus,
I've switched these areas to use `#stdout`, `#stderr`, and `#status`.
This requires the use of an intermediate variable (`result`) in some
cases but this was a fairly straightforward substitution.

I also had to refactor how `Cask::URL::BlockDSL::PageWithURL` works.
It currently uses `page.extend PageWithURL` to add a `url` attribute
but this reworks it to subclass `SimpleDelegator` and use an
`initialize` method instead. This achieves the same goal but in a way
that Sorbet can understand.
2025-01-14 08:14:39 -05:00
Issy Long
6ada9a9665
Add clarifying comments to rubocop:disables
- Needed for PR 18842 that adds a `DisableComment` RuboCop to ensure that all RuboCop disables have comments.
2025-01-12 16:59:07 +00:00
Issy Long
268f801038
Bump more files to Sorbet typed: strict 2025-01-11 00:11:27 +00:00
Daeho Ro
05b97cdc48
fix prerelease check to allow standard release 2024-12-27 19:22:04 +09:00
Daeho Ro
d50e872fd8
update prerelease check to allow standard release 2024-12-25 20:52:38 +09:00
Daeho Ro
ce25ac7be6
update prerelease check to allow standard release 2024-12-25 16:57:07 +09:00
Michael Cho
e9671db2d3
utils/github: handle over 30 changed files 2024-12-13 22:41:21 -05:00
Douglas Eichelberger
9e3e1e1847 Namespace some top-level constants 2024-12-11 11:04:55 -08:00
Bo Anderson
ccdf39ff4e
dev-cmd/tap-new: improve handling of multi-user setups 2024-12-10 05:24:10 +00:00
Ruoyu Zhong
a8a6a5bdb7
utils/service: simplify 2024-12-04 03:09:11 +08:00
Ruoyu Zhong
15146b2b67
utils/service: add systemd_quote helper
We need a way to escape systemd command lines properly as systemd treats
unrecognised escape sequences as separate literal characters. This helper
function does that.
2024-12-04 02:57:08 +08:00
Patrick Linnane
d04430d1a5
brew style --fix
Signed-off-by: Patrick Linnane <patrick@linnane.io>
2024-11-26 14:09:13 -08:00
Elijah Olmos
ba4dfb2664
Update Library/Homebrew/utils/github.rb
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2024-11-17 15:06:34 -07:00
Elijah Olmos
3922140f9a
push uncommitted code 2024-11-15 18:07:48 -07:00
Elijah Olmos
d068496aa5
chore: remove debug statement 2024-11-15 17:49:10 -07:00
Elijah Olmos
4653d5889e
fix: too_many_open_prs() fails without SSO access 2024-11-15 16:25:06 -07:00
Carlo Cabrera
1fbe4366a0
Support setting GIT_COMMITTER_NAME and GIT_COMMITTER_EMAIL
Our autobump workflow sets the author and committer to the user who
triggered the workflow, defaulting to @BrewTestBot for scheduled runs.

This can be confusing for maintainers when GitHub shows up as
"Unverified" because the commit is signed with @BrewTestBot's key.[^1]

Let's fix that by configuring our autobump workflow to always commit as
@BrewTestBot, so that the committer matches the GPG signature. To do
that, we need to add support for setting `GIT_COMMITTER_NAME` and
`GIT_COMMITTER_EMAIL`.

[^1]: See, for example, Homebrew/homebrew-core#197234.
2024-11-11 18:45:38 +08:00
Douglas Eichelberger
521c463e36
Manually resolve Style/SafeNavigationChainLength violations 2024-11-05 16:44:12 +00:00
Douglas Eichelberger
ffb15ffcf5
brew style --fix 2024-11-05 16:44:12 +00:00
Michael Cho
f82c58383c
utils/inreplace: allow non-global substitution
Also increase test coverage
2024-10-29 20:15:47 -04:00
Bo Anderson
ddfe04a601
Merge pull request #18516 from Homebrew/lockf-macos-15
utils/lock: use new lockf where available
2024-10-25 03:09:12 +01:00
Sam Ford
4ed2eb6811
curl: handle multiple Content-Type headers
`#curl_http_content_headers_and_checksum` contains code that works
with a `Content-Type` header in a response but it expects there to
always be only one header in the response. This is normally a
reasonable assumption but we've come across a server that is giving
a response with multiple `Content-Type` headers in the response, so
this produces an error and causes `brew audit` to fail when checking
the URL.

This works around the issue by naively using the last `Content-Type`
header in the response when there's more than one. It's not something
that should normally occur but this will handle the situation when it
does.
2024-10-19 18:02:06 -04:00
Carlo Cabrera
7a8f9fa489
extend/kernel: fix duplicate messages in GitHub Actions
Calls to `opoo` and `onoe` produce duplicate `Warning:` and `Error:`
messages in CI logs because we print something to stdout and print an
annotation. Annotations also produce `Error:` and `Warning:` lines in
the log.

Let's fix this by skipping printing the message if we've already printed
an annotation.
2024-10-14 12:15:24 +08:00
Bo Anderson
60a963a07e
utils/lock: use new lockf where available 2024-10-05 19:17:08 +01:00
Michael Cho
43ee408793
utils/curl: workaround curl bug for --head --request GET
The `curl --head --request GET` causes a full download to happen on
`curl` from 8.7.0 to 8.9.1[^1] which causes poor UX due to slow
Cask downloads that can take almost twice as long as they should.

[^1]: https://github.com/Homebrew/brew/issues/18213
2024-10-05 14:05:59 -04:00
Patrick Linnane
c2e2b23c50
brew style --fix
Signed-off-by: Patrick Linnane <patrick@linnane.io>
2024-10-02 10:03:12 -07:00
Bevan Kay
53e8739d24
utils/shared_audits: audit deprecate/disable reasons 2024-09-30 23:11:44 +10:00
Bob Lail
c752c00ac6 brew vendor-gems: commit updates. 2024-09-27 14:44:40 -07:00
Bo Anderson
567f5eb4be
Allow sockets to use longer paths on macOS 2024-09-27 04:37:03 +01:00
Mike McQuaid
94416e82f0
Add new odeprecated, odisabled, remove disabled code.
Prepare the usual deprecation cycle for Homebrew 4.4.0.
2024-09-24 10:15:34 +01:00
Mike McQuaid
1c390093f8
Revert "Limit usage of GitHub Actions Annotations" 2024-09-16 16:52:03 +01:00
Carlo Cabrera
c6e2cd9037
Limit usage of GitHub Actions Annotations
- only use annotations for `opoo` and `onoe` if
  `HOMEBREW_GITHUB_ACTIONS` is set. This will make using `brew` less
  noisy in GitHub Actions for third parties. See
  Homebrew/discussions#5602.
- if we've already called `puts_annotation_if_env_set`, then we no
  longer need to print the message to `$stderr`. The message from the
  annotation already show up in the GitHub Actions log, so printing to
  `$stderr` just leads to duplicate messages in the log.

While we're here, let's make sure to forward the `file:` and `line:`
kwargs of `puts_annotation_if_env_set` to the `Annotation` constructor.
2024-09-15 11:31:54 +08:00