[45851] trunk/base/src

jmr at macports.org jmr at macports.org
Fri Jan 23 06:44:16 PST 2009


Revision: 45851
          http://trac.macports.org/changeset/45851
Author:   jmr at macports.org
Date:     2009-01-23 06:44:13 -0800 (Fri, 23 Jan 2009)
Log Message:
-----------
Use Tcl commands instead of system/exec where possible, and use some full paths instead of bare command names. See #18149.

Modified Paths:
--------------
    trunk/base/src/port1.0/portdestroot.tcl
    trunk/base/src/port1.0/portstartupitem.tcl
    trunk/base/src/port1.0/portutil.tcl
    trunk/base/src/registry1.0/receipt_flat.tcl

Modified: trunk/base/src/port1.0/portdestroot.tcl
===================================================================
--- trunk/base/src/port1.0/portdestroot.tcl	2009-01-23 11:52:12 UTC (rev 45850)
+++ trunk/base/src/port1.0/portdestroot.tcl	2009-01-23 14:44:13 UTC (rev 45851)
@@ -96,7 +96,7 @@
     set mtree ${portutil::autoconf::mtree_path}
     
     if { ${destroot.clean} == "yes" } {
-        system "rm -Rf \"${destroot}\""
+        system "/bin/rm -Rf \"${destroot}\""
     }
     
     file mkdir "${destroot}"
@@ -214,7 +214,7 @@
                             # repoint the link
                             ui_debug "repointing link: $manlink from $manlinksrc to ${manlinksrc}.gz"
                             file delete $manlinkpath
-                            system "ln -s \"${manlinksrc}.gz\" \"$manlinkpath\""
+                            ln -s "${manlinksrc}.gz" "${manlinkpath}"
                         }
                         _cd $pwd
                     }

Modified: trunk/base/src/port1.0/portstartupitem.tcl
===================================================================
--- trunk/base/src/port1.0/portstartupitem.tcl	2009-01-23 11:52:12 UTC (rev 45850)
+++ trunk/base/src/port1.0/portstartupitem.tcl	2009-01-23 14:44:13 UTC (rev 45851)
@@ -584,7 +584,7 @@
 
     # Make a symlink to the plist file
     file mkdir "${destroot}/Library/${daemondest}"
-    system "cd ${destroot}/Library/${daemondest} && ln -sf ${itemdir}/${plistname}"
+    ln -sf "${itemdir}/${plistname}" "${destroot}/Library/${daemondest}"
     
     # If launchd is not available, warn the user
     set haveLaunchd ${portutil::autoconf::have_launchd}

Modified: trunk/base/src/port1.0/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/portutil.tcl	2009-01-23 11:52:12 UTC (rev 45850)
+++ trunk/base/src/port1.0/portutil.tcl	2009-01-23 14:44:13 UTC (rev 45851)
@@ -829,7 +829,7 @@
             return -code error "reinplace permissions failed"
         }
     
-        if {[catch {exec cp $tmpfile $file} error]} {
+        if {[catch {file copy -force $tmpfile $file} error]} {
             global errorInfo
             ui_debug "$errorInfo"
             ui_error "reinplace: $error"
@@ -1450,14 +1450,14 @@
         if {!([info exists ports_ignore_older] && $ports_ignore_older == "yes") && [file mtime $statefile] < [file mtime ${portpath}/Portfile]} {
             ui_msg "Portfile changed since last build; discarding previous state."
             #file delete $statefile
-            exec rm -rf [file join $workpath]
-            exec mkdir [file join $workpath]
+            exec /bin/rm -rf [file join $workpath]
+            file mkdir [file join $workpath]
         }
     }
 
     # Create a symlink to the workpath for port authors 
     if {[tbool place_worksymlink] && ![file isdirectory $worksymlink]} {
-        exec ln -sf $workpath $worksymlink
+        ln -sf $workpath $worksymlink
     }
     
     set fd [open $statefile a+]

Modified: trunk/base/src/registry1.0/receipt_flat.tcl
===================================================================
--- trunk/base/src/registry1.0/receipt_flat.tcl	2009-01-23 11:52:12 UTC (rev 45850)
+++ trunk/base/src/registry1.0/receipt_flat.tcl	2009-01-23 14:44:13 UTC (rev 45851)
@@ -318,12 +318,12 @@
 	close $receipt_handle
 
 	if { [file exists ${receipt_file}] } {
-		system "rm -rf ${receipt_file}"
+		file delete -force "${receipt_file}"
 	} elseif { [file exists ${receipt_file}.bz2] } {
-		system "rm -rf ${receipt_file}.bz2"
+		file delete -force "${receipt_file}.bz2"
 	}
 
-	system "mv ${receipt_file}.tmp ${receipt_file}"
+	file rename -force "${receipt_file}.tmp" "${receipt_file}"
 
 	if { [file exists ${receipt_file}] && [file exists ${registry::autoconf::bzip2_path}] && ![info exists registry.nobzip] } {
 		system "${registry::autoconf::bzip2_path} -f ${receipt_file}"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090123/466785e5/attachment-0001.html>


More information about the macports-changes mailing list