[64293] branches/images-and-archives/base

blb at macports.org blb at macports.org
Sun Feb 28 12:56:56 PST 2010


Revision: 64293
          http://trac.macports.org/changeset/64293
Author:   blb at macports.org
Date:     2010-02-28 12:56:54 -0800 (Sun, 28 Feb 2010)
Log Message:
-----------
Merge from trunk, up through r63397, just prior to reg2 work

Revision Links:
--------------
    http://trac.macports.org/changeset/63397

Modified Paths:
--------------
    branches/images-and-archives/base/doc/variants.conf
    branches/images-and-archives/base/src/macports1.0/macports.tcl
    branches/images-and-archives/base/src/port/port.tcl
    branches/images-and-archives/base/src/port1.0/portstartupitem.tcl

Property Changed:
----------------
    branches/images-and-archives/base/


Property changes on: branches/images-and-archives/base
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/gsoc08-privileges/base:37343-46937
/branches/gsoc09-logging/base:51231-60371
/branches/universal-sanity/base:51872-52323
/branches/variant-descs-14482/base:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base:50249-62807
/users/perry/base-bugs_and_notes:45682-46060
/users/perry/base-select:44044-44692
   + /branches/gsoc08-privileges/base:37343-46937
/branches/gsoc09-logging/base:51231-60371
/branches/universal-sanity/base:51872-52323
/branches/variant-descs-14482/base:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base:50249-63397
/users/perry/base-bugs_and_notes:45682-46060
/users/perry/base-select:44044-44692

Modified: branches/images-and-archives/base/doc/variants.conf
===================================================================
--- branches/images-and-archives/base/doc/variants.conf	2010-02-28 20:13:29 UTC (rev 64292)
+++ branches/images-and-archives/base/doc/variants.conf	2010-02-28 20:56:54 UTC (rev 64293)
@@ -1,11 +1,6 @@
 # To specify global variants to use for all port builds,
 # customize this file to list variant settings you want.
 #
-# Be sure to uncomment/define the variants_conf setting
-# in the system wide ${prefix}/etc/macports/macports.conf
-# file or in your personal ~/.macports/macports.conf to
-# point to this file to enable this feature.
-#
 # Any variants specified here that are not supported by
 # a port will just be ignored. Multiple variants can be
 # specified per line, or one per line is also allowed.

Modified: branches/images-and-archives/base/src/macports1.0/macports.tcl
===================================================================
--- branches/images-and-archives/base/src/macports1.0/macports.tcl	2010-02-28 20:13:29 UTC (rev 64292)
+++ branches/images-and-archives/base/src/macports1.0/macports.tcl	2010-02-28 20:56:54 UTC (rev 64293)
@@ -109,43 +109,44 @@
     return 0
 }
 
