test_runner_formula: treat versioned macOS deps as macOS-only#22420
Merged
MikeMcQuaid merged 5 commits intoMay 26, 2026
Conversation
|
Thanks for your pull request. This has been closed because it appears to use an incomplete or outdated pull request template. Please edit the pull request body to fill in the current pull request template. This workflow will reopen the pull request automatically once the template is complete. |
7 tasks
A formula with only `depends_on macos: :sequoia` (no bare `depends_on :macos`) is still macOS-only -- a versioned `MacOSRequirement` cannot be satisfied on Linux. Before this change, `macos_only?` only returned true for the unversioned form, so new macOS-only formulae using only the versioned form would dispatch Linux ARM64 runners. The `Homebrew/OSDependsOn` cop added in Homebrew#22199 flags the bare `depends_on :macos` as redundant whenever a versioned `depends_on macos:` is present, so the two forms are now mutually exclusive in practice. This change keeps the dispatcher consistent with the cop's expectation.
931a965 to
bbfb1a2
Compare
MikeMcQuaid
reviewed
May 26, 2026
Member
MikeMcQuaid
left a comment
There was a problem hiding this comment.
Thanks! We have new DSLs for this that we missed using here, can you see if this works instead?
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
Contributor
Author
@MikeMcQuaid seems all work. I accepted your suggestions. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TestRunnerFormula#macos_only?currently returns true only for an unversioneddepends_on :macos. With #22199 theHomebrew/OSDependsOncop now flags the bare form as redundant whenever a versioneddepends_on macos:is also present, so the two forms are mutually exclusive in formulae. After that change, a new macOS-only formula whose canonical form is justdepends_on macos: :sequoiareportsmacos_only? == false, sobrew determine-test-runnersschedules Linux ARM64 runners that then fail (e.g.swift: No such file or directory).This drops the
!r.version_specified?clause so anyMacOSRequirement-- versioned or not -- counts as macOS-only. Linux cannot satisfy a versionedMacOSRequirementeither, so the broader behaviour is consistent.Reproducer: Homebrew/homebrew-core#282141 (a new macOS-only formula with
depends_on macos: :sequoiaonly). The existing fix campaign in homebrew-core#282148 did not surface this because all affected formulae already had bottles, sosetup_runnerswas skipped.Spec updates:
needs_modern_compiler.macos_only?flips fromfalsetotrue;needs_modern_compiler.linux_compatible?flips fromtruetofalse. No other expectations change.brew lgtm(style, typechecking and tests) with your changes locally?Diagnosis and patch drafted with Claude. The conflict between
OSDependsOnandmacos_only?was identified while investigating a CI failure on a new macOS-only formula; the one-line dispatcher fix and spec updates were verified locally withbrew tests --only=test_runner_formula,brew style, andbrew typecheck.