3424 Commits

Author SHA1 Message Date
Sam Ford
38410f5432
bump-cask-pr: fix macOS host handling
`bump-cask-pr` was recently updated to add Linux support but the
change to the `replace_version_and_checksum` logic has broken the
command for casks that have on_system blocks that reference specific
macOS versions (e.g., `on_monterey :or_newer` in `logi-options+`).

The previous logic only simulated the arch, so the `current_os` value
on macOS was a specific version like `:sequoia`. The current logic
uses generic `:macos` values, which work for `on_macos` blocks but
don't work for blocks like `on_sequoia`, etc. This leads to an
`undefined method 'latest?' for nil` error, as `old_cask.version` is
`nil` in this scenario (i.e., none of the on_system blocks apply to
`:macos`, so `version` is never set).

This updates the method to only specify the OS in `system_options` if
the value doesn't align with the host (e.g., `:linux` on macOS),
which restores the previous behavior.

This also replaces `:macos` values with the newest macOS version
(e.g., `:sequoia`), so that `bump-cask-pr` on Linux can update casks
with on_system blocks that reference specific macOS versions. A
generic `:macos` value doesn't work with those on_system blocks, so
`version` is never called on Linux in that scenario but it works as
expected if we use the newest macOS value instead. This may not be
perfect but it brings `bump-cask-pr` a little closer to parity with
macOS on Linux.

Lastly, this skips `system_options` values where `old_cask` has no
version, as this means the cask doesn't apply to that OS/arch. We've
been seeing a related error on homebrew/cask autobump CI and this
guard should help to avoid it.
2025-04-03 17:56:47 -04:00
Mike McQuaid
8937beb3a1
Merge pull request #19688 from Homebrew/unbottled-linux-arch
dev-cmd/unbottled: check arch requirement on Linux
2025-04-03 15:11:49 +00:00
Michael Cho
053fa14fc2
dev-cmd/unbottled: check arch requirement on Linux 2025-04-03 10:01:07 -04:00
botantony
aa86fcc9b3
dev-cmd/bump: suggestions from MikeMcQuaid
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
Signed-off-by: botantony <antonsm21@gmail.com>
2025-04-02 17:23:09 +02:00
botantony
e3875f790e
dev-cmd/bump: add --no-auto flag
I do not like that `brew bump` command checks every single formula/cask,
even ones updated by BrewTestBot. Instead of showing useful info about
outdated packages, my terminal buffer is fludded with `Formula is
autobumped so will have bump PRs opened by BrewTestBot every ~3 hours`.
This flag excludes autobumped packages before checking them.

Signed-off-by: botantony <antonsm21@gmail.com>
2025-04-02 16:44:44 +02:00
Patrick Linnane
39afba427e
Merge pull request #19670 from Homebrew/bump_warn_unofficial_taps
dev-cmd/bump-*: only warn on duplicate PRs for official taps.
2025-04-01 16:18:22 +00:00
Mike McQuaid
7250624b56
dev-cmd/bump-cask-pr: fix Linux cask bumping.
- Remove check for `cask.depends_on.macos` as it seems to be always
  present and set to at least >=10.11
- When we've specified multiple architectures, allow casks to be invalid
  on some architectures.
