Dependencies/Dependents

Joshua Root jmr at macports.org
Tue Sep 10 03:54:50 UTC 2024


bernard.remacle wrote:

> What is the meaning of ‘rdepends’? (The manual page on port(1) is a little difficult to understand): I understand ‘r’ is the prefix for recursive.
> What is the difference between ‘rdepends’ and ‘rdependentof’?

The rdepends: selector is the recursive version of depends:, which is a 
generalisation that matches the union of what all the depends_* 
selectors (depends_build:, depends_lib: and so on) would match. Each of 
the latter matches against the corresponding field in the PortIndex. So 
rdepends: gives you all available ports that have the specified port 
anywhere in their recursive dependencies.

On the other hand, rdependentof: is the recursive version of 
dependentof:, which evaluates to the same thing that 'port dependents' 
would print. That only considers the dependencies recorded in the 
registry, which means it only tells you about ports that are installed, 
and only about their runtime dependencies. Basically it answers the 
question, "What other installed ports would break if I uninstalled this 
port?"

Originally there were only selectors that directly matched PortIndex 
fields. Recursive and inverted ones for dependencies seemed like an 
obvious improvement, and ones that matched registry information instead 
seemed like a good idea at the time ("Hey, what if I want to use the 
result of 'port dependents foo' in an expression?"), though perhaps not 
enough thought was put into how to convey the subtle semantic difference 
to users not familiar with the internals. If there isn't good 
documentation that explains it already, that would be a great addition.

- Josh



More information about the macports-users mailing list