fix(caveats): avoid showing Rosetta 2 caveat on Intel machines #21475
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.
Summary
When a cask uses the
requires_rosettabuilt-in caveat, markon_system_blocks_existon the DSL so that architecture variations are properly computed during API JSON generation.Problem
Intel Mac users see the Rosetta 2 caveat when installing casks via the API, even though Rosetta 2 is only needed on Apple Silicon Macs. This happens because:
requires_rosettacaveat includes the Rosetta warning in the base JSONon_system_blocks_exist?isfalse(therequires_rosettacaveat didn't set it)Solution
Call
@cask.mark_on_system_blocks_exist!in therequires_rosettacaveat to ensure architecture variations are computed. This means:nil(correct - will override the base)When the cask is loaded on an Intel machine via the API,
merge_variationswill apply the Intel variation which has no Rosetta caveat.Test
All changed-file tests pass with
brew tests --changed.Fixes #18365