-proc macports::init_logging {portname} {
+proc macports::init_logging {mport} {
     global macports::channels macports::portdbpath
 
     if {[getuid] == 0 && [geteuid] != 0} {
         seteuid 0
     }
-    set logspath [file join $macports::portdbpath logs]
-    if {([file exists $logspath] && ![file writable $logspath]) || (![file exists $logspath] && ![file writable $macports::portdbpath])} {
-        ui_debug "logging disabled, can't write to $logspath"
+    if {[catch {macports::ch_logging $mport} err]} {
+        ui_debug "Logging disabled, error opening log file: $err"
         return 1
     }
-    macports::ch_logging $portname
     # Add our log-channel to all already initialized channels
     foreach key [array names channels] {
         set macports::channels($key) [concat $macports::channels($key) "debuglog"]
     }
     return 0
 }
-proc macports::ch_logging {portname} {
-    global ::debuglog ::debuglogname macports::portdbpath
-    
+proc macports::ch_logging {mport} {
+    global ::debuglog ::debuglogname
+
+    set portname [_mportkey $mport name]
+    set portpath [_mportkey $mport portpath]
+
     ui_debug "Starting logging for $portname"
 
-    set logname [file join $macports::portdbpath "logs/$portname"]
+    set logname [macports::getportlogpath $portpath]
     file mkdir $logname
     set logname [file join $logname "main.log"]
 
     set ::debuglogname $logname
- 
+
     # Truncate the file if already exists
     set ::debuglog [open $::debuglogname w]
     puts $::debuglog "version:1"
 }
-proc macports::push_log {portname} {
+proc macports::push_log {mport} {
     global ::logstack ::logenabled ::debuglog ::debuglogname
     if {![info exists ::logenabled]} {
-        if {[macports::init_logging $portname] == 0} {
+        if {[macports::init_logging $mport] == 0} {
             set ::logenabled yes
             set ::logstack [list [list $::debuglog $::debuglogname]]
             return
@@ -154,7 +155,10 @@
         }
     }
     if {$::logenabled} {
-        macports::ch_logging $portname
+        if {[catch {macports::ch_logging $mport} err]} {
+            ui_debug "Logging disabled, error opening log file: $err"
+            return
+        }
         lappend ::logstack [list $::debuglog $::debuglogname]
     }
 }
@@ -749,6 +753,8 @@
         } else {
             set macports::build_arch ""
         }
+    } else {
+        set macports::build_arch [lindex $macports::build_arch 0]
     }
 
     # Platform Settings
@@ -1474,7 +1480,7 @@
 
 proc _mportexec {target mport} {
     set portname [_mportkey $mport name]
-    macports::push_log $portname
+    macports::push_log $mport
     # xxx: set the work path?
     set workername [ditem_key $mport workername]
     if {![catch {$workername eval check_variants variations $target} result] && $result == 0 &&
@@ -1514,7 +1520,7 @@
     }
     set portname [_mportkey $mport name]
     if {$target != "clean"} {
-        macports::push_log $portname
+        macports::push_log $mport
     }
 
     # Before we build the port, we must build its dependencies.
@@ -1700,6 +1706,13 @@
     return [file join $portdbpath build $port_path]
 }
 
+proc macports::getportlogpath {id} {
+    global macports::portdbpath
+    regsub {://} $id {.} port_path
+    regsub -all {/} $port_path {_} port_path
+    return [file join $portdbpath logs $port_path]
+}
+
 proc macports::getportworkpath_from_buildpath {portbuildpath} {
     return [file join $portbuildpath work]
 }

Modified: branches/images-and-archives/base/src/port/port.tcl
===================================================================
--- branches/images-and-archives/base/src/port/port.tcl	2010-02-28 20:13:29 UTC (rev 64292)
+++ branches/images-and-archives/base/src/port/port.tcl	2010-02-28 20:56:54 UTC (rev 64293)
@@ -126,7 +126,32 @@
     exit 1
 }
 
+##
+# Helper function to define constants
+#
+# Constants defined with const can simply be accessed in the same way as
+# calling a proc.
+#
+# Example:
+# const FOO 42
+# puts [FOO]
+#
+# @param name variable name
+# @param value constant variable value
+proc const {name args} {
+    interp alias {} $name {} _const [expr $args]
+}
 
+##
+# Helper function to define constants
+#
+# @see const
+proc _const value {
+    return $value
+}
+
+
+
 # Produce an error message, and exit, unless
 # we're handling errors in a soft fashion, in which
 # case we continue
@@ -1326,9 +1351,9 @@
         }
         set args ""
         set needed [action_needs_portlist $action]
-        if {[action_args_const strings] == $needed} {
+        if {[ACTION_ARGS_STRINGS] == $needed} {
             set args " <arguments>"
-        } elseif {[action_args_const strings] == $needed} {
+        } elseif {[ACTION_ARGS_STRINGS] == $needed} {
             set args " <portlist>"
         }
 
@@ -1402,12 +1427,9 @@
 
 
 proc action_log { action portlist opts } {
-    global global_options 
-    set logfile "$macports::prefix/var/macports/logs/"
-    #puts "$opts"
-    if {[llength $portlist] == 0} {
-        print_help
-        return 0
+    global global_options
+    if {[require_portlist portlist]} {
+        return 1
     }
     foreachport $portlist {
         # If we have a url, use that, since it's most specific
@@ -1444,18 +1466,12 @@
             array unset portinfo
             array set portinfo [lindex $result 1]
         }
-        if {[catch {set mport [mportopen $porturl [array get options] [array get merged_variations]]} result]} {
-            ui_debug "$::errorInfo"
-            break_softcontinue "Unable to open port: $result" 1 status
-         }
-         array unset portinfo
-         array set portinfo [mportinfo $mport]
-
-         append logfile $portinfo(name)
-         append logfile "/main.log"
-         mportclose $mport                        
-         if {[file exists $logfile]} {
-            set fp [open $logfile r]
+        set portpath [macports::getportdir $porturl]
+        set logfile [file join [macports::getportlogpath $portpath] "main.log"]
+        if {[file exists $logfile]} {
+            if {[catch {set fp [open $logfile r]} result]} {
+                break_softcontinue "Could not open file $logfile: $result" 1 status
+            }
             set data [read $fp]
             set data [split $data "\n"]
 
@@ -1472,17 +1488,15 @@
             }
             set match ""
             foreach line $data {
-                set exp "^:($prefix|any):($stage|any) .*$"
-                regexp $exp $line match
-                if {$match == $line} {
-                    regsub "^:\[a-z\]*:\[a-z\]* "  $line "" line
-                    puts $line
+                set exp "^:($prefix|any):($stage|any) (.*)$"
+                if {[regexp $exp $line -> priority phase msg] == 1} {
+                    puts "[macports::ui_prefix_default $priority]$msg"
                 }
             }
-            
+
             close $fp
         } else {
-            ui_msg "Log file not found"
+            ui_msg "Log file for port $portname not found"
         }
     }
     return 0
@@ -2746,20 +2760,24 @@
 proc action_echo { action portlist opts } {
     # Simply echo back the port specs given to this command
     foreachport $portlist {
-        set opts {}
-        foreach { key value } [array get options] {
-            lappend opts "$key=$value"
-        }
-        
-        set composite_version [composite_version $portversion [array get variations] 1]
-        if { $composite_version != "" } {
-            set ver_field "@$composite_version"
+        if {![macports::ui_isset ports_quiet]} {
+            set opts {}
+            foreach { key value } [array get options] {
+                lappend opts "$key=$value"
+            }
+
+            set composite_version [composite_version $portversion [array get variations] 1]
+            if { $composite_version != "" } {
+                set ver_field "@$composite_version"
+            } else {
+                set ver_field ""
+            }
+            puts [format "%-30s %s %s" $portname $ver_field  [join $opts " "]]
         } else {
-            set ver_field ""
+            puts "$portname"
         }
-        puts [format "%-30s %s %s" $portname $ver_field  [join $opts " "]]
     }
-    
+
     return 0
 }
 
@@ -3062,101 +3080,92 @@
 #   0 none        Does not expect any text argument
 #   1 strings     Expects some strings as text argument
 #   2 ports       Wants an expanded list of ports as text argument
-# Use action_args_const to translate them
 global action_array
-proc action_args_const {arg} {
-    switch -- $arg {
-        none {
-            return 0
-        }
-        strings {
-            return 1
-        }
-        default -
-        ports {
-            return 2
-        }
-    }
-}
+
+# Define global constants
+const ACTION_ARGS_NONE 0
+const ACTION_ARGS_STRINGS 1
+const ACTION_ARGS_PORTS 2
+
 array set action_array [list \
-    usage          [list action_usage           [action_args_const strings]] \
-    help           [list action_help            [action_args_const strings]] \
+    usage          [list action_usage           [ACTION_ARGS_STRINGS]] \
+    help           [list action_help            [ACTION_ARGS_STRINGS]] \
     \
-    echo           [list action_echo            [action_args_const ports]] \
+    echo           [list action_echo            [ACTION_ARGS_PORTS]] \
     \
-    info           [list action_info            [action_args_const ports]] \
-    notes          [list action_notes           [action_args_const ports]] \
-    provides       [list action_provides        [action_args_const strings]] \
-    installimage   [list action_installimage    [action_args_const strings]] \
-    log         [list action_log            [action_args_const ports]] \
+    info           [list action_info            [ACTION_ARGS_PORTS]] \
+    notes          [list action_notes           [ACTION_ARGS_PORTS]] \
+    provides       [list action_provides        [ACTION_ARGS_STRINGS]] \
+    installimage   [list action_installimage    [ACTION_ARGS_STRINGS]] \
+    log            [list action_log             [ACTION_ARGS_PORTS]] \
     \
-    activate       [list action_activate        [action_args_const ports]] \
-    deactivate     [list action_deactivate      [action_args_const ports]] \
+    activate       [list action_activate        [ACTION_ARGS_PORTS]] \
+    deactivate     [list action_deactivate      [ACTION_ARGS_PORTS]] \
     \
-    select         [list action_select          [action_args_const strings]] \
+    select         [list action_select          [ACTION_ARGS_STRINGS]] \
     \
-    sync           [list action_sync            [action_args_const none]] \
-    selfupdate     [list action_selfupdate      [action_args_const none]] \
+    sync           [list action_sync            [ACTION_ARGS_NONE]] \
+    selfupdate     [list action_selfupdate      [ACTION_ARGS_NONE]] \
     \
-    upgrade        [list action_upgrade         [action_args_const ports]] \
+    upgrade        [list action_upgrade         [ACTION_ARGS_PORTS]] \
     \
-    version        [list action_version         [action_args_const none]] \
-    platform       [list action_platform        [action_args_const none]] \
+    version        [list action_version         [ACTION_ARGS_NONE]] \
+    platform       [list action_platform        [ACTION_ARGS_NONE]] \
     \
-    uninstall      [list action_uninstall       [action_args_const ports]] \
+    uninstall      [list action_uninstall       [ACTION_ARGS_PORTS]] \
     \
-    installed      [list action_installed       [action_args_const ports]] \
-    outdated       [list action_outdated        [action_args_const ports]] \
-    contents       [list action_contents        [action_args_const ports]] \
-    dependents     [list action_dependents      [action_args_const ports]] \
-    deps           [list action_info            [action_args_const ports]] \
-    variants       [list action_variants        [action_args_const ports]] \
+    installed      [list action_installed       [ACTION_ARGS_PORTS]] \
+    outdated       [list action_outdated        [ACTION_ARGS_PORTS]] \
+    contents       [list action_contents        [ACTION_ARGS_PORTS]] \
+    dependents     [list action_dependents      [ACTION_ARGS_PORTS]] \
+    deps           [list action_info            [ACTION_ARGS_PORTS]] \
+    variants       [list action_variants        [ACTION_ARGS_PORTS]] \
     \
-    search         [list action_search          [action_args_const strings]] \
-    list           [list action_list            [action_args_const ports]] \
+    search         [list action_search          [ACTION_ARGS_STRINGS]] \
+    list           [list action_list            [ACTION_ARGS_PORTS]] \
     \
-    ed             [list action_portcmds        [action_args_const ports]] \
-    edit           [list action_portcmds        [action_args_const ports]] \
-    cat            [list action_portcmds        [action_args_const ports]] \
-    dir            [list action_portcmds        [action_args_const ports]] \
-    work           [list action_portcmds        [action_args_const ports]] \
-    cd             [list action_portcmds        [action_args_const ports]] \
-    url            [list action_portcmds        [action_args_const ports]] \
-    file           [list action_portcmds        [action_args_const ports]] \
-    gohome         [list action_portcmds        [action_args_const ports]] \
+    ed             [list action_portcmds        [ACTION_ARGS_PORTS]] \
+    edit           [list action_portcmds        [ACTION_ARGS_PORTS]] \
+    cat            [list action_portcmds        [ACTION_ARGS_PORTS]] \
+    dir            [list action_portcmds        [ACTION_ARGS_PORTS]] \
+    work           [list action_portcmds        [ACTION_ARGS_PORTS]] \
+    cd             [list action_portcmds        [ACTION_ARGS_PORTS]] \
+    url            [list action_portcmds        [ACTION_ARGS_PORTS]] \
+    file           [list action_portcmds        [ACTION_ARGS_PORTS]] \
+    gohome         [list action_portcmds        [ACTION_ARGS_PORTS]] \
     \
-    fetch          [list action_target          [action_args_const ports]] \
-    checksum       [list action_target          [action_args_const ports]] \
-    extract        [list action_target          [action_args_const ports]] \
-    patch          [list action_target          [action_args_const ports]] \
-    configure      [list action_target          [action_args_const ports]] \
-    build          [list action_target          [action_args_const ports]] \
-    imagefile      [list action_target          [action_args_const ports]] \
-    destroot       [list action_target          [action_args_const ports]] \
-    install        [list action_target          [action_args_const ports]] \
-    clean          [list action_target          [action_args_const ports]] \
-    test           [list action_target          [action_args_const ports]] \
-    lint           [list action_target          [action_args_const ports]] \
-    submit         [list action_target          [action_args_const ports]] \
-    trace          [list action_target          [action_args_const ports]] \
-    livecheck      [list action_target          [action_args_const ports]] \
-    distcheck      [list action_target          [action_args_const ports]] \
-    mirror         [list action_target          [action_args_const ports]] \
-    load           [list action_target          [action_args_const ports]] \
-    unload         [list action_target          [action_args_const ports]] \
-    distfiles      [list action_target          [action_args_const ports]] \
+    fetch          [list action_target          [ACTION_ARGS_PORTS]] \
+    checksum       [list action_target          [ACTION_ARGS_PORTS]] \
+    extract        [list action_target          [ACTION_ARGS_PORTS]] \
+    patch          [list action_target          [ACTION_ARGS_PORTS]] \
+    configure      [list action_target          [ACTION_ARGS_PORTS]] \
+    build          [list action_target          [ACTION_ARGS_PORTS]] \
+    imagefile      [list action_target          [ACTION_ARGS_PORTS]] \
+    destroot       [list action_target          [ACTION_ARGS_PORTS]] \
+    install        [list action_target          [ACTION_ARGS_PORTS]] \
+    clean          [list action_target          [ACTION_ARGS_PORTS]] \
+    test           [list action_target          [ACTION_ARGS_PORTS]] \
+    lint           [list action_target          [ACTION_ARGS_PORTS]] \
+    submit         [list action_target          [ACTION_ARGS_PORTS]] \
+    trace          [list action_target          [ACTION_ARGS_PORTS]] \
+    livecheck      [list action_target          [ACTION_ARGS_PORTS]] \
+    distcheck      [list action_target          [ACTION_ARGS_PORTS]] \
+    mirror         [list action_target          [ACTION_ARGS_PORTS]] \
+    load           [list action_target          [ACTION_ARGS_PORTS]] \
+    unload         [list action_target          [ACTION_ARGS_PORTS]] \
+    distfiles      [list action_target          [ACTION_ARGS_PORTS]] \
     \
-    dmg            [list action_target          [action_args_const ports]] \
-    mdmg           [list action_target          [action_args_const ports]] \
-    dpkg           [list action_target          [action_args_const ports]] \
-    mpkg           [list action_target          [action_args_const ports]] \
-    pkg            [list action_target          [action_args_const ports]] \
-    portpkg        [list action_target          [action_args_const ports]] \
-    rpm            [list action_target          [action_args_const ports]] \
-    srpm           [list action_target          [action_args_const ports]] \
+    dmg            [list action_target          [ACTION_ARGS_PORTS]] \
+    mdmg           [list action_target          [ACTION_ARGS_PORTS]] \
+    dpkg           [list action_target          [ACTION_ARGS_PORTS]] \
+    mpkg           [list action_target          [ACTION_ARGS_PORTS]] \
+    pkg            [list action_target          [ACTION_ARGS_PORTS]] \
+    portpkg        [list action_target          [ACTION_ARGS_PORTS]] \
+    rpm            [list action_target          [ACTION_ARGS_PORTS]] \
+    srpm           [list action_target          [ACTION_ARGS_PORTS]] \
     \
-    quit           [list action_exit            [action_args_const none]] \
-    exit           [list action_exit            [action_args_const none]] \
+    quit           [list action_exit            [ACTION_ARGS_NONE]] \
+    exit           [list action_exit            [ACTION_ARGS_NONE]] \
 ]
 
 proc find_action_proc { action } {
@@ -3452,16 +3461,16 @@
                 set private_options(ports_no_args) yes
             }
             default {
-                if {[action_args_const none] == $expand} {
+                if {[ACTION_ARGS_NONE] == $expand} {
                     ui_error "$action does not accept string arguments"
                     set action_status 1
                     break
-                } elseif {[action_args_const strings] == $expand} {
+                } elseif {[ACTION_ARGS_STRINGS] == $expand} {
                     while { [moreargs] && ![match ";"] } {
                         lappend portlist [lookahead]
                         advance
                     }
-                } elseif {[action_args_const ports] == $expand} {
+                } elseif {[ACTION_ARGS_PORTS] == $expand} {
                     # Parse port specifications into portlist
                     if {![portExpr portlist]} {
                         ui_error "Improper expression syntax while processing parameters"

Modified: branches/images-and-archives/base/src/port1.0/portstartupitem.tcl
===================================================================
--- branches/images-and-archives/base/src/port1.0/portstartupitem.tcl	2010-02-28 20:13:29 UTC (rev 64292)
+++ branches/images-and-archives/base/src/port1.0/portstartupitem.tcl	2010-02-28 20:56:54 UTC (rev 64293)
@@ -574,7 +574,6 @@
     puts ${plist} "<key>Debug</key><false/>"
     puts ${plist} "<key>Disabled</key><true/>"
     puts ${plist} "<key>OnDemand</key><false/>"
-    puts ${plist} "<key>RunAtLoad</key><false/>"
     
     if { [llength ${startupitem.logfile}] } {
         puts ${plist} "<key>StandardOutPath</key><string>${startupitem.logfile}</string>"
@@ -607,7 +606,7 @@
     ui_msg "# by default. Execute the following command to start it,"
     ui_msg "# and to cause it to launch at startup:"
     ui_msg "#"
-    ui_msg "# sudo launchctl load -w /Library/${daemondest}/${plistname}"
+    ui_msg "# sudo port load ${name}"
     ui_msg "###########################################################"
 }
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100228/020b412b/attachment-0001.html>


More information about the macports-changes mailing list