Skip to content

airfil: use os_version #204987

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

Closed
wants to merge 15 commits into from
Closed

airfil: use os_version #204987

wants to merge 15 commits into from

Conversation

SMillerDev
Copy link
Member

Important: Do not tick a checkbox if you haven’t performed its action. Honesty is indispensable for a smooth review process.

In the following questions <cask> is the token of the cask you're submitting.

After making any changes to a cask, existing or new, verify:

Additionally, if adding a new cask:

  • Named the cask according to the token reference.
  • Checked the cask was not already refused (add your cask's name to the end of the search field).
  • brew audit --cask --new <cask> worked successfully.
  • HOMEBREW_NO_INSTALL_FROM_API=1 brew install --cask <cask> worked successfully.
  • brew uninstall --cask <cask> worked successfully.

This should make all these casks readable on linux, which means we can run readall on linux after

@SMillerDev
Copy link
Member Author

Since all of these are in a livecheck block, maybe we can just hardcode the macOS version? The problem is that there is no MacOS.version on Linux, so readall fails on that.

CC @samford and @nandahkrishna for ideas.

Copy link
Member

@nandahkrishna nandahkrishna left a comment

Choose a reason for hiding this comment

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

Ideally, we wouldn't have the livecheck URL be anything that evaluates differently on different hardware – we want livecheck to return consistent results no matter where it is run, and it should return the latest version of the software (accounting for any throttling, I guess). So in that sense, I guess it might make sense to hardcode the macOS version or rely on a URL that doesn't use this information wherever possible.

On the other hand, if the Linux and macOS version numbers are themselves different, I imagine we'd have to make a lot more changes to livecheck itself.

Copy link
Member

@samford samford left a comment

Choose a reason for hiding this comment

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

I agree that it would be ideal for livecheck blocks to be consistent regardless of environment but unfortunately I don't think that's feasible (I have some in-progress work to add OS/arch simulation to livecheck but that's a different story). Besides these macOS-dependent checks, we have livecheck blocks where the url/regex interpolates arch and I think that's reasonable.

What we don't want here is for a non-macOS version to be used in place of a macOS version if the check is executed in a non-macOS environment (e.g., a Linux version on Linux), so os_version may not be an appropriate substitution here. [The other issue is that os_version uses MacOS.full_version but some of these instances use MacOS.version, so we would need something like os_version&.major for those.]

With that in mind, one alternative may be to keep the existing livecheck blocks but move them into an on_mac block in these cases where the url/regex/etc. depend on the macOS version. That would ensure the livecheck block is only available in an appropriate context (aligning with use of macOS on_os blocks). Does that work as expected on Linux?

I haven't tested casks on Linux but I imagine we may also run into issues when required values like version, url, etc. are only defined in macOS on_os blocks.


For what it's worth, we specifically replaced hardcoded macOS versions with MacOS methods because no one was manually keeping them up to date (where necessary) and some eventually stopped returning new versions (i.e., only returning an old version that's suitable for the old macOS version, not the newest version of the software). The other reason is that it allows us to have one livecheck block that works for multiple macOS versions. If we hardcode the value, we would have to copy the livecheck block into each of the on_os blocks and that would increase the maintenance burden.

@SMillerDev
Copy link
Member Author

With that in mind, one alternative may be to keep the existing livecheck blocks but move them into an on_mac block in these cases where the url/regex/etc. depend on the macOS version. That would ensure the livecheck block is only available in an appropriate context (aligning with use of macOS on_os blocks). Does that work as expected on Linux?

That might be possible. Really the main problem right now is that a brew readall for the cask repo on Linux will fail because it can't deal with MacOS.version. So to make all casks readable on linux we need to come up with a way to replace this call.

@p-linnane
Copy link
Member

Let's reopen this when we're ready, since we're just accumulating conflicts.

@p-linnane p-linnane closed this Apr 2, 2025
@EricFromCanada EricFromCanada deleted the fix/general/use_os_version branch May 26, 2025 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants