Handle on_system blocks.

This commit is contained in:
Carlo Cabrera 2022-08-24 20:34:43 +08:00
parent be4e926b15
commit 8e09ec4bf4
No known key found for this signature in database
GPG Key ID: C74D447FC549A1D0

View File

@ -882,18 +882,20 @@ module Homebrew
# The formula has no variations, so all OS-version-arch triples depend on GCC. # The formula has no variations, so all OS-version-arch triples depend on GCC.
return false if variations.blank? return false if variations.blank?
# FIXME: This returns a false positive for formulae that do, for example: MacOSVersions::SYMBOLS.each_key do |macos_version|
# ```ruby [:arm, :intel].each do |arch|
# on_system :linux, macos: :catalina_or_newer do bottle_tag = Utils::Bottles::Tag.new(system: macos_version, arch: arch)
# depends_on "gcc" next unless bottle_tag.valid_combination?
# end
# ```
variations_deps = variations.values
.flat_map { |data| data["dependencies"] }
.compact
.uniq
variations_deps.exclude?("gcc") variation = variations[bottle_tag.to_sym]
# This variation does not exist, so it must match Linux.
return false if variation.blank?
# We found a non-Linux variation that depends on GCC.
return false if variation["dependencies"]&.include?("gcc")
end
end
true
end end
end end
end end