Skip to content

Make Linux cask requirements explicit#21909

Open
MikeMcQuaid wants to merge 1 commit intomainfrom
hide-uncertain-linux-casks
Open

Make Linux cask requirements explicit#21909
MikeMcQuaid wants to merge 1 commit intomainfrom
hide-uncertain-linux-casks

Conversation

@MikeMcQuaid
Copy link
Copy Markdown
Member

@MikeMcQuaid MikeMcQuaid commented Apr 3, 2026

  • stop surfacing casks on Linux unless supports_linux? says they are safe to advertise, so search and bundle stay conservative about unknown support
  • move cask platform output into a Requirements section so brew info explains macOS-only casks the same way on macOS and Linux
  • reuse requires macOS in brew bundle for both brew and cask entries so platform warnings use the same language across commands
  • cover the shared policy with regressions around search, cask/info, bundle/skipper, and Cask#supports_linux?

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests (excluding integration tests) for your changes? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) with your changes locally?

  • AI was used to generate or assist with generating this PR. Please specify below how you used AI to help you, and what steps you have taken to manually verify the changes.

Used OpenAI Codex but with local testing, review and editing.


Copilot AI review requested due to automatic review settings April 3, 2026 20:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to avoid advertising macOS-only (or otherwise unconfirmed) casks on Linux by centralizing the decision on Cask::Cask#supports_linux?, so commands like brew search, brew bundle, and brew info --cask behave consistently across Linux.

Changes:

  • Add an OS-extension hook (ignore_cask?) to Homebrew::Search and use it to filter cask search results on Linux.
  • Introduce a Cask::Info.platform_support_status hook and implement Linux-only "Unsupported on Linux." output via extend/os.
  • Update Linux brew bundle skipper logic to use supports_linux? instead of installer stanza checks, and add targeted specs.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
Library/Homebrew/test/search_spec.rb Adds a regression spec around hiding casks (currently via stubbing).
Library/Homebrew/test/cask/info_spec.rb Adds a regression spec for printing a platform support status line.
Library/Homebrew/test/cask/cask_spec.rb Adds a spec asserting supports_linux? is false unless explicitly declared.
Library/Homebrew/search.rb Adds ignore_cask? hook and filters cask search results; loads OS extension.
Library/Homebrew/extend/os/search.rb Loads Linux search extension on Linux.
Library/Homebrew/extend/os/linux/search.rb Linux implementation of ignore_cask? using supports_linux?.
Library/Homebrew/extend/os/linux/bundle/skipper.rb Switches Linux cask skipping to supports_linux? and refactors messaging.
Library/Homebrew/cask/info.rb Adds platform_support_status hook and prints it when present; loads OS extension.
Library/Homebrew/extend/os/cask/info.rb Loads Linux cask info extension on Linux.
Library/Homebrew/extend/os/linux/cask/info.rb Linux implementation printing "Unsupported on Linux." when supports_linux? is false.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@MikeMcQuaid MikeMcQuaid force-pushed the hide-uncertain-linux-casks branch 2 times, most recently from 8067afc to 20e19db Compare April 5, 2026 11:41
@MikeMcQuaid MikeMcQuaid changed the title Hide unsupported Linux casks Make Linux cask requirements explicit Apr 5, 2026
- stop surfacing casks on Linux unless `supports_linux?`
  says they are safe to advertise, so `search` and
  `bundle` stay conservative about unknown support
- move cask platform output into a `Requirements`
  section so `brew info` explains macOS-only casks the
  same way on macOS and Linux
- reuse `requires macOS` in `brew bundle` for both
  `brew` and `cask` entries so platform warnings use the
  same language across commands
- cover the shared policy with regressions around
  `search`, `cask/info`, `bundle/skipper`, and
  `Cask#supports_linux?`
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

else
requirement.display_s
end
installed = requirement.satisfied?
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When running on Linux for a macOS-only cask (supports_linux? is false), MacOSRequirement#satisfied? can return true when a version is specified (because the requirement is treated as "macOS … (or Linux)"). As a result, brew info may show the macOS requirement as satisfied (✔) on Linux, which is misleading. Consider forcing the requirement to be shown as unsatisfied unless OS.mac? (e.g., gate the installed value on OS.mac? when requires_macos is true).

Suggested change
installed = requirement.satisfied?
installed = requires_macos ? (OS.mac? && requirement.satisfied?) : requirement.satisfied?

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants