[61699] trunk/base/src/macports1.0/macports.tcl

jmr at macports.org jmr at macports.org
Sat Dec 19 01:49:10 PST 2009


Revision: 61699
          http://trac.macports.org/changeset/61699
Author:   jmr at macports.org
Date:     2009-12-19 01:49:06 -0800 (Sat, 19 Dec 2009)
Log Message:
-----------
logging fixes:
 * close logs before deleting
 * restore log name as well as fd in _mportexec (#22898)
 * save & restore previous log in _upgrade_mport_deps
 * print path to log for failed dependencies too
 * don't log clean target

Modified Paths:
--------------
    trunk/base/src/macports1.0/macports.tcl

Modified: trunk/base/src/macports1.0/macports.tcl
===================================================================
--- trunk/base/src/macports1.0/macports.tcl	2009-12-19 07:53:12 UTC (rev 61698)
+++ trunk/base/src/macports1.0/macports.tcl	2009-12-19 09:49:06 UTC (rev 61699)
@@ -125,13 +125,13 @@
     ui_debug "logging to $logname"
     set ::debuglogname $logname
 
+    if {[info exists ::debuglog]} {
+        close $::debuglog
+    }
     # Recreate the file if already exists
     if {[file exists $::debuglogname]} {
         file delete -force $::debuglogname
     }
-    if {[info exists ::debuglog]} {
-        close $::debuglog
-    }
     set ::debuglog [open $::debuglogname w]
     puts $::debuglog "version:1"
     # Add our log-channel to all already initialized channels
@@ -1495,9 +1495,10 @@
 ### _mportexec is private; may change without notice
 
 proc _mportexec {target mport} {
-    global ::debuglog
+    global ::debuglog ::debuglogname
     if {[info exists ::debuglog]} {
         set previouslog $::debuglog
+        set previouslogname $::debuglogname
     }
     set portname [_mportkey $mport name]
     ui_debug "Starting logging for $portname"
@@ -1519,12 +1520,13 @@
         }
         if {[info exists previouslog]} {
             set ::debuglog $previouslog
+            set ::debuglogname $previouslogname
         }
         return 0
     } else {
         # An error occurred.
-        if {[info exists previouslog]} {
-            set ::debuglog $previouslog
+        if {[info exists ::debuglogname]} {
+            ui_msg "Log for $portname is at: $::debuglogname"
         }
         return 1
     }
@@ -1542,7 +1544,9 @@
         return 1
     }
     set portname [_mportkey $mport name]
-    macports::init_logging $portname
+    if {$target != "clean"} {
+        macports::init_logging $portname
+    }
 
     # Before we build the port, we must build its dependencies.
     # XXX: need a more general way of comparing against targets
@@ -1638,6 +1642,11 @@
 
 # upgrade any dependencies of mport that are installed and needed for target
 proc macports::_upgrade_mport_deps {mport target} {
+    global ::debuglog ::debuglogname
+    if {[info exists ::debuglog]} {
+        set previouslog $::debuglog
+        set previouslogname $::debuglogname
+    }
     set options [ditem_key $mport options]
     set deptypes [macports::_deptypes_for_target $target]
     array set portinfo [mportinfo $mport]
@@ -1661,6 +1670,10 @@
             }
         }
     }
+    if {[info exists previouslog]} {
+        set ::debuglog $previouslog
+        set ::debuglogname $previouslogname
+    }
 }
 
 # returns the name of the port that will actually be satisfying $depspec
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20091219/7991a16a/attachment.html>


More information about the macports-changes mailing list