From e234fb7542195f7a6e656708d17b0d0c1935d739 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?fn=20=E2=8C=83=20=E2=8C=A5?= <70830482+FnControlOption@users.noreply.github.com> Date: Mon, 2 Jan 2023 14:10:17 -0800 Subject: [PATCH 1/2] formula_installer: check if dependencies have already been fetched. Given a `pkg_a` that depends on `pkg_b`, it is redundant to list `pkg_b` as a dependency when running the following commands: - `brew install pkg_b pkg_a` - `brew upgrade` (when both `pkg_a` and `pkg_b` are outdated) --- Library/Homebrew/formula_installer.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index b4eba15ae2..fe2ef1402a 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -1156,7 +1156,10 @@ class FormulaInstaller def fetch_dependencies return if ignore_deps? - deps = compute_dependencies + deps = compute_dependencies.reject do |dep, _options| + self.class.fetched.include?(dep.to_formula) + end + return if deps.empty? oh1 "Fetching dependencies for #{formula.full_name}: " \ From 752d1fa114a7f04334cbad7d46bb459691792334 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 4 Jan 2023 14:19:22 +0000 Subject: [PATCH 2/2] formula_installer: add comment. --- Library/Homebrew/formula_installer.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index fe2ef1402a..2d5bc92540 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -1156,6 +1156,7 @@ class FormulaInstaller def fetch_dependencies return if ignore_deps? + # Don't output dependencies if we're explicitly installing them. deps = compute_dependencies.reject do |dep, _options| self.class.fetched.include?(dep.to_formula) end