On Dec 5, 2007, at 23:56, David Blank-Edelman wrote:
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:
The message should say "Won't uninstall cairo 1.4.10_0 because the following ports depend on cairo:" Ports don't depend on specific versions of ports. If you've just installed cairo 1.4.12_0, then the ports that depend on cairo will be happy with that version as well, and you're free to forcibly uninstall the old 1.4.10_0 version.
---> 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).
Someone posted a recipe some time ago which I now agree with, which is: 1. Run "port outdated" 2. If there aren't any listed, go to 5. 3. Pick the first port in the list (let's call it "foo") and say "sudo port upgrade foo". This might upgrade just foo, or if foo has outdated dependencies, it will update those too. 4. Go back to 1. 5. Uninstall all now-inactive old versions with "sudo port -f uninstall inactive"