formula_auditor: fix false positive in audit_gcc_dependency.

Fixes Homebrew/homebrew-core#110178.
This commit is contained in:
Carlo Cabrera 2022-09-11 01:41:32 +08:00
parent 2d0c32fa91
commit 2af5a974c2
No known key found for this signature in database
GPG Key ID: C74D447FC549A1D0

View File

@ -881,11 +881,14 @@ module Homebrew
bottle_tag = Utils::Bottles::Tag.new(system: macos_version, arch: arch)
next unless bottle_tag.valid_combination?
variation = variations[bottle_tag.to_sym]
# This variation does not exist, so it must match Linux.
return false if variation.blank?
variation_dependencies = variations.dig(bottle_tag.to_sym, "dependencies")
# This variation either:
# 1. does not exist
# 2. has no variation-specific dependencies
# In either case, it matches Linux.
return false if variation_dependencies.blank?
# We found a non-Linux variation that depends on GCC.
return false if variation["dependencies"]&.include?("gcc")
return false if variation_dependencies.include?("gcc")
end
end