From 8c2f101138a00a90a410e5a1be1f300ed634e95c Mon Sep 17 00:00:00 2001 From: apainintheneck Date: Sat, 2 Sep 2023 01:33:39 -0700 Subject: [PATCH] cmd/fetch: handle nil cask urls These urls can be nil if there is an unsatisfied macos version requirement. We check for false here because either the macos requirement can be satisfied and return true or can not be specified and return nil. If it's not specified, it means it can run on any macos version. The change in Cask::Download should provide better error messages in Downloadable but honestly we're better off just checking for the missing url higher up the call stack which is why I made the changes in the fetch command. Either way it seemed like a good idea while I'm here. --- Library/Homebrew/cask/download.rb | 2 ++ Library/Homebrew/cmd/fetch.rb | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/Library/Homebrew/cask/download.rb b/Library/Homebrew/cask/download.rb index 976e440dee..6912edceda 100644 --- a/Library/Homebrew/cask/download.rb +++ b/Library/Homebrew/cask/download.rb @@ -24,6 +24,8 @@ module Cask sig { override.returns(T.nilable(::URL)) } def url + return if cask.url.nil? + @url ||= ::URL.new(cask.url.to_s, cask.url.specs) end diff --git a/Library/Homebrew/cmd/fetch.rb b/Library/Homebrew/cmd/fetch.rb index 569239ad19..de6751ad6c 100644 --- a/Library/Homebrew/cmd/fetch.rb +++ b/Library/Homebrew/cmd/fetch.rb @@ -167,6 +167,11 @@ module Homebrew SimulateSystem.with os: os, arch: arch do cask = Cask::CaskLoader.load(ref) + if cask.depends_on.macos&.satisfied? == false + opoo "#{cask.token}: #{cask.depends_on.macos.message(type: :cask)}" + next + end + quarantine = args.quarantine? quarantine = true if quarantine.nil?