From c31335c46d76837db3b7b7022721f0d514f75e9f Mon Sep 17 00:00:00 2001 From: EricFromCanada Date: Fri, 27 Dec 2019 17:35:18 -0500 Subject: [PATCH] deps: don't skip those that are both :build and :test plus a code readability improvement --- Library/Homebrew/cmd/deps.rb | 10 ++++------ Library/Homebrew/dependencies.rb | 8 +++++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Library/Homebrew/cmd/deps.rb b/Library/Homebrew/cmd/deps.rb index 3031f9d2aa..b7f21155bd 100644 --- a/Library/Homebrew/cmd/deps.rb +++ b/Library/Homebrew/cmd/deps.rb @@ -175,13 +175,11 @@ module Homebrew end def recursive_deps_tree(f, prefix, recursive) - reqs = f.requirements - deps = f.deps + includes, ignores = argv_includes_ignores(ARGV) + deps = reject_ignores(f.deps, ignores, includes) + reqs = reject_ignores(f.requirements, ignores, includes) dependables = reqs + deps - dependables.reject!(&:optional?) unless args.include_optional? - dependables.reject!(&:build?) unless args.include_build? - dependables.reject!(&:test?) unless args.include_test? - dependables.reject!(&:recommended?) if args.skip_recommended? + max = dependables.length - 1 @dep_stack.push f.name dependables.each_with_index do |dep, i| diff --git a/Library/Homebrew/dependencies.rb b/Library/Homebrew/dependencies.rb index dff99d5407..1431ec2507 100644 --- a/Library/Homebrew/dependencies.rb +++ b/Library/Homebrew/dependencies.rb @@ -98,19 +98,21 @@ module Homebrew formula.send("recursive_#{type}") do |dependent, dep| if dep.recommended? klass.prune if ignores.include?("recommended?") || dependent.build.without?(dep) + elsif dep.optional? + klass.prune if !includes.include?("optional?") && !dependent.build.with?(dep) elsif dep.test? if includes.include?("test?") Dependency.keep_but_prune_recursive_deps if type == :dependencies + elsif dep.build? + klass.prune unless includes.include?("build?") else klass.prune end - elsif dep.optional? - klass.prune if !includes.include?("optional?") && !dependent.build.with?(dep) elsif dep.build? klass.prune unless includes.include?("build?") end - # If a tap isn't installed, we can't find the dependencies of one + # If a tap isn't installed, we can't find the dependencies of one of # its formulae, and an exception will be thrown if we try. if type == :dependencies && dep.is_a?(TapDependency) &&