2025-04-01 12:07:16 +01:00
Mike McQuaid
108ecf9aac
dev-cmd/bump-*: only warn on duplicate PRs for official taps.
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.
2025-04-01 11:01:17 +01:00
Sean Molenaar
faddb73204
Merge pull request #19510 from Homebrew/feat/bump-cask/on_linux
feat: add linux support to bump-cask-pr
2025-03-31 13:30:34 +00:00
Douglas Eichelberger
138eba20f8
Merge pull request #19618 from Homebrew/formula-url-getter
fix: Allow Formula.url with no args to get url
2025-03-28 17:31:45 +00:00
Douglas Eichelberger
e58486cd4c
fix: Allow Formula.url with no args to get url 2025-03-26 12:15:25 -07:00
Anatoli Babenia
202e52ded4
Update Library/Homebrew/dev-cmd/create.rb
Co-authored-by: Adrian Ho <the.gromgit@gmail.com>
2025-03-26 21:32:05 +03:00
Anatoli Babenia
901f9166f9 create: show command to install formula for testing 2025-03-26 21:12:00 +03:00
Mike McQuaid
1ce12ae6e5
Merge pull request #19575 from Homebrew/brew_bundle_filtering
Don't filter the environment for `brew bundle (exec|env|sh)`
2025-03-25 09:07:39 +00:00
Carlo Cabrera
40588b0ad9
dev-cmd/dispatch-build-bottle: support arm64 Linux
This will make it easier to dispatch bottle builds for arm64 Linux.
2025-03-25 11:03:37 +08:00
Mike McQuaid
6e20cedb67
Don't filter the environment for brew bundle (exec|env|sh)
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.
2025-03-24 13:37:25 +00:00
Mike McQuaid
7a57af242e
Cleanup some missing references to Homebrew Bundle.
Let's just call it `brew bundle` from now on as it's a normal command.

Also, fix a reference to "Homebrew Services" while we're here.
2025-03-19 09:51:39 +00:00
Sean Molenaar
4f7e45881d feat: add linux support to bump-cask-pr 2025-03-17 12:08:27 +01:00
Sean Molenaar
7687ae3891 feat: add linux support to bump-cask-pr 2025-03-17 11:58:00 +01:00
Carlo Cabrera
4066542b27
dev-cmd/prof: fix vernier invocation
`--allocation_sample_rate` was renamed to `--allocation_interval` in 8ffadb304f
2025-03-13 18:17:18 +08:00
Douglas Eichelberger
fcf18912fe
Inline use of attr_predicate 2025-03-02 21:36:03 -08:00
Douglas Eichelberger
a81239ec2d
Enable strict typing in Formula 2025-02-24 10:23:42 -08:00
Michael Cho
05d3ce85cd
dev-cmd/bottle: check for prefix when not /usr/local
Fixes incorrectly marking bottles as relocatable, e.g.

425d4ea43d/Formula/p/pkgconf.rb (L34-L36)

This cannot be done for `/usr/local` as it is used outside Homebrew.
Other default prefixes are Homebrew-specific.
2025-02-23 14:28:31 -05:00
botantony
35dcf8e362
creator: add zig option 2025-02-21 15:05:42 +01:00
Adrian Ho
7e946c19a2 update-python-resources: work on bare formula
Also favor Homebrew API over manual string comparison.

Resolves https://github.com/orgs/Homebrew/discussions/5967.
2025-02-21 10:32:39 +08:00
Douglas Eichelberger
8763fb6d29 Resolve rubocop violations 2025-02-17 18:56:31 -08:00
Adrian Ho
987363da15 clear core tap cache on formula creation
Addresses inability to find just-created formula, see https://github.com/Homebrew/brew/pull/19244#issuecomment-2646030394 for context.
2025-02-11 11:41:15 +08:00
Mike McQuaid
6f99704a64
Import brew formula-analytics and generate-analytics-api commands
Import these from the homebrew/formula-analytics tap and deprecate
that tap.

