[51439] branches/gsoc09-logging/base/src/macports1.0/macports.tcl

enl at macports.org enl at macports.org
Sun May 24 23:53:34 PDT 2009


Revision: 51439
          http://trac.macports.org/changeset/51439
Author:   enl at macports.org
Date:     2009-05-24 23:53:33 -0700 (Sun, 24 May 2009)
Log Message:
-----------
Moved logfile to ${prefix}/var/macports/${portname}/

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

Modified: branches/gsoc09-logging/base/src/macports1.0/macports.tcl
===================================================================
--- branches/gsoc09-logging/base/src/macports1.0/macports.tcl	2009-05-25 06:45:22 UTC (rev 51438)
+++ branches/gsoc09-logging/base/src/macports1.0/macports.tcl	2009-05-25 06:53:33 UTC (rev 51439)
@@ -106,18 +106,36 @@
     return 0
 }
 
-proc macports::init_logging {portpath} {
-    global ::debuglog ::debuglogname macports::channels
-    append portpath "/work/logs"
-    if ![file exists $portpath] {
-        file mkdir $portpath
+proc macports::init_logging {portname} {
+    global ::debuglog ::debuglogname macports::channels macports::prefix
+    set logname $macports::prefix
+    
+    # I am not sure tcl can handle mkdir -p, to make stuff below easier.
+    # first we create ${prefix}/var/macports/
+    append logname "/var/macports"
+    if ![file exists $logname] {
+        file mkdir $logname
     }
-    append portpath "/main.log"
-    set ::debuglogname $portpath
 
+    # second we create ${prefix}/var/macports/logs
+    append logname "/logs"
+    if ![file exists $logname] {
+        file mkdir $logname
+    }
+
+    # third we create ${prefix}/var/macports/logs/${portname}
+    append logname "/$portname"
+    if ![file exists $logname] {
+        file mkdir $logname
+    }
+    
+    append logname "/main.log"
+    puts $logname
+    set ::debuglogname $logname
+
     # Recreate the file if already exists
     if {[file exists $::debuglogname]} {
-        file delete $::debuglogname
+        file delete -force $::debuglogname
     }
     set ::debuglog [open $::debuglogname w]
 
@@ -1363,8 +1381,8 @@
     if {[$workername eval check_variants variations $target] != 0} {
         return 1
     }
-    set portpath [ditem_key $mport portpath]
-    macports::init_logging $portpath
+    set portname [_mportkey $mport name]
+    macports::init_logging $portname
     # Before we build the port, we must build its dependencies.
     # XXX: need a more general way of comparing against targets
     set dlist {}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090524/c25910e4/attachment.html>


More information about the macports-changes mailing list