-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
cask: skip variations for inapplicable versions #17386
Conversation
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.
Looking good so far! Will wait for @dduugg to chime in here!
c712902
to
2d00e50
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.
This makes more sense to me, thanks @EricFromCanada!
Good to 🚢 if @carlocab is 👍🏻
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.
💯
This seems to have broken variation support: https://github.com/orgs/Homebrew/discussions/5448. Likely because Are you able to take a look or would you prefer a revert? |
I will take a look. |
Looks like this is the case. When run on Monterey or older: $ HOMEBREW_NO_INSTALL_FROM_API=1 brew info --cask macupdater | head -n 1
==> macupdater: 2.3.15 (auto_updates)
$ HOMEBREW_NO_INSTALL_FROM_API= brew info --cask macupdater | head -n 1
==> macupdater: 3.3.1 (auto_updates) All the currently-affected casks are fixed by these two commits in Homebrew/homebrew-cask#176710, but that's on hold while I look into how to a) update cask/audit.rb to not complain about For now, removing this line will fix the noted behaviour for the affected casks. Both the line mentioned above and the audit issues before that are affected by the inability to determine if code is being run inside an on_os block or not. All I've found so far is checking if they exist with |
You could modify the We should fix the audit indeed, though backwards compatibility with the previous way of handling |
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?When running
to_hash_with_variations
on a cask, its min/max macOS version requirements aren’t considered which may result in::or_older
- anki, hammerspoon:or_older
, which results in null values being inserted into the variations list - apparency, omnidisksweeper, saoimageds9, sf-symbolsdepends_on
key if specified as a list - calhashThe first two are solved by checking if each bottle tag is included in the cask’s range of macOS requirements, which itself required adding
MacOSRequirement.allows?
to check if a macOS requirement allows a given macOS version.The last occurs because each call in
cask.rb
ofpublic_send(hash_method).each do |key, value|
gets a different result fordepends_on
, because the stock inspect method of theMacOSVersion
class includes a random hex value, resulting in it being included in the hash every time. Customizing theinspect
method to just print the class’s version value avoids this.This change also highlights complications like how some casks' on_system blocks don't line up with their macOS version requirements, e.g.:
depends_on
being inside on_system blocks - airfoildepends_on
excluding entire on_system blocks - appcleanerThere are probably others, but these can be manually resolved in time.