[51303] branches/gsoc09-logging/base/src

enl at macports.org enl at macports.org
Fri May 22 07:28:29 PDT 2009


Revision: 51303
          http://trac.macports.org/changeset/51303
Author:   enl at macports.org
Date:     2009-05-22 07:28:29 -0700 (Fri, 22 May 2009)
Log Message:
-----------
Ticket #18719 + autoclean toggle

Modified Paths:
--------------
    branches/gsoc09-logging/base/src/macports1.0/macports.tcl
    branches/gsoc09-logging/base/src/port/port.tcl

Modified: branches/gsoc09-logging/base/src/macports1.0/macports.tcl
===================================================================
--- branches/gsoc09-logging/base/src/macports1.0/macports.tcl	2009-05-22 12:08:35 UTC (rev 51302)
+++ branches/gsoc09-logging/base/src/macports1.0/macports.tcl	2009-05-22 14:28:29 UTC (rev 51303)
@@ -108,6 +108,8 @@
 
 
 proc macports::ui_init {priority args} {
+    global macports::channels
+
     # Get the list of channels.
     try {
         set channels [ui_channels $priority]
@@ -116,8 +118,7 @@
     }
 
     # Simplify ui_$priority.
-    set nbchans [llength $channels]
-    if {$nbchans == 0} {
+    if {[llength $channels] == 0} {
         proc ::ui_$priority {args} {}
     } else {
         try {
@@ -129,26 +130,16 @@
         try {
             eval ::ui_init $priority $prefix $channels $args
         } catch * {
-            if {$nbchans == 1} {
-                set chan [lindex $channels 0]
-                proc ::ui_$priority {args} [subst {
+            proc ::ui_$priority {args} [subst {
+                global macports::channels
+                foreach chan {$macports::channels} {
                     if {\[lindex \$args 0\] == "-nonewline"} {
-                        puts -nonewline $chan "$prefix\[lindex \$args 1\]"
+                        puts -nonewline \$chan "$prefix\[lindex \$args 1\]"
                     } else {
-                        puts $chan "$prefix\[lindex \$args 0\]"
+                        puts \$chan "$prefix\[lindex \$args 0\]"
                     }
-                }]
-            } else {
-                proc ::ui_$priority {args} [subst {
-                    foreach chan \$channels {
-                        if {\[lindex \$args 0\] == "-nonewline"} {
-                            puts -nonewline $chan "$prefix\[lindex \$args 1\]"
-                        } else {
-                            puts $chan "$prefix\[lindex \$args 0\]"
-                        }
-                    }
-                }]
-            }
+                }
+            }]
         }
 
         # Call ui_$priority

Modified: branches/gsoc09-logging/base/src/port/port.tcl
===================================================================
--- branches/gsoc09-logging/base/src/port/port.tcl	2009-05-22 12:08:35 UTC (rev 51302)
+++ branches/gsoc09-logging/base/src/port/port.tcl	2009-05-22 14:28:29 UTC (rev 51303)
@@ -39,7 +39,22 @@
 package require macports
 package require Pextlib 1.0
 
+trace add execution exit enter exit_cleanup
 
+proc exit_cleanup {commandstring op} {
+    global exit_status global_options ::debuglog ::debuglogname
+    if {[info exists ::debuglog]} {
+        close $::debuglog
+        if {($exit_status != 0) || ([info exists global_options(ports_autoclean)] && !$global_options(ports_autoclean))} {
+            puts "See the debug log at $::debuglogname"
+        } else {
+            file delete -force $::debuglogname
+            puts "deleting log"
+        }
+    }
+}
+
+
 # Standard procedures
 proc print_usage {{verbose 1}} {
     global cmdname
@@ -156,6 +171,15 @@
     }
 }
 
+proc ui_channels {priority} {
+    global ::debuglog ::debuglogname
+    set default_channel [macports::ui_channels_default $priority]
+    if {![info exists ::debuglog]} {
+        set ::debuglogname [mktemp /tmp/macports_debug.XXXXXX]
+        set ::debuglog [open $::debuglogname w]
+    }
+    return [concat $default_channel $::debuglog]
+}
 
 # Form a composite version as is sometimes used for registry functions
 proc composite_version {version variations {emptyVersionOkay 0}} {
@@ -3648,6 +3672,7 @@
 set global_options_base [array get global_options]
 
 # First process any remaining args as action(s)
+global exit_status
 set exit_status 0
 if { [llength $remaining_args] > 0 } {
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090522/670b9533/attachment-0001.html>


More information about the macports-changes mailing list