Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow linux binaries in casks #19121

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

SMillerDev
Copy link
Member

@SMillerDev SMillerDev commented Jan 19, 2025

  • 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 for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

That was actually easier than expected.

TODO:

  • Add --zap support for Linux

TODO in the future:

  • Fix macOS casks showing in search on linux
  • API support
  • Remove OnSystem::MacOSOnly

@SMillerDev SMillerDev force-pushed the feat/cask/bin_install branch from ddf1c8e to 852e228 Compare January 19, 2025 16:38
@SMillerDev SMillerDev changed the title feat: allow linux blocks in casks feat: allow linux binaries in casks Jan 19, 2025
@SMillerDev
Copy link
Member Author

Okay, as far as I can tell from https://sorbet.org/docs/class-of this should work since NeverSudoSystemCommand is a child of SystemCommand.

I'm also fine removing the types, but that seems counterproductive.

@Rylan12
Copy link
Member

Rylan12 commented Jan 20, 2025

In order to generate the linux variations in the API, I believe you'll need to update the #each loop in to_hash_with_variations for casks. This line:

MacOSVersion::SYMBOLS.keys.product(OnSystem::ARCH_OPTIONS).each do |os, arch|

should become something like this (copied from the formula equivalent):

OnSystem::ALL_OS_ARCH_COMBINATIONS.each do |os, arch|

This may cause problems until on_linux/on_macos blocks have been added to homebrew/cask since that change would cause API generation task to load every cask as Linux, so this might be something for the future.

@SMillerDev
Copy link
Member Author

I'm planning to finish this up without API support, make some casks compatible and then do the API and the removal of the MacOSVersion logic.

@SMillerDev SMillerDev force-pushed the feat/cask/bin_install branch from 852e228 to 37e6183 Compare January 27, 2025 20:47
@apainintheneck
Copy link
Contributor

That sounds fine.

@SMillerDev SMillerDev force-pushed the feat/cask/bin_install branch from 37e6183 to 2e9165a Compare January 28, 2025 17:08
@SMillerDev SMillerDev force-pushed the feat/cask/bin_install branch from 2e9165a to 29e28d1 Compare January 28, 2025 17:23
@SMillerDev SMillerDev marked this pull request as ready for review January 28, 2025 17:50
@SMillerDev
Copy link
Member Author

One more thing to keep in mind before we make this widely available, and I'd like @MikeMcQuaid to weigh in on that one:

What do we want to do with existing casks? Mark all of binary-only casks as depends_on :macos? Or should we somehow have a DSL that marks them as linux-compatible?

@p-linnane
Copy link
Member

I think we should add depends_on :macos to existing casks. That would match how we do it in Homebrew/core.

@MikeMcQuaid
Copy link
Member

What do we want to do with existing casks? Mark all of binary-only casks as depends_on :macos? Or should we somehow have a DSL that marks them as linux-compatible?

What does binary-only or "allow Linux binaries" mean in the context of this PR, I'm a bit confused. What casks are expected to work or not work after this is merged?

@SMillerDev
Copy link
Member Author

After this PR, casks that only have binary or zap will be installable on Linux*. Obviously most of the casks that meet those criteria would be binaries that only work on macOS. So we need some way to prevent that.

  • they are installable only if you don't use the API and explicitly pass --cask

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.

5 participants