Merge pull request #15956 from apainintheneck/handle-nil-urls-in-fetch-and-audit-cmds

cmd/fetch & cmd/audit: handle unsupported cask os/arch combos
This commit is contained in:
Mike McQuaid 2023-09-05 16:53:43 -04:00 committed by GitHub
commit e4397255e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View File

@ -166,8 +166,8 @@ 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)}"
if cask.url.nil?
opoo "Cask #{cask} is not supported on os #{os} and arch #{arch}"
next
end

View File

@ -242,10 +242,17 @@ module Homebrew
next [] if os == :linux
SimulateSystem.with os: os, arch: arch do
simulated_cask = Cask::CaskLoader.load(path)
if simulated_cask.url.nil?
opoo "Cask #{cask} is not supported on os #{os} and arch #{arch}"
next []
end
odebug "Auditing Cask #{cask} on os #{os} and arch #{arch}"
Cask::Auditor.audit(
Cask::CaskLoader.load(path),
simulated_cask,
# For switches, we add `|| nil` so that `nil` will be passed
# instead of `false` if they aren't set.
# This way, we can distinguish between "not set" and "set to false".