[25038] branches/dp2mp-move/base/src/macports1.0/macports.tcl

source_changes at macosforge.org source_changes at macosforge.org
Sat May 12 16:07:25 PDT 2007


Revision: 25038
          http://trac.macosforge.org/projects/macports/changeset/25038
Author:   jmpp at macports.org
Date:     2007-05-12 16:07:24 -0700 (Sat, 12 May 2007)

Log Message:
-----------

Finally, working findBinary proc (feel free to correct my error reporting in it if you find it awful ;).
Also, adapting mportsync's file method to use the revised findBinary proc and moving the rsync method back
to polling macports::autoconf for the path to rsync, as the latter is precious and shouldn't be messed with
(per Eridius' advice)

Modified Paths:
--------------
    branches/dp2mp-move/base/src/macports1.0/macports.tcl

Modified: branches/dp2mp-move/base/src/macports1.0/macports.tcl
===================================================================
--- branches/dp2mp-move/base/src/macports1.0/macports.tcl	2007-05-12 22:28:20 UTC (rev 25037)
+++ branches/dp2mp-move/base/src/macports1.0/macports.tcl	2007-05-12 23:07:24 UTC (rev 25038)
@@ -157,18 +157,15 @@
 	catch "tcl::puts $args"
 }
 
-# 
-proc findBinary {prog {autoconf_hint ""}} {
-# debug, remove when done!
-    puts "entering findBinary proc"
-    puts "naming hint passed is: ${autoconf_hint}"
-    if {${autoconf_hint} != "" and [file executable ${autoconf_hint}]} {
-	return [set cmd [set ${autoconf_hint}]]
+# find a binary either in a path defined at configuration time or in the path (fallback)
+proc macports::findBinary {prog {autoconf_hint ""}} {
+    if {${autoconf_hint} != "" && [file executable ${autoconf_hint}]} {
+	return ${autoconf_hint}
     } else {
-	if {[catch {set cmd [binaryInPath "${prog}"]}] == 0} {
-	    return $cmd
+	if {[catch {set cmd_path [macports::binaryInPath ${prog}]} result] == 0} {
+	    return ${cmd_path}
 	} else {
-	    return -code error "Command ${prog} couldn't be found"
+	    return -code error "${result} or at its MacPorts configuration time location, did you move it?"
 	}
     }
 }
@@ -1185,20 +1182,14 @@
 	    {^file$} {
 		set portdir [macports::getportdir $source]
 		if {[file exists $portdir/.svn]} {
-		    if {[catch {set svn_command [findBinary "svn" "${macports::autoconf::svn_path}"]}] == 0} {
-			# debug, remove!
-			puts "entered findBinary conditional..."
-			set svn_commandline "${svn_command} update --non-interactive \"${portdir}\""
-			ui_debug $svn_commandline
-			if {[catch {system $svn_commandline}]} {
-			    return -code error "sync failed doing svn update"
-			}
-			if {[catch {system "chmod -R a+r \"${portdir}\""}]} {
-			    ui_warn "Setting world read permissions on parts of the ports tree failed, need root?"
-			}
-		    } else {
-			return -code error "Synchronizing the svn checkout failed due to an unknown reason"
+		    set svn_commandline "[macports::findBinary svn ${macports::autoconf::svn_path}] update --non-interactive ${portdir}"
+		    ui_debug $svn_commandline
+		    if {[catch {system $svn_commandline}]} {
+			return -code error "sync failed doing svn update"
 		    }
+		    if {[catch {system "chmod -R a+r \"${portdir}\""}]} {
+			ui_warn "Setting world read permissions on parts of the ports tree failed, need root?"
+		    }
 		}
 	    }
 	    {^mports$} {
@@ -1215,18 +1206,14 @@
 		    set source "${source}/"
 		}
 		# Do rsync fetch
-		if {[catch {set rsync_command [findBinary "rsync" "${macports::autoconf::rsync_path}"]}] == 0} {
-		    set rsync_commandline "${rsync_command} ${rsync_options} \"${source}\" \"${destdir}\""
-		    ui_debug $rsync_commandline
-		    if {[catch {system $rsync_commandline}]} {
-			return -code error "sync failed doing rsync"
-		    }
-		    if {[catch {system "chmod -R a+r \"$destdir\""}]} {
-			ui_warn "Setting world read permissions on parts of the ports tree failed, need root?"
-		    }
-		} else {
-		    return -code error "bye!"
+		set rsync_commandline "${macports::autoconf::rsync_path} ${rsync_options} ${source} ${destdir}"
+		ui_debug $rsync_commandline
+		if {[catch {system $rsync_commandline}]} {
+		    return -code error "sync failed doing rsync"
 		}
+		if {[catch {system "chmod -R a+r \"$destdir\""}]} {
+		    ui_warn "Setting world read permissions on parts of the ports tree failed, need root?"
+		}
 	    }
 	    {^https?$|^ftp$} {
 		set indexfile [macports::getindex $source]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20070512/9179ae12/attachment.html


More information about the macports-changes mailing list