Announcing: port_upgrade

Tony Doan tdoan at tdoan.com
Sat May 9 14:05:41 PDT 2009


(long time lurker, first time poster)

Got MacPorts?

Do you normally keep things up to date by running "port sync; port  
upgrade outdated"? Do you then wish there was a problem free way to  
clean out all the previous versions?

Well then... have I got some beta software for you!

port_upgrade is a no holds barred brute force way to upgrade your  
ports tree when things are out of date. port_upgrade crawls your  
receipts directory and your sources directory and figures out what is  
out of date. It then builds a dependency tree and uninstalls  
everything in dependency order then reinstalls everything in reverse  
order. Along the way you get the most up to date versions of your  
ports, you are assured higher level ports are compiled against the  
most recent versions of libraries and generally a nice clean ports  
tree. You also get quite a long wait while things are recompiled and  
reinstalled. It preserves specified variants (either specified  
explicitly or implicitly). If port_upgrade encounters two versions of  
a port installed where the variants differ you will be prompted which  
to use.

How do I get this miracle (beta software) cure for my Macports tree  
ills?

port_upgrade is written in ruby is packaged as a ruby gem and has only  
2 dependencies on other libraries. It needs sqlite3 to perform its  
tree mangling and the bz2 ruby gem to read the receipts files. It  
should run fine with the version of ruby Apple ships with OS X, but I  
recommend using the far more current version in the ports tree.  
Whichever ruby you use you should first ensure your version of  
rubygems is current (1.3.3 at the time of writing). Using everything  
from ports it would look like this:

sudo port install ruby
sudo port install rb-rubygems
sudo port install sqlite3
rehash #if you using csh or tcsh, run "which gem" to make sure its now  
from /opt/local/bin
sudo gem install port_upgrade #this should install all the gem  
dependencies

Checkout the most current read me at http://github.com/tdoan/port_upgrade/ 
  and port_upgrade --help for more information.

RubyForge HomePage: http://portupgrade.rubyforge.org/
GitHub (source) page: http://github.com/tdoan/port_upgrade/

I started this little "script" quite a while ago because I had been  
manually maintaining my tree and it was just taking too much time. It  
almost accidentally turned into a real program over time with the help  
of some (one) dedicated tester who may just be the only person on  
earth more anal about keeping his ports clean.

Anyone willing to give this thing a try and provide feedback on how it  
worked for you or ideas for features would be great. You can email me  
directly or file bugs via rubyforge: http://rubyforge.org/tracker/?group_id=7522

Thank you!
Tony Doan
tdoan at tdoan.com

NOTE: Use this software at your own risk. It will want to do major  
surgery on your ports tree. If interrupted it can leave you without  
some of your ports installed. It's best not to rerun port_upgrade to  
generate a new script until you have successfully gotten the current  
script to finish.



More information about the macports-users mailing list