Problems with selfupdate when updating a very old macports
February 13th, 2007
Just like this guy when trying to do $ port selfupdate I’d get errors like:
Selfupdate failed: couldn't open
".../var/db/dports/sources/rsync.rsync.opendarwin.org_dpupdate1/base/dp_version":
no such file or directory
The problem is that my macports version is very old and after an rsync dp_version is now in base/config rather than just base. Furthermore because the rsync happens before you check dp_config putting in a symlink or just copying the file over won’t work as it gets deleted again before it is checked. The solution I found was to edit /Library/Tcl/darwinports1.0/darwinports.tcl and find this bit of code:
# get new darwinports version and write the old version back
set fd [open [file join $dp_base_path dp_version] r]
gets $fd dp_version_new
close $fd
ui_msg "New DarwinPorts base version $dp_version_new"
Then change the first line after the comment so that it reads (i.e. insert ‘config’):
# get new darwinports version and write the old version back
set fd [open [file join $dp_base_path config dp_version] r]
gets $fd dp_version_new
close $fd
ui_msg "New DarwinPorts base version $dp_version_new"
And hey presto! selfupdate now works.

February 21st, 2007 at 5:44 am
Excellent. This was just what I was looking for.
Thanks so much!
February 21st, 2007 at 9:01 pm
Ditto.
Thanks!
March 5th, 2007 at 11:02 pm
Thanks so much – worked like a charm.
March 7th, 2007 at 12:03 pm
[...] (Lösung gefunden bei: miscellaneous factZ) [...]
March 23rd, 2007 at 8:54 am
Thanks so much, without your help i was not able to selfupdate my ports!
March 30th, 2007 at 10:42 pm
Thanks!
June 11th, 2007 at 6:39 pm
Perfect… exactly what I was looking for. Thanks!!