107 Commits

Author SHA1 Message Date
Sam Ford
764d2b2dcc
Add HOMEBREW_MACOS_NEWEST_SUPPORTED env var
We have a `HOMEBREW_MACOS_NEWEST_UNSUPPORTED` environment variable
and this is used in `MacOSVersion` to determine prerelease versions
but we don't have a way of easily determining the newest supported
macOS version.

`bump-cask-pr` contains logic that assumes the first key/value in
`MacOSVersion::SYMBOLS` is the newest macOS version but it recently
became clear that this is a prerelease version between WWDC and the
subsequent macOS release. Similarly, `dev-cmd/generate-cask-api.rb`
tries to compute the newest stable macOS version as
`HOMEBREW_MACOS_NEWEST_UNSUPPORTED.to_i - 1` and this will fail
if/when we update that variable to `"26"`, as the macOS version
before 26 is 15, not 25.

This adds a `HOMEBREW_MACOS_NEWEST_SUPPORTED` environment variable,
so we have a straightforward way of quickly identifying the newest
supported macOS version without having to make potentially unreliable
assumptions or do computations to identify the latest non-prerelease
`MacOSVersion` value. This also updates the two aforementioned areas
to use this environment variable to produce the newest stable macOS
version symbol in a more reliable way.
2025-06-14 18:45:25 -04: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
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
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
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
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
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
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
Issy Long
268f801038
Bump more files to Sorbet typed: strict 2025-01-11 00:11:27 +00:00
Douglas Eichelberger
e1fdd2eda4 Enable strict typing in NamedArgs 2024-12-03 17:43:22 -08:00
Rui Chen
7655a6f91a
chore: remote_repo -> remote_repository
Signed-off-by: Rui Chen <rui@chenrui.dev>
2024-09-25 09:52:41 -04: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
fe909c41b8
Improve duplicate pull request handling
- change the messaging depending on how confident we are that we're
  actually looking at duplicates i.e. we're not confident without a
  version number supplied
- similarly, just warn instead of failing with an error (and no
  override) if we're not confident that we're looking at duplicates
  because a version wasn't supplied
- change `bump-cask-pr` and `bump-formula-pr` to always check for all
  pull requests with the new version number (to allow failing on this)
  rather than only checking closed pull requests with a version number
- change `bump` to check for definite/maybe duplicate PRs and only
  exit if they are definitely duplicates
- cleanup some variable usage to DRY things up a bit
2024-08-30 14:21:42 +01:00
Mike McQuaid
712ca361d7
dev-cmd/bump*: improve autobump messaging.
Let's make it clearer _why_ autobumped PRs cannot be submitted by humans
and, while we're here, similarly for disabled/head-only packages.
2024-05-31 10:23:13 +01:00
Mike McQuaid
222fe8ef0b
Homebrew 4.3.0 deprecation/disable/removals.
The usual pass of deprecating/disabling/removing code for the next
minor Homebrew release.
2024-05-07 12:18:04 +01:00
Mike McQuaid
27f47bafbc
dev-cmd/bump-cask-pr: use FromContentLoader when relevant.
When loading from `tmp_contents` in `bump-cask-pr` we're always loading
from the contents and not from a e.g. filename etc. As a result, skip
the detection of the correct loader (as the regex can be a bit flaky)
and instead use `FromContentLoader` directly.
2024-04-08 13:25:59 +01:00
Douglas Eichelberger
c50fb2dbd2 Remove redundant cli/parser requires 2024-03-29 18:53:07 -07:00
Mike McQuaid
fe16b14479
dev-cmd/bump*: limit the number of open PRs to 15.
Don't let users open more than 15 PRs at a time. We have other tooling
to nudge them to not do this but let's put it in the worst offenders:
the `bump*` commands.
2024-03-28 11:56:25 +00:00
Douglas Eichelberger
ebc458a7fe Port Homebrew::DevCmd::BumpCaskPr 2024-03-20 10:16:17 -07:00
Mike McQuaid
ea2892f8ee
brew.rb: handle missing args. 2024-03-07 16:20:20 +00:00
Michael Cho
12d1e56ff5
dev-cmd/bump: skip autobump formulae & casks
Instead output a message that corresponding formula/cask is on the
autobump list. This avoids deferring the information to the error
message within `bump-{formula,cask}-pr`.

