[22769] trunk/base/src/registry1.0/receipt_flat.tcl

source_changes at macosforge.org source_changes at macosforge.org
Tue Mar 13 19:33:45 PDT 2007


Revision: 22769
          http://trac.macosforge.org/projects/macports/changeset/22769
Author:   eridius at macports.org
Date:     2007-03-13 19:33:45 -0700 (Tue, 13 Mar 2007)

Log Message:
-----------
No longer touch dep_map when opening the dep_map (Fixes #11417)
I have no idea why it was implemented that way, it was quite silly
Also stop using system to rm and mv the dep_map, tcl has built-in commands for that

Modified Paths:
--------------
    trunk/base/src/registry1.0/receipt_flat.tcl

Modified: trunk/base/src/registry1.0/receipt_flat.tcl
===================================================================
--- trunk/base/src/registry1.0/receipt_flat.tcl	2007-03-14 02:13:50 UTC (rev 22768)
+++ trunk/base/src/registry1.0/receipt_flat.tcl	2007-03-14 02:33:45 UTC (rev 22769)
@@ -686,16 +686,14 @@
 
 	set map_file [file join ${receipt_path} dep_map]
 
-	if { ![file exists $map_file] } {
-		system "touch $map_file"
-	}
-
 	if { [file exists ${map_file}.bz2] && [file exists ${registry::autoconf::bzip2_path}] } {
 		set dep_map [exec ${registry::autoconf::bzip2_path} -d -c ${map_file}.bz2]
-	} else {
+	} elseif { [file exists ${map_file}] } {
 		set map_handle [open ${map_file} r]
 		set dep_map [read $map_handle]
 		close $map_handle
+	} else {
+	    set dep_map [list]
 	}
 	if { ![llength $dep_map] > 0 } {
 		set dep_map [list]
@@ -760,13 +758,10 @@
 	puts $map_handle $dep_map
 	close $map_handle
 
-	if { [file exists ${map_file}] } {
-		system "rm -rf ${map_file}"
-	} elseif { [file exists ${map_file}.bz2] } {
-		system "rm -rf ${map_file}.bz2"
-	}
+    # don't both checking for presence, file delete doesn't error if file doesn't exist
+    file delete ${map_file} ${map_file}.bz2
 
-	system "mv ${map_file}.tmp ${map_file}"
+    file rename ${map_file}.tmp ${map_file}
 
 	if { [file exists ${map_file}] && [file exists ${registry::autoconf::bzip2_path}] && ![info exists registry.nobzip] } {
 		system "${registry::autoconf::bzip2_path} -f ${map_file}"

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20070313/642b2e06/attachment.html


More information about the macports-changes mailing list