Keeping track of automatically installed dependency-only ports

Garrett Cooper youshi10 at
Sat Jul 7 22:36:26 UTC 2007

Michel Talon wrote:
> On Sat, Jul 07, 2007 at 09:57:59AM -0700, Doug Barton wrote:
>>> 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.
> I agree completely with you. Of course when i say that a database has to
> be created, this may very well be reduced to a flag somewhere in
> /var/db/pkg. For me, /var/db/pkg is a database describing the installed
> ports. Wether abusing the filesystem to create this database is good for
> performance is a completely different problem, at least it has the
> advantage of being  very transparent.

IMO adding packages (or ports in this case) should be done using 
pkg_install. It's the best means to transparently control package 
entries in the system, and it would probably reduce the load on the 
bsd.port* Makefiles.

>>> 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?"
> Indeed you are right, it should be possible to decide of such a
> promotion.

Not unless you have metafiles laying around that identify leaf packages 
(i.e. directly user installed packages) over additional node packages 
(in this case dependency installed packages).

>> 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.
> Typically you can install the java jdk to do programming, and without
> any required_by stuff. If you accidently erase it, it will be expensive
> to recreate. Obviously this is not a very good example because this one
> you will remember. I was thinking more to some obscure ports that you
> install by curiosity. After several months, perhaps you discover it is
> on your machine, and you have some use for it. Perhaps if you had erased
> it, the distfile  would have disappeared, or marked broken with
> new versions of FreeBSD, no more compilable, etc. 
    There really isn't a way to work around this problem I believe other 
than to have a huge warning banner and show what would be deinstalled 
prior to the operation being executed. This is a slippery slope trying 
to deal with corner cases like these.


More information about the freebsd-ports mailing list