Skip to content
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

cmd/fetch & cmd/audit: handle unsupported cask os/arch combos #15956

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions Library/Homebrew/cmd/fetch.rb
Expand Up @@ -166,8 +166,8 @@ def self.fetch
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

Expand Down
9 changes: 8 additions & 1 deletion Library/Homebrew/dev-cmd/audit.rb
Expand Up @@ -242,10 +242,17 @@
next [] if os == :linux

SimulateSystem.with os: os, arch: arch do
simulated_cask = Cask::CaskLoader.load(path)

Check warning on line 245 in Library/Homebrew/dev-cmd/audit.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/dev-cmd/audit.rb#L245

Added line #L245 was not covered by tests

if simulated_cask.url.nil?
opoo "Cask #{cask} is not supported on os #{os} and arch #{arch}"
next []

Check warning on line 249 in Library/Homebrew/dev-cmd/audit.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/dev-cmd/audit.rb#L249

Added line #L249 was not covered by tests
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".
Expand Down