New /bin/sh based script to manage ports
dougb at FreeBSD.org
Sat Jan 14 14:32:14 PST 2006
Alexander Leidinger wrote:
> On Sat, 14 Jan 2006 03:45:10 -0800 Doug Barton <dougb at freebsd.org> wrote:
>> This is done too now, although it turned out to be a lot harder than I
>> expected. It required redoing how some of the internal stuff worked,
>> but in the end it made the whole script better, so I'm glad I pursued
>> this. As an extra bonus you can now do 'portmaster -af' and it will
>> force an update of all ports on your system, starting with the leaves.
> "Leafes" as in "those ports which no other ports depends upon"?
> If yes: are you sure this is a good idea? Wouldn't you think a better
> approach would be to start with those ports, which depend upon no other
> port (= "root" ports in my terminology)?
Yes, except that I left out one important part of that explanation. :)
What portmaster does when asked to update a given port is (leaving out some
1. cd to the port directory
2. make config
3. Get a list of dependencies by doing 'make all-depends-list'
4. Recursively check to see if each of those dependencies is up to date, and
update it if not by launching a child process of itself
5. Return to the original port, and update it
So, in the non-forced update case, any dependencies of a leaf port will get
updated before the leaf does. Anything that is already up to date won't get
touched. In the forced update case, we'll recurse through the dependency
list of the first leaf port all the way down to the root ports, then back up
through each dependency, and finally back up to the leaf. In the force case,
I keep a list of ports that have been updated so that we only have to do
that once for each port.
Now theoretically there is nothing wrong with your suggestion, and other
than the fact that I wanted to keep the same process in place for updating
all the ports as I do for updating them one at a time, I could have done it
that way. In fact, the more I think about it the more I think it makes sense
to do it in this order for the 'update all' case:
1. ports that have no dependencies (roots)
2. ports that have dependencies, and are depended on (branches?)
3. ports that have dependencies, and are not depended on (leaves)
I'll do some testing on this and let you know, thanks for this suggestion.
This .signature sanitized for your protection
More information about the freebsd-ports