27. November, 2005
27. June, 2007
in by Michael Neumann

My DarwinPorts installation had problem with fetching source packages. After a while it simply stopped to fetch a package! I decided to look at the responsible code which was a Tcl file. Having written a simplistic Tcl interpreter in Ruby called RTcl, I put my hands on the code and replace the use of curl fetch with the wget command line utility. It’s a dirty hack I know, but it works great!

The patch (with leading whitespaces remove from each line):

--- /opt/local/share/darwinports/Tcl/port1.0/portfetch.tcl.old  2005-11-27 13:19:08.000000000 +0100
+++ /opt/local/share/darwinports/Tcl/port1.0/portfetch.tcl      2005-11-27 13:19:22.000000000 +0100
@@ -375,7 +375,7 @@
 foreach site [set $url_var] {
        ui_msg "$UI_PREFIX [format [msgcat::mc "Attempting to fetch %s from %s"] $distfile $site]" 
        set file_url [portfetch::assemble_url $site $distfile]
-       if {![catch {eval curl fetch $fetch_options {$file_url} ${distpath}/${distfile}.TMP} result] &&
+       if {![catch {system "/usr/pkg/bin/wget -O ${distpath}/${distfile}.TMP $file_url"} result] &&
                ![catch {system "mv ${distpath}/${distfile}.TMP ${distpath}/${distfile}"}]} {
                set fetched 1           
                break