3424 Commits

Author SHA1 Message Date
Sam Ford
3df8f70511
OnSystem: Add UsesOnSystem class
This adds a `UsesOnSystem` class to `OnSystem`, containing boolean
instance variables to indicate which types of on_system methods are
used in a formula or cask. This is intended as a replacement for
`@on_system_blocks_exist`, which doesn't allow us to determine what
kinds of on_system calls were used. This provides more granularity
but we can still use `@uses_on_system.present?` to determine whether
any on_system calls were used (and this doubles as a `nil` check in
`Formula`, as the `self.class` instance variable has to use a nilable
type).

The `UsesOnSystem` instance variables cover the current
`ARCH_OPTIONS` and `BASE_OS_OPTIONS`. At the moment, we mostly need
to tell whether there are macOS/Linux or Intel/ARM on_system calls,
so I've omitted instance variables for specific macOS version until
we have a need for them.

As a practical example, if you wanted to determine whether a cask
uses Linux on_system calls, you can call
`cask.uses_on_system.linux?`. The `linux` boolean will be `true` if
the cask has an `on_linux` block, an `on_system` block (which requires
Linux), or uses `os linux: ...`. This is something that would be
challenging to determine from outside of `OnSystem` but it's
relatively easy to collect the information in `OnSystem` methods and
make it available like this.
2025-06-07 17:58:12 -04:00
Rylan Polster
73b64390b3
Use existing Utils::Bottles::Collector#specification_for method 2025-06-05 12:38:15 -04:00
Rylan Polster
e83dc1cb3c
Fallback to older bottle hashes when viable 2025-06-05 11:32:47 -04:00
Rylan Polster
e47bc2fb86
Use hashes of arrays instead 2025-06-05 03:15:44 -04:00
Rylan Polster
b44ec56267
Reduce the internal formula API to contain the bare minimum data 2025-06-05 02:08:29 -04:00
Mike McQuaid
68ef29fb5c
Merge pull request #20045 from Homebrew/fix-sharded-api
Fix sharded API structure to match existing API
2025-06-04 07:58:26 +00:00
Rylan Polster
fa45209f09
Fix sharded API structure to match existing API 2025-06-03 16:58:47 -04:00
Eric Knibbe
3dc9e88542
parser: show related env var in switch description 2025-06-03 13:57:42 -04:00
Rylan Polster
c03f70f1dc
Refactor OnSystem and SimulateSystem bottle tag handling 2025-06-03 11:57:17 -04:00
Rylan Polster
0f03757e8f
Shard JSON API by OS/Arch combination 2025-06-02 23:06:02 -04:00
Bevan Kay
6278ac1801
Merge branch 'master' into cabal 2025-05-29 22:44:20 +10:00
Mike McQuaid
3f15e0eef0
dev-cmd/bump-formula-pr: fix style. 2025-05-26 08:40:14 +01:00
Gibson Fahnestock
97acfb94ce
bump-pr: respect --write-only flag and skip git operations
The flag used to work well, but at some point started to run more and
more git actions. We use this to update formula and casks in other
homebrew taps, and it works well except for this issue.
2025-05-24 13:14:00 +01: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
Issy Long
63cdd0723c
Truncate long release notes in formula PR descriptions
- Some formula bumps have really long release notes which causes their
  bump PRs to exceed GitHub's 65k character limit for issue bodies.
2025-05-21 13:20:48 +00:00
Mike McQuaid
8b32d019d4
Merge pull request #19986 from Homebrew/fix_update_maintainers
dev-cmd/update-maintainers: various fixes.
2025-05-21 12:42:38 +00:00
Issy Long
ee15435a90
Fix multiline hash key/value indentation 2025-05-21 14:31:58 +02:00
Mike McQuaid
c1a2f94e01
dev-cmd/tap-new: fix root_url warning.
Ruby couldn't detect the `root_url` usage inside the ERB template.
Instead, use interpolation so it can for a fixed warning and more concise
syntax.
2025-05-21 13:19:11 +01:00
Mike McQuaid
a94037a6ff
dev-cmd/update-maintainers: various fixes.
- install the `man` gem group for `kramdown` so
  `Manpages.regenerate_man_pages` can run successfully
- hardcode the non-organisation PLC members so that they aren't
  missing from the GitHub team
- correctly populate the PLC members again
2025-05-21 13:08:37 +01:00
Douglas Eichelberger
38bad25a86
Include annotations in typecheck updates 2025-05-20 20:56:53 -07:00
Bevan Kay
effb07ee76
bump-formula-pr: fix case when only url is provided 2025-05-20 21:23:52 +10:00
botantony
92832c258c
dev-cmd/create: add --cabal switch
Signed-off-by: botantony <antonsm21@gmail.com>
2025-05-18 20:18:34 +02:00
Eric Knibbe
2b8d104281
dev-cmd/generate-*-api: simulate latest macOS 2025-05-15 11:06:24 -04:00
Steve Peters
3dd87e6d17 dev-cmd/prof: require fileutils
Fixes error when running `brew prof`:
uninitialized constant Homebrew::DevCmd::Prof::FileUtils
2025-05-08 13:41:11 -07:00
botantony
18296808a2 dev-cmd/bump-*-pr: change autobump package message
Signed-off-by: botantony <antonsm21@gmail.com>
2025-04-29 18:04:59 +02:00
botantony
562c104b7e dev-cmd/bump: replace --no-auto with --no-autobump
Signed-off-by: botantony <antonsm21@gmail.com>
2025-04-29 18:04:59 +02:00
botantony
ad66e0c418 tap: get autobump list from formula/cask API
Signed-off-by: botantony <antonsm21@gmail.com>
2025-04-29 18:04:59 +02:00
Alexander Bayandin
d60e72a055 dev-cmd/tap-new: use ERB templates instead of string interpolation 2025-04-28 23:57:44 +01:00
Alexander Bayandin
875702d51a dev-cmd/tap-new: support private repos 2025-04-28 18:07:19 +01:00
Bevan Kay
b255a670c0
bump-formula-pr: restore pr message 2025-04-23 14:45:15 +10:00
Patrick Linnane
5d8d453a90
Portable Ruby 3.4.3 2025-04-22 11:50:08 -07:00
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