[49006] trunk/base/src/registry1.0/portimage.tcl

alakazam at macports.org alakazam at macports.org
Wed Apr 1 13:10:26 PDT 2009


Revision: 49006
          http://trac.macports.org/changeset/49006
Author:   alakazam at macports.org
Date:     2009-04-01 13:10:24 -0700 (Wed, 01 Apr 2009)
Log Message:
-----------
Only calculate a timestamp once when backupping files during a forced activation of a port

This improves :
  - performance, as we only call clock once, instead of once per already existing file,
  - usability, as users do not have to worry about the timestamp having changed during the update to find files moved during the activation

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

Modified: trunk/base/src/registry1.0/portimage.tcl
===================================================================
--- trunk/base/src/registry1.0/portimage.tcl	2009-04-01 19:36:01 UTC (rev 49005)
+++ trunk/base/src/registry1.0/portimage.tcl	2009-04-01 20:10:24 UTC (rev 49006)
@@ -341,12 +341,14 @@
 
 		set port [registry::file_registered $file] 
 
+		set timestamp [clock seconds]
+
 		if { $port != 0  && $force != 1 && $port != $name } {
 			return -code error "Image error: $file is being used by the active $port port.  Please deactivate this port first, or use 'port -f activate $name' to force the activation."
 		} elseif { [file exists $file] && $force != 1 } {
 			return -code error "Image error: $file already exists and does not belong to a registered port.  Unable to activate port $name."
 		} elseif { $force == 1 && [file exists $file] || $port != 0 } {
-			set bakfile ${file}.mp_[clock seconds]
+			set bakfile ${file}.mp_${timestamp}
 
 			if {[file exists $file]} {
 				ui_warn "File $file already exists.  Moving to: $bakfile."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090401/c0f30a68/attachment.html>


More information about the macports-changes mailing list