Optionally depending on one of two ports (or none of them)

Ulrich Spoerlein uspoerlein at gmail.com
Sat Feb 24 17:29:51 UTC 2007


Fabian Keil wrote:
> I maintain the ports security/dns-proxy-tor and
> security/trans-proxy-tor which both require a Tor
> control port being available somewhere to do their job.
> 
> They can work with both Tor versions in the ports collection
> (security/tor and security/tor-devel), and I originally wanted
> to register a dependency on the one that is already installed,
> or use tor-devel if no version is installed.
> 
> To do that I added the RUN_DEPENDS line:
> 
> ${LOCALBASE}/bin/tor:${PORTSDIR}/security/tor-devel
> 
> which mostly works as expected, but fails if the tor
> port is installed, in which case a dependency on tor-devel
> is registered.
> 
> I'm aware that my RUN_DEPENDS line is incorrect,
> but I'm unaware of a better way.

This is a bug in the ports framework. It wrongfully assumes, that an
installed binary X is/was provided by port Y if you specify X:Y.

What it _should_ do is check for binary X, if present use pkg_info -W to
get the right port. If not present, use Y as a default port to pull in
this binary.

The same thing happens, if you e.g. install lynx-ssl and some other port
depends on lynx (the binary!) then a dependancy on lynx (the port) will
be recorded, not on lynx-ssl.

It is trivial to fix, iff you assume that the user only installs
software via ports and all the databases are consistent.

Ulrich Spoerlein


More information about the freebsd-ports mailing list