[45990] trunk/base/src

jmr at macports.org jmr at macports.org
Mon Jan 26 10:17:57 PST 2009


Revision: 45990
          http://trac.macports.org/changeset/45990
Author:   jmr at macports.org
Date:     2009-01-26 10:17:56 -0800 (Mon, 26 Jan 2009)
Log Message:
-----------
More replacement of system/exec calls with native Tcl

Modified Paths:
--------------
    trunk/base/src/package1.0/portdmg.tcl
    trunk/base/src/package1.0/portdpkg.tcl
    trunk/base/src/package1.0/portmdmg.tcl
    trunk/base/src/package1.0/portpkg.tcl
    trunk/base/src/package1.0/portrpm.tcl
    trunk/base/src/package1.0/portsrpm.tcl
    trunk/base/src/port1.0/portdestroot.tcl
    trunk/base/src/port1.0/portfetch.tcl
    trunk/base/src/port1.0/portsubmit.tcl
    trunk/base/src/port1.0/portutil.tcl

Modified: trunk/base/src/package1.0/portdmg.tcl
===================================================================
--- trunk/base/src/package1.0/portdmg.tcl	2009-01-26 17:52:37 UTC (rev 45989)
+++ trunk/base/src/package1.0/portdmg.tcl	2009-01-26 18:17:56 UTC (rev 45990)
@@ -102,7 +102,7 @@
     if {[system "hdiutil internet-enable -quiet -yes ${final_image}"] != ""} {
         return -code error [format [msgcat::mc "Failed to internet-enable: %s"] ${final_image}]
     }
-    system "rm -f ${tmp_image}"
+    file delete -force "${tmp_image}"
     
     return 0
 }

Modified: trunk/base/src/package1.0/portdpkg.tcl
===================================================================
--- trunk/base/src/package1.0/portdpkg.tcl	2009-01-26 17:52:37 UTC (rev 45989)
+++ trunk/base/src/package1.0/portdpkg.tcl	2009-01-26 18:17:56 UTC (rev 45990)
@@ -75,7 +75,7 @@
 			return -code error [format [msgcat::mc "Can not create dpkg control directory. %s not a directory."] ${controlpath}]
 		} else {
 			ui_info [msgcat::mc "Removing stale dpkg control directory."]
-			system "rm -rf \"${controlpath}\""
+			delete "${controlpath}"
 		}
 	}
 	file mkdir ${controlpath}
@@ -157,7 +157,7 @@
 	system "dpkg-deb -b \"${destpath}\" \"[option package.destpath]\""
 
 	ui_info [msgcat::mc "Removing dpkg control directory."]
-	system "rm -rf \"${controlpath}\""
+	delete "${controlpath}"
 }
 
 proc org.macports.dpkg::make_dependency_list {portname} {

Modified: trunk/base/src/package1.0/portmdmg.tcl
===================================================================
--- trunk/base/src/package1.0/portmdmg.tcl	2009-01-26 17:52:37 UTC (rev 45989)
+++ trunk/base/src/package1.0/portmdmg.tcl	2009-01-26 18:17:56 UTC (rev 45990)
@@ -108,7 +108,7 @@
     if {[system "hdiutil internet-enable -quiet -yes ${final_image}"] != ""} {
         return -code error [format [msgcat::mc "Failed to internet-enable: %s"] ${final_image}]
     }
-    system "rm -f ${tmp_image}"
+    file delete -force "${tmp_image}"
     
     return 0
 }