This required a little messing around with filenames and paths to get
it finding Python and writing to the user's home directory.
2025-02-07 20:05:05 +00:00
Mike McQuaid
9e3ae9f3f9
Merge pull request #19251 from Homebrew/revert-json-v3-logic
Revert json v3 logic
2025-02-07 08:32:22 +00:00
apainintheneck
f916f27d82 remove all references to JSON v3
The logic has now been removed in previous commits. This just
removes some references to the `HOMEBREW_INTERNAL_JSON_V3`
environment variable along with reverting the changes to the
`Cachable` class that were originally added in
bd72ec812c3ed656dfcf8e24f77df142a1fe9cc1.
2025-02-06 21:04:08 -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
apainintheneck
839198d21e Remove JSON v3 formula logic 2025-02-05 23:36:57 -08:00
apainintheneck
042d6cc97e Remove JSON v3 cask logic 2025-02-05 23:32:32 -08:00
Patrick Linnane
291edf5d30
docs: rewording
Co-authored-by: Carlo Cabrera <github@carlo.cab>
2025-02-05 13:39:27 +01:00
Eric Knibbe
99de228fc2
docs: various manpage grammar fixes 2025-02-05 13:38:39 +01:00
Mike McQuaid
510a1503c8
Merge pull request #19217 from Homebrew/ww/brew-verify
dev-cmd: add brew verify
2025-02-04 15:24:19 +00:00
William Woodruff
b35cb75e53
Update Library/Homebrew/dev-cmd/verify.rb
Co-authored-by: Douglas Eichelberger <697964+dduugg@users.noreply.github.com>
2025-02-04 13:02:25 +01:00
Bo Anderson
627c4a714c
dev-cmd/pr-upload: allow --keep-old with --upload-only 2025-02-03 18:15:31 +01:00
William Woodruff
0ceddc91ce
code review
Signed-off-by: William Woodruff <william@yossarian.net>
2025-02-03 17:12:11 +01:00
William Woodruff
06d0f59a29
Apply suggestions from code review
Co-authored-by: Douglas Eichelberger <697964+dduugg@users.noreply.github.com>
2025-02-03 17:08:55 +01:00
William Woodruff
f7557ae9fe
strict typechecking
Signed-off-by: William Woodruff <william@yossarian.net>
2025-02-03 16:28:46 +01:00
William Woodruff
77f55aab05
dev-cmd: add brew verify
This is a direct copy of `trailofbits/homebrew-brew-verify`,
but in the `DevCmd` namespace instead.

Signed-off-by: William Woodruff <william@yossarian.net>
2025-02-03 16:23:09 +01:00
Nanda H Krishna
a49e7d9483
dev-cmd/livecheck: improve error message when all formulae are autobumped 2025-02-03 12:43:17 +01:00
Bo Anderson
f727d07d43
dev-cmd/bottle: don't install gnu-tar when not needed 2025-01-31 10:57:47 +01:00
Mike McQuaid
7ff99e2353
Use ~ instead of ${HOME}
Partial revert of Homebrew/brew#19153
See https://github.com/Homebrew/brew/pull/19153#discussion_r1930678587
2025-01-27 15:19:59 +00:00
Mike McQuaid
bbf5a9f479
env_config: use environment variables consistently
- use e.g. `$HOMEBREW_*` for cases where only the environment variable
  is the entire backtick-quoted string
- use e.g. `${HOMEBREW_*}` for cases where the environment variable is
  part of a backtick-quoted string to make clear what parts are variable
  and what parts are not
- use `export HOMEBREW_*=...` for cases where we're talking about
  setting the environment variable (because it likely needs to be
  exported to work how they want)

Inspired by https://github.com/Homebrew/homebrew-bundle/pull/1579 making
similar changes for Homebrew/homebrew-bundle.
2025-01-27 14:21:27 +00:00
Mike McQuaid
9cc9dd8760
dev-cmd/tests: disable forcing brew wrapper in tests.
Otherwise, various integration tests will fail under some
configurations.
2025-01-23 16:06:23 +00:00
Nanda H Krishna
22da03e887
Fix type errors 2025-01-22 01:45:19 +05:30
Nanda H Krishna
f69478bc1d
dev-cmd/bump-formula-pr: automatically bump matched-version resources 2025-01-22 01:39:41 +05:30
Issy Long
4c9de7d31c
Merge pull request #19084 from Homebrew/add-comments-to-rubocop-disables
Add clarifying comments to `rubocop:disable`s
2025-01-13 11:32:31 +00:00