-
-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Make os
available in livecheck
blocks
#19700
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
Conversation
f9f7359
to
2aa6816
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, thanks!
I got very excited and thought you provided a way of detecting which OS is supported by a Cask with a single method. If I can nerd-snipe you into doing that next: I'd be delighted 😉
Casks now support an `os` DSL method, similar to `arch`. This makes it available in `livecheck` blocks, like we do with `arch`.
This adds the ability to specify tests that depend on a certain CPU architecture using `:needs_arm` or `:needs_intel`, similar to the existing `:needs_macos` and `:needs_linux` metadata for tests that depend on a certain OS.
This adds tests for the livecheck DSL's `version` and `arch` delegates. This doesn't affect test coverage but it ensures that the methods work as expected in `livecheck` blocks.
2aa6816
to
8d52d9b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the super fast turnaround on this @samford! 😄
The latest push reworks the
Unfortunately, I think that will require some heavy lifting (per the latter part of #19689 (comment)). I don't think there's anything in the cask DSL that's guaranteed to explicitly provide that information based on how it's currently used.
If we add
I think making minimum macOS dependencies (i.e., oldest allowed) explicit instead of implicit would get us most of the way there (and it's arguably the right thing to do with casks not being macOS-only now). No promises but I'll try to dig into it when I have time (unless someone wants to beat me to it). |
I think the way |
That would handle explicit indicators but, as mentioned, we have casks that support an arch/os without any explicit indication. We can better identify supported OSs if we:
That setup would technically allow us to assume that the absence of a Arch is harder because we can't rely on [Side note: I'm working on a PR to modify |
I think at least handling those with explicit indicators better would be a good starting point. CC @SMillerDev for thoughts on the above |
That would be my starting point as well. The only ones that are not explicitly for a single platform are, in order of popularity: font, artifact and the shell completions. In my mental model you can therefore assume that: if a cask contains something other then those and has no |
I'm working on providing more granular booleans for on_system usage, so we will be able to tell if a formula/cask uses OS- and arch-specific on_system calls. The general idea is that we can set specific boolean values (for ARM, Intel, macOS, and Linux) in place of I'm currently approaching this as a class (with an Edit: PR can be found at #19721 |
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?Casks now support an
os
DSL method, similar toarch
. This makes it available inlivecheck
blocks, like we do witharch
.Besides that, this also adds tests for the
version
andarch
delegate methods in thelivecheck
block DSL. This doesn't affect test coverage but it ensures that the methods work as expected inlivecheck
blocks. For what it's worth, it was necessary to useCask::Cask.new
in these tests, as the delegate methods don't work when using the existingCask::CaskLoader.load
approach (for whatever reason).Related to Homebrew/homebrew-cask#207471.