Modified: trunk/base/src/package1.0/portpkg.tcl
===================================================================
--- trunk/base/src/package1.0/portpkg.tcl	2009-01-26 17:52:37 UTC (rev 45989)
+++ trunk/base/src/package1.0/portpkg.tcl	2009-01-26 18:17:56 UTC (rev 45990)
@@ -94,7 +94,9 @@
     foreach dir {etc var tmp} {
         if ([file exists "${destpath}/$dir"]) {
             # certain toplevel directories really are symlinks. leaving them as directories make pax lose the symlinks. that's bad.
-            system "mkdir -p ${destpath}/private/$dir; mv ${destpath}/$dir/* ${destpath}/private/$dir; rm -r \"${destpath}/$dir\""
+            file mkdir "${destpath}/private/${dir}"
+            eval file rename [glob ${destpath}/${dir}/*] "${destpath}/private/${dir}"
+            delete "${destpath}/${dir}"
         }
     }
 

Modified: trunk/base/src/package1.0/portrpm.tcl
===================================================================
--- trunk/base/src/package1.0/portrpm.tcl	2009-01-26 17:52:37 UTC (rev 45989)
+++ trunk/base/src/package1.0/portrpm.tcl	2009-01-26 18:17:56 UTC (rev 45990)
@@ -57,11 +57,11 @@
     set rpmdestpath ""
     if {![string equal ${package.destpath} ${workpath}] && ![string equal ${package.destpath} ""]} {
         set pkgpath ${package.destpath}
-        system "mkdir -p ${pkgpath}/BUILD"
-        system "mkdir -p ${pkgpath}/RPMS"
-        system "mkdir -p ${pkgpath}/SOURCES"
-        system "mkdir -p ${pkgpath}/SPECS"
-        system "mkdir -p ${pkgpath}/SRPMS"
+        file mkdir ${pkgpath}/BUILD \
+                   ${pkgpath}/RPMS \
+                   ${pkgpath}/SOURCES \
+                   ${pkgpath}/SPECS \
+                   ${pkgpath}/SRPMS
         set rpmdestpath "--define '_topdir ${pkgpath}'"
     }
     

Modified: trunk/base/src/package1.0/portsrpm.tcl
===================================================================
--- trunk/base/src/package1.0/portsrpm.tcl	2009-01-26 17:52:37 UTC (rev 45989)
+++ trunk/base/src/package1.0/portsrpm.tcl	2009-01-26 18:17:56 UTC (rev 45990)
@@ -58,11 +58,11 @@
     set rpmdestpath ""
     if {![string equal ${package.destpath} ${workpath}] && ![string equal ${package.destpath} ""]} {
         set pkgpath ${package.destpath}
-        system "mkdir -p ${pkgpath}/BUILD"
-        system "mkdir -p ${pkgpath}/RPMS"
-        system "mkdir -p ${pkgpath}/SOURCES"
-        system "mkdir -p ${pkgpath}/SPECS"
-        system "mkdir -p ${pkgpath}/SRPMS"
+        file mkdir ${pkgpath}/BUILD \
+                   ${pkgpath}/RPMS \
+                   ${pkgpath}/SOURCES \
+                   ${pkgpath}/SPECS \
+                   ${pkgpath}/SRPMS
         set rpmdestpath "--define '_topdir ${pkgpath}'"
     }
     

Modified: trunk/base/src/port1.0/portdestroot.tcl
===================================================================
--- trunk/base/src/port1.0/portdestroot.tcl	2009-01-26 17:52:37 UTC (rev 45989)
+++ trunk/base/src/port1.0/portdestroot.tcl	2009-01-26 18:17:56 UTC (rev 45990)
@@ -96,7 +96,7 @@
     set mtree ${portutil::autoconf::mtree_path}
     
     if { ${destroot.clean} == "yes" } {
-        system "/bin/rm -Rf \"${destroot}\""
+        delete "${destroot}"
     }
     
     file mkdir "${destroot}"

Modified: trunk/base/src/port1.0/portfetch.tcl
===================================================================
--- trunk/base/src/port1.0/portfetch.tcl	2009-01-26 17:52:37 UTC (rev 45989)
+++ trunk/base/src/port1.0/portfetch.tcl	2009-01-26 18:17:56 UTC (rev 45990)
@@ -662,7 +662,7 @@
 				set file_url [portfetch::assemble_url $site $distfile]
 				set effectiveURL ""
 				if {![catch {eval curl fetch --effective-url effectiveURL $fetch_options {$file_url} ${distpath}/${distfile}.TMP} result] &&
-					![catch {system "mv ${distpath}/${distfile}.TMP ${distpath}/${distfile}"}]} {
+					![catch {file rename -force "${distpath}/${distfile}.TMP" "${distpath}/${distfile}"} result]} {
 
 					# Special hack to check for sourceforge mirrors, which don't return a proper error code on failure
 					if {![string equal $effectiveURL $file_url] &&
@@ -672,7 +672,7 @@
 						# *SourceForge hackage in effect*
 						# The url seen by curl seems to have been a redirect to the sourceforge mirror page
 						ui_debug "[msgcat::mc "Fetching from sourceforge mirror failed"]"
-						exec rm -f ${distpath}/${distfile}.TMP
+						file delete -force "${distpath}/${distfile}.TMP"
 						
 						# Continue on to try the next mirror, if any
 					} else {
@@ -685,7 +685,7 @@
 
 				} else {
 					ui_debug "[msgcat::mc "Fetching failed:"]: $result"
-					exec rm -f ${distpath}/${distfile}.TMP
+					file delete -force "${distpath}/${distfile}.TMP"
 				}
 			}
 			if {![info exists fetched]} {
@@ -701,7 +701,7 @@
 	global distpath fetch_urls
 	foreach {url_var distfile} $fetch_urls {
 		if {[file isfile $distpath/$distfile]} {
-			exec rm -f ${distpath}/${distfile}
+			file delete -force "${distpath}/${distfile}"
 		}
 	}
 }

Modified: trunk/base/src/port1.0/portsubmit.tcl
===================================================================
--- trunk/base/src/port1.0/portsubmit.tcl	2009-01-26 17:52:37 UTC (rev 45989)
+++ trunk/base/src/port1.0/portsubmit.tcl	2009-01-26 18:17:56 UTC (rev 45990)
@@ -233,15 +233,14 @@
 		if {$base_rev != ""} {
 			set worker2 [mport_open $portsource/files/$portname/$portversion/$base_rev/Portfile.tar.gz [list portdir $tmpdir/old]]
 			catch {system "diff3 -m -E -- $portpath/Portfile $tmpdir/old/$portname-$portversion/Portfile $tmpdir/new/$portname-$portversion/Portfile > $tmpdir/Portfile"}
-			system "mv $tmpdir/Portfile $portpath/Portfile"
+			file rename -force "${tmpdir}/Portfile" "${portpath}/Portfile"
 			mport_close $worker2
 		} else {
 			catch {system "diff3 -m -E -- $portpath/Portfile $portpath/Portfile $tmpdir/new/$portname-$portversion/Portfile > $tmpdir/Portfile"}
-			system "mv $tmpdir/Portfile $portpath/Portfile"
+			file rename -force "${tmpdir}/Portfile" "${portpath}/Portfile"
 		}
 		mport_close $worker
-		catch {system "rm -Rf $tmpdir"}
-		catch {system "rm -Rf $tmpdir"}
+		catch {delete "${tmpdir}"}
 
 		set fd [open [file join "$portpath" ".mports_source"] w]
 		puts $fd "source: $portsource"

Modified: trunk/base/src/port1.0/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/portutil.tcl	2009-01-26 17:52:37 UTC (rev 45989)
+++ trunk/base/src/port1.0/portutil.tcl	2009-01-26 18:17:56 UTC (rev 45990)
@@ -1450,7 +1450,7 @@
         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 /bin/rm -rf [file join $workpath]
+            delete [file join $workpath]
             file mkdir [file join $workpath]
         }
     }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090126/71dee949/attachment.html>


More information about the macports-changes mailing list