Keeping track of automatically installed dependency-only ports

Doug Barton dougb at
Sat Jul 7 16:58:02 UTC 2007

Michel Talon wrote:
> Doug Barton said:
>> Jeremie Le Hen wrote:
>>> Hi,
>>> Is there a way to track dependency-only ports, so that if I
>>> install port0 which requires port1 which in turn requires port2
>>> and so on, deinstalling port0 will deinstall portN up to the
>>> first one required by another port or one I explicitely
>>> installed.
>> I realize that this is an old post, but the thread it generated 
>> indicated that there is demand for this kind of functionality,
>> and no solutions were presented that I could see.
>> Portmaster actually has what I believe you are looking for.
> Finding installed packages which have no REQUIRED_BY is easy, 
> portmaster do it, do it, but i don't think this is the
>  solution of the problem.

Ok, thanks for clarifying how you see the problem. :)

> For example, port1 may require port2 which itself requires port3.
> Assume you remove port1, and that, as a consequence port2 and port3
> are no more necessary. It is only port2 which has an empty

Until you remove port2.

> as long as you have not removed port2, port3 mentions it in
> REQUIRED_BY. So the deletion should have to be recursive.

The 'portmaster -s' function is indeed recursive, for exactly the
reason you suggest.

> Moreover on a large installation you may have a large number of
> ports that should be removed and should require user approval to do
> so. But it is hard to remember several months after the fact, if a
> port without REQUIRED_BY has been installed as a dependency or for
> a precise reason.

I tend to disagree with you here, but since this is a matter of
opinion, I'll agree to disagree. :)

> The only reliable way to detect ports which have been installed as
> a dependency is to create a database

*shudder* You just tripped over your own argument here. There are
plenty of ways that we could recognize a port that was installed as a
dependency. The one that comes immediately to mind is to create a flag
file in /var/db/pkg/foo (or /var/db/ports/foo) to indicate that the
port was installed as a dependency. It would be trivial for portmaster
and portupgrade to do this, slightly more complicated for it to be
done in, but not impossible.

> indicating which ports have been required by the end user, and
> which ones have been automatically installed.

Well, what happens if an application (rather than a library) gets
installed as a dependency, but you decide that you like that
application, and want to keep it? How do you "promote" something from
"dependency installed" to "user installed?"

Personally I think that portmaster's approach is the right one. If you
accidentally delete something that it turns out you really do need,
you can always install it again. On the other hand, the presence of an
empty +REQUIRED_BY file is a very reliable indication that something
was previously installed as a dependency, but is no longer needed.

I'd be interested to hear if others have opinions about this ...



    This .signature sanitized for your protection

More information about the freebsd-ports mailing list