Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 07 Jul 2007 09:57:59 -0700
From:      Doug Barton <dougb@FreeBSD.org>
To:        Michel Talon <talon@lpthe.jussieu.fr>
Cc:        freebsd-ports@FreeBSD.org
Subject:   Re: Keeping track of automatically installed dependency-only ports
Message-ID:  <468FC617.6070304@FreeBSD.org>
In-Reply-To: <20070707145958.GA3472@lpthe.jussieu.fr>
References:  <20070707145958.GA3472@lpthe.jussieu.fr>

next in thread | previous in thread | raw e-mail | index | archive | help
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, check_pkg.py 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
> REQUIRED_BY,

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 bsd.port.mk, 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 ...

Doug

-- 

    This .signature sanitized for your protection




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?468FC617.6070304>