From 7962b3072bbdcebdfcfb3ba23a4bfd7c593150d8 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Tue, 6 Jun 2023 15:44:08 +0800 Subject: [PATCH] dependencies_helpers: fix pruning of build/test deps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We need to check that a dependency is a build or test dependency before checking that it is satisfied in order to prune dependencies as requested correctly. Before: ``` ❯ brew deps esptool ca-certificates cmake mpdecimal openssl@1.1 openssl@3 pkg-config python@3.11 readline rust six sqlite xz ``` After: ``` ❯ brew deps esptool ca-certificates cffi mpdecimal openssl@1.1 pycparser python@3.11 readline six sqlite xz ``` Note: You will need build dependencies installed to reproduce the "before" behaviour. See #15445. --- Library/Homebrew/dependencies_helpers.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/dependencies_helpers.rb b/Library/Homebrew/dependencies_helpers.rb index 7646402026..8006882b11 100644 --- a/Library/Homebrew/dependencies_helpers.rb +++ b/Library/Homebrew/dependencies_helpers.rb @@ -45,13 +45,13 @@ module DependenciesHelpers klass.prune if ignores.include?("recommended?") || dependent.build.without?(dep) elsif dep.optional? klass.prune if includes.exclude?("optional?") && !dependent.build.with?(dep) - elsif dep.satisfied? - klass.prune if ignores.include?("satisfied?") elsif dep.build? || dep.test? keep = false keep ||= dep.test? && includes.include?("test?") && dependent == root_dependent keep ||= dep.build? && includes.include?("build?") klass.prune unless keep + elsif dep.satisfied? + klass.prune if ignores.include?("satisfied?") end # If a tap isn't installed, we can't find the dependencies of one of