From 378ff06f53259229cb51c7634fc33a084c4fc309 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Thu, 25 Aug 2022 20:44:27 +0800 Subject: [PATCH] Speed up `#linux_only_gcc_dep?`. `#to_hash_with_variations` is slow, let's avoid doing it unless needed. --- Library/Homebrew/formula_auditor.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Library/Homebrew/formula_auditor.rb b/Library/Homebrew/formula_auditor.rb index 903fcebe73..aafc5bfe5a 100644 --- a/Library/Homebrew/formula_auditor.rb +++ b/Library/Homebrew/formula_auditor.rb @@ -873,12 +873,9 @@ module Homebrew def linux_only_gcc_dep?(formula) odie "`#linux_only_gcc_dep?` works only on Linux!" if Homebrew::SimulateSystem.simulating_or_running_on_macos? + return false if formula.deps.map(&:name).exclude?("gcc") - formula_hash = formula.to_hash_with_variations - linux_deps = formula_hash["dependencies"] - return false if linux_deps.exclude?("gcc") - - variations = formula_hash["variations"] + variations = formula.to_hash_with_variations["variations"] # The formula has no variations, so all OS-version-arch triples depend on GCC. return false if variations.blank?