keeping a (maximally) clean active tree

David Blank-Edelman dnb at ccs.neu.edu
Wed Dec 5 21:56:08 PST 2007


Hi-

Pardon me if this is an obvious question, but I'd like to know if  
there is an easy way (e.g. a script) to keep a maximally clean tree of  
active ports? I'd ideally like to have only the latest and greatest of  
every port I use installed on my machine. As new versions of ports  
(libraries in particular) get released, it seems like one starts to  
collect old versions of these ports because something else previously  
installed linked against that old version.

For example, right now my "ports outdated" says:

apr                            1.2.11_0 < 1.2.12_0
apr-util                       1.2.10_0 < 1.2.12_0
cairo                          1.4.10_0 < 1.4.12_0
freetype                       2.3.5_0 < 2.3.5_1
glib2                          2.14.3_0 < 2.14.4_1
gtk2                           2.12.1_0 < 2.12.3_0
sqlite3                        3.5.2_0 < 3.5.3_1

I'm familiar with the -u switch to ports, but just to continue this  
example, I can't say "port -u upgrade cairo" because it says:

--->  Unable to uninstall freetype 2.3.5_0, the following ports depend  
on it:
--->  	fontconfig
--->  	cairo
--->  	Xft2
--->  	gtk2
Error: Uninstall freetype 2.3.5_0 failed: Please uninstall the ports  
that depend on freetype first.
--->  Unable to uninstall cairo 1.4.10_0, the following ports depend  
on it:
--->  	pango
--->  	gtk2
Error: Uninstall cairo 1.4.10_0 failed: Please uninstall the ports  
that depend on cairo first.

As far as I know, the only way to keep only the latest version of  
cairo is to uninstall all of the stuff that depends on the past  
version(s) of cairo, upgrade cairo, and then rebuild/reinstall all of  
those ports. For certain ports there are enough steps in the chain  
(e.g. wireshark) that this becomes a bit of a hassle.

So my questions are:
    1) Am I missing some incantation with port that will chase these  
dependencies for me?
    2) If not, it seems like it should be possible to write a script  
that figures out the right uninstall/build/install dance in the  
shortest number of moves  to leave a ports tree with only the very  
latest things installed. Anybody have one?
    3) Another possibility would be to write something that kept a  
list of installed ports, blew away the current port installation, and  
installed that list again from scratch. This seems a bit heavy handed,  
but it would work.

Thanks for any help you can offer (and my sincere thanks to the people  
on the project plus the ports maintainers for all of the hard work  
that they do).

       -- dNb


More information about the macports-users mailing list