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

Formula should be able to depend on cask #17326

Closed
1 task done
agowa opened this issue May 17, 2024 · 2 comments
Closed
1 task done

Formula should be able to depend on cask #17326

agowa opened this issue May 17, 2024 · 2 comments
Labels
features New features outdated PR was locked due to age

Comments

@agowa
Copy link

agowa commented May 17, 2024

Verification

Provide a detailed description of the proposed feature

Currently a formula cannot have a dependency on a cask. Like e.g. "MaciASL" one. Furthermore I noticed some quirks when trying to use it anyway.
Writing depends_on "maciasl" => [:build, :cask] resulted in brew info showing that dependency as maciasl --cask (which made me think that this was the correct way of specifying it and that it was supported) but when trying to build it did this instead. Here the strange thin is that the cask is named maciasl, it says it looked for formulae and casks with that name but then suggests to install macchina and macast instead? It even outputs maciasl (which should have been an exact match)...:

Warning: No available formula with the name "maciasl" (dependency of qemu). Did you mean macchina?
==> Searching for similarly named formulae and casks...
==> Formulae
macchina

To install macchina, run:
  brew install macchina

==> Casks
macast                                     maciasl                                    macpass

To install macast, run:
  brew install --cask macast

What is the motivation for the feature?

using the maciasl cask as a build/optional dependency within a formula

How will the feature be relevant to at least 90% of Homebrew users?

There are a bunch of questions about doing exactly this on stackoverflow, so others clearly have the same issue.
e.g. https://stackoverflow.com/questions/35461948/syntax-for-a-homebrew-formula-depending-on-a-cask, https://stackoverflow.com/questions/52370449/formula-dependency-for-homebrew, https://unix.stackexchange.com/questions/449138/brew-formula-how-can-i-define-cask-and-external-dependencies,

What alternatives to the feature have been considered?

crude hacks like:

def install
  # Resolve cask dependencies
  system "/usr/local/bin/brew", "cask", "install", "osxfuse"
@agowa agowa added the features New features label May 17, 2024
@MikeMcQuaid
Copy link
Member

As you've noted: formulae cannot depend on casks, by design.

The closest equivalent to this would be to create a Requirement.

@MikeMcQuaid MikeMcQuaid closed this as not planned Won't fix, can't repro, duplicate, stale May 17, 2024
@carlocab
Copy link
Member

See https://github.com/gromgit/homebrew-fuse/blob/ac8384ee5e8592e24b953621fbcdd1de61bf0f05/require/macfuse.rb for an example of creating a Requirement similar to the one you need.

@github-actions github-actions bot added the outdated PR was locked due to age label Jun 17, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
features New features outdated PR was locked due to age
Projects
None yet
Development

No branches or pull requests

3 participants