[121236] branches/gsoc14-cleanup/src/macports1.0/reclaim.tcl

ksammons at macports.org ksammons at macports.org
Fri Jun 20 16:14:25 PDT 2014


Revision: 121236
          https://trac.macports.org/changeset/121236
Author:   ksammons at macports.org
Date:     2014-06-20 16:14:25 -0700 (Fri, 20 Jun 2014)
Log Message:
-----------
Added ui_debug statements in several places.

Modified Paths:
--------------
    branches/gsoc14-cleanup/src/macports1.0/reclaim.tcl

Modified: branches/gsoc14-cleanup/src/macports1.0/reclaim.tcl
===================================================================
--- branches/gsoc14-cleanup/src/macports1.0/reclaim.tcl	2014-06-20 23:14:23 UTC (rev 121235)
+++ branches/gsoc14-cleanup/src/macports1.0/reclaim.tcl	2014-06-20 23:14:25 UTC (rev 121236)
@@ -34,9 +34,9 @@
 # POSSIBILITY OF SUCH DAMAGE.
 
 # TODO:
-# Add ui_debug statments
 
 # Finished:
+# Add ui_debug statments
 # Catch some error-prone areas.
 # Remove the useless/structure comments and add actual docstrings.
 # Add copyright notice
@@ -127,6 +127,8 @@
                     ui_msg "Found distfile: $item"
 
                     if {$delete eq "yes"} {
+
+                        ui_debug "Deleting file: $item"
                         ui_msg "Removing distfile: $item"
 
                         if {[catch {file delete $currentPath} error]} {
@@ -135,6 +137,8 @@
 
                         # If the directory is now empty, recursively call on this directory, to delete it.
                         if {[is_empty_dir $dir]} {
+
+                            ui_debug "Current directory is empty. Walking to $dir"
                             walk_files $dir $delete $dist_paths
                         }
                     }
@@ -187,20 +191,25 @@
 
             # Add the full file path to the list, depending where it's located.
             if {[file isfile $root_path]} {
+                ui_debug "Appending $root_path."
                 lappend dist_path $root_path
 
             } else {
                 if {[file isfile $home_path]} {
+                    ui_debug "Appending $home_path"
                     lappend dist_path $home_path
                 }
             }
         }
 
+        ui_debug "Calling walk_files on root directory."
+
         # Walk through each directory, and delete any files found. Alert the user if no files were found.
         if {[walk_files $root_dist yes $dist_path] eq "no"} {
             ui_msg "No distfiles found in root directory."
         }
 
+        ui_debug "Calling walk_files on home directory."
         # FIXME: Only commented because I accidentally delete all my dotfiles (including the home_dist location). It does in fact work on normal machines.
         #if {[walk_files $home_dist yes $dist_path] eq "no"} {
         #    ui_msg "No distfiles found in home directory."
@@ -231,8 +240,10 @@
         #           1 if inactive, 0 if active.
 
         if {[lindex $app 4] == 0} {
+            ui_debug "App, [lindex $app 0], is inactive."
             return 1
         }
+        ui_debug "App, [lindex $app 0], is not inactive."
         return 0
     }
 
@@ -259,6 +270,8 @@
         # Returns:
         #           None
 
+        ui_debug "Updating last run information."
+
         set path    [file join ${macports::portdbpath} last_reclaim.txt]
         set fd      [open $path w]
         puts $fd    [clock seconds]
@@ -274,8 +287,10 @@
         # Returns: 
         #           None
 
-        set path    [file join ${macports::portdbpath} last_reclaim.txt]
+        ui_debug "Checking last run information."
 
+        set path [file join ${macports::portdbpath} last_reclaim.txt]
+
         if {[file exists $path]} {
 
             set fd      [open $path r]
@@ -304,6 +319,8 @@
         set inactive_names  [list]
         set inactive_count  0
 
+        ui_debug "Iterating through all inactive apps."
+
         foreach app $apps {
 
             if { [is_inactive $app] } {
@@ -324,22 +341,20 @@
             set input [gets stdin]
             if {$input eq "Y" || $input eq "y" } {
 
+                ui_debug "Iterating through all inactive apps... again."
+
                 foreach app $inactive_apps {
-
                     set name [lindex $app 0]
 
                     # Get all dependents for the current application
                     if {[catch {set dependents [registry::list_dependents $name [lindex 1] [lindex 2] [lindex 3]]} error]} {
                         ui_error "something went wrong when trying to enumerate all dependents for $name"
                     }
-
                     if {dependents ne ""} {
-
                         ui_warn "the following application ($name) is a dependent for $dependents. Are you positive you'd like to uninstall this 
                                  (this could break other applications)? \[Y/N\]"
 
                         set input [gets stdin]
-
                         if { $input eq "N" || "n" } {
                             ui_msg "Skipping application."
                             continue
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20140620/02446a6b/attachment-0001.html>


More information about the macports-changes mailing list