3393 Commits

Author SHA1 Message Date
Bevan Kay
2b132c0802
dev-cmd/bump-formula-pr: fix reference 2025-04-22 22:03:18 +10:00
Bevan Kay
c5a3879fdb
bump: bump synced formula together 2025-04-22 22:03:06 +10:00
Mike McQuaid
7873f0200f
Revert "bump: bump synced formula together" 2025-04-22 12:33:59 +01:00
Bevan Kay
7ccdc340a3
bump: bump synced formula together 2025-04-16 22:49:14 +10:00
Mike McQuaid
e98a052896
dev-cmd/edit: remove unneeded variable. 2025-04-11 16:07:29 +01:00
Anatoli Babenia
fff2c3ea79 edit: move no_env and no_install checks out of the loop 2025-04-11 17:21:17 +03:00
Anatoli Babenia
ccf506f7f9 brew style --fix 2025-04-11 17:15:55 +03:00
Anatoli Babenia
7523daaf33 edit: review fixes
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2025-04-11 17:15:55 +03:00
Anatoli Babenia
a0e68613f5 Fix false/Boolean type check
https://sorbet.org/docs/error-reference#7001
2025-04-11 17:15:55 +03:00
Anatoli Babenia
9bf4e620e0 edit: show --build-from-source only for formulas 2025-04-11 17:15:55 +03:00
Anatoli Babenia
fb5438bfd1 Update Library/Homebrew/dev-cmd/edit.rb
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2025-04-11 17:15:54 +03:00
Anatoli Babenia
fc0d7ac21d dev-cmd/edit: Actionable message about no API install 2025-04-11 17:15:54 +03:00
Rafael Gallani
ef13b69b03
dev-cmd/create: handle nil stdin 2025-04-11 08:48:54 +01:00
Bo Anderson
5ff37113ff
dev-cmd/vendor-gems: fix incorrect Bundler version being used 2025-04-09 19:35:13 +01:00
Sam Ford
99681d7fbc
bump-cask-pr: replace "host" naming with "current"
`Homebrew::SimulateSystem.current_os` may be returning the host OS or
a simulated OS and we can't be sure which in this context. At the
moment, this is expected to be the host OS but that may change in the
future. It shouldn't matter on a technical level but using "host" in
these variable names may lead to confusion.

This replaces "host" in names with "current", as it more accurately
describes the information.
2025-04-06 10:58:47 -04:00
Sam Ford
b7065d5fcf
bump-cask-pr: extract system_options generation
This extracts the logic for generating the `system_options` array in
the `replace_version_and_checksum` method into a separate
`generate_system_options` method. This logic is becoming more complex
(after recent changes) and manually testing it is a pain, so this
change is intended to allow us to add tests. The tests added here
provide 100% coverage for the method.
2025-04-06 10:58:46 -04:00
Sam Ford
6f06afbc11
bump-cask-pr: respect depends_on arch
This reworks the `SimulateSystem` args in the `bump-cask-pr`
`replace_version_and_checksum` method to respect `depends_on arch`
values in casks. That is to say, we shouldn't simulate Intel for a
cask using `depends_on arch: :arm64` and we shouldn't simulate ARM if
the cask uses `depends_on arch: :x86_64`.

In the process, this refactors how we collect/combine OS/arch values.
To make this approach work predictably, I removed the logic that
omits OS values matching the host OS (as `SimulateSystem` already
handles this). The `[{ os:, arch: }]` hash format only made sense when
we were omitting values, so this returns to the previous
`[[os, arch]]` array format (to align with the
`OnSystem::ALL_OS_ARCH_COMBINATIONS` array format).
2025-04-06 10:58:46 -04:00
Sam Ford
ed48426a33
tests: support :needs_arm, :needs_intel metadata
This adds the ability to specify tests that depend on a certain CPU
architecture using `:needs_arm` or `:needs_intel`, similar to the
existing `:needs_macos` and `:needs_linux` metadata for tests that
depend on a certain OS.
2025-04-04 09:17:32 -04:00
Sam Ford
612fec47f3
bump-cask-pr: rescue CaskUnreadableError
The `replace_version_and_checksum` method handles a `CaskInvalidError`
when loading a cask (handling casks that aren't valid on Linux) but
we can sometimes still encounter an error when bumping a cask with
on_system blocks. For example, bumping `displaylink` will produce a
`Cask 'displaylink' is unreadable: undefined method 'csv' for nil`
error when `SimulateSystem` runs as Linux, as the cask interpolates
`version.csv.first` in a `license` string but `version` isn't set on
Linux.

This adds `Cask::CaskUnreadableError` to the `rescue` arguments,
which accounts for this particular situation (allowing `displaylink`
to be bumped like before).
2025-04-03 17:56:48 -04:00
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