Signed-off-by: Michael Cho <michael@michaelcho.dev>
2024-03-06 12:34:29 -05:00
Michka Popoff
f96290eb39
bump-formula|cask-pr: do not allow to bump autobumped packages
Avoids:
- Bumping stuff by mistake that will get autobumped anyway
- Abusing the system to get "free" commits
2024-03-01 09:15:43 +00:00
Mike McQuaid
7df07b991b
dev-cmd/bump*: do not allow forcing multiple PRs.
If there are duplicate PRs: we shouldn't suggest and allow a trivial
override. Instead, they should be created manually.

An undocumented override exists for BrewTestBot to do autobumps.
2024-02-15 17:02:31 +00:00
Bo Anderson
b42256d286
Deprecate, disable & delete code for Homebrew 4.2.0 2023-12-07 23:42:13 +00:00
Mike McQuaid
395ea6b261
Merge pull request #16274 from Bo98/bump-cask-pr-dup-check-fix
bump-cask-pr: fix duplicate PR checking with comma versions
2023-11-30 11:52:15 +00:00
Bo Anderson
0aae1fa6ae
bump-cask-pr: fix duplicate PR checking with comma versions 2023-11-30 02:49:07 +00:00
Bo Anderson
5e1f40467b
dev-cmd/bump-cask-pr: fix --sha256 2023-11-30 02:47:06 +00:00
Douglas Eichelberger
0191af7899 resolve typecheck errors 2023-11-05 08:55:58 -08:00
Bo Anderson
26ea6b7f9e
Pull in REXML gem as it doesn't ship with Ruby 3 2023-10-27 20:24:10 +01:00
apainintheneck
c033a4673c dev-cmd/bump-cask-pr: replace url before downloading files
Previously it was possible for both the version and url to be changed.
This would cause the old url to be used to download the cask and check
the checksum since the version and checksum were replaced in the cask
first and then the url would be replaced. This meant that the resulting
checksum was wrong if a url was provided and might be completely
invalid if it was interpolated.
2023-10-23 19:22:46 -07:00
Bo Anderson
3b1c171184
Further split up Gemfile into groups 2023-09-27 17:33:44 +01:00
Razvan Azamfirei
705c466bbd
bump-cask-pr: comment out odeprecated 2023-09-11 09:13:43 -04:00
Razvan Azamfirei
33375ae938
rename class and reorganize files 2023-07-25 06:41:38 -04:00
Razvan Azamfirei
c64c834d05
bump-cask-pr: add arch-specific version support 2023-07-21 11:45:34 -04:00
Mike McQuaid
1db83cd4a9
dev-cmd/bump-cask-pr: fix install_bundler_gems! logic. 2023-07-18 12:18:19 +01:00
Mike McQuaid
3247b2ecfa
dev-cmd/bump-*-pr: avoid installing gems when unneeded.
Fixes #15686
2023-07-18 10:48:11 +01:00
Bo Anderson
367f716a08
dev-cmd/audit: don't audit every tap with given named packages 2023-07-04 16:08:04 +01:00
Bo Anderson
bb7aef85db
Migrate remaining no-api commands to new scoped system 2023-06-22 17:11:20 +01:00
Markus Reiter
0d56b97b07
Add SimulateSystem::with. 2023-05-14 01:45:04 +02:00
Eric Knibbe
5f6b626880
bump-cask-pr: convert URL back to string 2023-04-25 18:11:36 -04:00
Douglas Eichelberger
24cf6076e8 brew style --fix 2023-04-24 20:42:39 -07:00
Razvan Azamfirei
3d5c4aaf50
add check that hash is a string 2023-04-18 23:14:48 -04:00