Skip to content

Commit

Permalink
dependencies_helpers: fix pruning of build/test deps
Browse files Browse the repository at this point in the history
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 Homebrew#15445.
  • Loading branch information
carlocab committed Jun 6, 2023
1 parent 9d0b736 commit 7962b30
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Library/Homebrew/dependencies_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ def recursive_includes(klass, root_dependent, includes, ignores)
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
Expand Down

0 comments on commit 7962b30

Please sign in to comment.