[68864] trunk/base/src/registry2.0

jmr at macports.org jmr at macports.org
Wed Jun 16 07:22:51 PDT 2010


Revision: 68864
          http://trac.macports.org/changeset/68864
Author:   jmr at macports.org
Date:     2010-06-16 07:22:45 -0700 (Wed, 16 Jun 2010)
Log Message:
-----------
normalize paths to files as well as their parent directories when deactivating and uninstalling (#25268)
don't keep unsorted file lists around unnecessarily

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

Modified: trunk/base/src/registry2.0/portimage.tcl
===================================================================
--- trunk/base/src/registry2.0/portimage.tcl	2010-06-16 12:48:48 UTC (rev 68863)
+++ trunk/base/src/registry2.0/portimage.tcl	2010-06-16 14:22:45 UTC (rev 68864)
@@ -524,14 +524,14 @@
             # directories are before their elements.
             # We don't have to do this as mentioned above, but it makes the
             # debug output of activate make more sense.
-            set theList [lsort -increasing -unique $files]
+            set files [lsort -increasing -unique $files]
             set rollback_filelist {}
 
             registry::write {
                 # Activate it, and catch errors so we can roll-back
                 try {
                     $port activate $imagefiles
-                    foreach file $theList {
+                    foreach file $files {
                         if {[_activate_file "${imagedir}${file}" $file] == 1} {
                             lappend rollback_filelist $file
                         }
@@ -638,11 +638,11 @@
         # are before their elements.
         # We don't have to do this as mentioned above, but it makes the
         # debug output of activate make more sense.
-        set theList [lsort -increasing -unique $files]
+        set files [lsort -increasing -unique $files]
         set rollback_filelist {}
 
         # Activate it, and catch errors so we can roll-back
-        if { [catch { foreach file $theList {
+        if { [catch { foreach file $files {
                         if {[_activate_file "${imagedir}${file}" $file] == 1} {
                             lappend rollback_filelist $file
                         }
@@ -704,14 +704,14 @@
             # instead of the paths we currently have, users' registry won't
             # match and activate will say that some file exists but doesn't
             # belong to any port.
-            set theFile [file normalize $file]
-            lappend files $theFile
+            # The custom realpath proc is necessary because file normalize
+            # does not resolve symlinks on OS X < 10.6
+            set directory [realpath [file dirname $file]]
+            lappend files [file join $directory [file tail $file]]
 
-            # Split out the filename's subpaths and add them to the image list as
-            # well. The realpath call is necessary because file normalize
-            # does not resolve symlinks on OS X < 10.6
-            set directory [realpath [file dirname $theFile]]
-            while { [lsearch -exact $files $directory] == -1 } { 
+            # Split out the filename's subpaths and add them to the image list
+            # as well.
+            while { [lsearch -exact $files $directory] == -1 } {
                 lappend files $directory
                 set directory [file dirname $directory]
             }
@@ -723,18 +723,18 @@
     # Sort the list in reverse order, removing duplicates.
     # Since the list is sorted in reverse order, we're sure that directories
     # are after their elements.
-    set theList [lsort -decreasing -unique $files]
+    set files [lsort -decreasing -unique $files]
 
     # Remove all elements.
     if {$use_reg2 && !$rollback} {
         registry::write {
             $port deactivate $imagefiles
-            foreach file $theList {
+            foreach file $files {
                 _deactivate_file $file
             }
         }
     } else {
-        foreach file $theList {
+        foreach file $files {
             _deactivate_file $file
         }
     }

Modified: trunk/base/src/registry2.0/portuninstall.tcl
===================================================================
--- trunk/base/src/registry2.0/portuninstall.tcl	2010-06-16 12:48:48 UTC (rev 68863)
+++ trunk/base/src/registry2.0/portuninstall.tcl	2010-06-16 14:22:45 UTC (rev 68864)
@@ -340,17 +340,17 @@
                     catch {file copy $fname "${fname}${bak_suffix}"}
                 }
             }
-            
-            set theFile [file normalize $fname]
-            if { [file exists $theFile] || (![catch {file type $theFile}] && [file type $theFile] == "link") } {
+
+            if { [file exists $fname] || (![catch {file type $fname}] && [file type $fname] == "link") } {
                 # Normalize the file path to avoid removing the intermediate
                 # symlinks (remove the empty directories instead)
-                lappend files $theFile
+                # The custom realpath proc is necessary because file normalize
+                # does not resolve symlinks on OS X < 10.6
+                set directory [realpath [file dirname $fname]]
+                lappend files [file join $directory [file tail $fname]]
     
                 # Split out the filename's subpaths and add them to the
-                # list as well. The realpath call is necessary because file normalize
-                # does not resolve symlinks on OS X < 10.6
-                set directory [realpath [file dirname $theFile]]
+                # list as well.
                 while { [lsearch -exact $files $directory] == -1 } { 
                     lappend files $directory
                     set directory [file dirname $directory]
@@ -361,10 +361,10 @@
         # Sort the list in reverse order, removing duplicates.
         # Since the list is sorted in reverse order, we're sure that directories
         # are after their elements.
-        set theList [lsort -decreasing -unique $files]
+        set files [lsort -decreasing -unique $files]
     
         # Remove all elements.
-        _uninstall_list $theList
+        _uninstall_list $files
     
         if {$use_reg2} {
             registry::entry delete $port
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100616/15a6e6d0/attachment.html>


More information about the macports-changes mailing list