
`bump-cask-pr` was recently updated to add Linux support but the change to the `replace_version_and_checksum` logic has broken the command for casks that have on_system blocks that reference specific macOS versions (e.g., `on_monterey :or_newer` in `logi-options+`). The previous logic only simulated the arch, so the `current_os` value on macOS was a specific version like `:sequoia`. The current logic uses generic `:macos` values, which work for `on_macos` blocks but don't work for blocks like `on_sequoia`, etc. This leads to an `undefined method 'latest?' for nil` error, as `old_cask.version` is `nil` in this scenario (i.e., none of the on_system blocks apply to `:macos`, so `version` is never set). This updates the method to only specify the OS in `system_options` if the value doesn't align with the host (e.g., `:linux` on macOS), which restores the previous behavior. This also replaces `:macos` values with the newest macOS version (e.g., `:sequoia`), so that `bump-cask-pr` on Linux can update casks with on_system blocks that reference specific macOS versions. A generic `:macos` value doesn't work with those on_system blocks, so `version` is never called on Linux in that scenario but it works as expected if we use the newest macOS value instead. This may not be perfect but it brings `bump-cask-pr` a little closer to parity with macOS on Linux. Lastly, this skips `system_options` values where `old_cask` has no version, as this means the cask doesn't apply to that OS/arch. We've been seeing a related error on homebrew/cask autobump CI and this guard should help to avoid it.
Library
This directory contains all the code run by the official brew
command in Homebrew
and all formulae (package descriptions) in taps (repositories containing formulae) in Taps
subdirectories.