Changeset 64293


Ignore:
Timestamp:
Feb 28, 2010, 8:56:54 PM (11 years ago)
Author:
blb@…
Message:

Merge from trunk, up through r63397, just prior to reg2 work

Location:
branches/images-and-archives/base
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/images-and-archives/base

  • branches/images-and-archives/base/doc/variants.conf

    r26177 r64293  
    11# To specify global variants to use for all port builds,
    22# customize this file to list variant settings you want.
    3 #
    4 # Be sure to uncomment/define the variants_conf setting
    5 # in the system wide ${prefix}/etc/macports/macports.conf
    6 # file or in your personal ~/.macports/macports.conf to
    7 # point to this file to enable this feature.
    83#
    94# Any variants specified here that are not supported by
  • branches/images-and-archives/base/src/macports1.0/macports.tcl

    r62809 r64293  
    110110}
    111111
    112 proc macports::init_logging {portname} {
     112proc macports::init_logging {mport} {
    113113    global macports::channels macports::portdbpath
    114114
     
    116116        seteuid 0
    117117    }
    118     set logspath [file join $macports::portdbpath logs]
    119     if {([file exists $logspath] && ![file writable $logspath]) || (![file exists $logspath] && ![file writable $macports::portdbpath])} {
    120         ui_debug "logging disabled, can't write to $logspath"
     118    if {[catch {macports::ch_logging $mport} err]} {
     119        ui_debug "Logging disabled, error opening log file: $err"
    121120        return 1
    122121    }
    123     macports::ch_logging $portname
    124122    # Add our log-channel to all already initialized channels
    125123    foreach key [array names channels] {
     
    128126    return 0
    129127}
    130 proc macports::ch_logging {portname} {
    131     global ::debuglog ::debuglogname macports::portdbpath
    132    
     128proc macports::ch_logging {mport} {
     129    global ::debuglog ::debuglogname
     130
     131    set portname [_mportkey $mport name]
     132    set portpath [_mportkey $mport portpath]
     133
    133134    ui_debug "Starting logging for $portname"
    134135
    135     set logname [file join $macports::portdbpath "logs/$portname"]
     136    set logname [macports::getportlogpath $portpath]
    136137    file mkdir $logname
    137138    set logname [file join $logname "main.log"]
    138139
    139140    set ::debuglogname $logname
    140  
     141
    141142    # Truncate the file if already exists
    142143    set ::debuglog [open $::debuglogname w]
    143144    puts $::debuglog "version:1"
    144145}
    145 proc macports::push_log {portname} {
     146proc macports::push_log {mport} {
    146147    global ::logstack ::logenabled ::debuglog ::debuglogname
    147148    if {![info exists ::logenabled]} {
    148         if {[macports::init_logging $portname] == 0} {
     149        if {[macports::init_logging $mport] == 0} {
    149150            set ::logenabled yes
    150151            set ::logstack [list [list $::debuglog $::debuglogname]]
     
    155156    }
    156157    if {$::logenabled} {
    157         macports::ch_logging $portname
     158        if {[catch {macports::ch_logging $mport} err]} {
     159            ui_debug "Logging disabled, error opening log file: $err"
     160            return
     161        }
    158162        lappend ::logstack [list $::debuglog $::debuglogname]
    159163    }
     
    750754            set macports::build_arch ""
    751755        }
     756    } else {
     757        set macports::build_arch [lindex $macports::build_arch 0]
    752758    }
    753759
     
    14751481proc _mportexec {target mport} {
    14761482    set portname [_mportkey $mport name]
    1477     macports::push_log $portname
     1483    macports::push_log $mport
    14781484    # xxx: set the work path?
    14791485    set workername [ditem_key $mport workername]
     
    15151521    set portname [_mportkey $mport name]
    15161522    if {$target != "clean"} {
    1517         macports::push_log $portname
     1523        macports::push_log $mport
    15181524    }
    15191525
     
    16991705    regsub -all {/} $port_path {_} port_path
    17001706    return [file join $portdbpath build $port_path]
     1707}
     1708
     1709proc macports::getportlogpath {id} {
     1710    global macports::portdbpath
     1711    regsub {://} $id {.} port_path
     1712    regsub -all {/} $port_path {_} port_path
     1713    return [file join $portdbpath logs $port_path]
    17011714}
    17021715
  • branches/images-and-archives/base/src/port/port.tcl

    r62809 r64293  
    127127}
    128128
     129##
     130# Helper function to define constants
     131#
     132# Constants defined with const can simply be accessed in the same way as
     133# calling a proc.
     134#
     135# Example:
     136# const FOO 42
     137# puts [FOO]
     138#
     139# @param name variable name
     140# @param value constant variable value
     141proc const {name args} {
     142    interp alias {} $name {} _const [expr $args]
     143}
     144
     145##
     146# Helper function to define constants
     147#
     148# @see const
     149proc _const value {
     150    return $value
     151}
     152
     153
    129154
    130155# Produce an error message, and exit, unless
     
    13271352        set args ""
    13281353        set needed [action_needs_portlist $action]
    1329         if {[action_args_const strings] == $needed} {
     1354        if {[ACTION_ARGS_STRINGS] == $needed} {
    13301355            set args " <arguments>"
    1331         } elseif {[action_args_const strings] == $needed} {
     1356        } elseif {[ACTION_ARGS_STRINGS] == $needed} {
    13321357            set args " <portlist>"
    13331358        }
     
    14031428
    14041429proc action_log { action portlist opts } {
    1405     global global_options
    1406     set logfile "$macports::prefix/var/macports/logs/"
    1407     #puts "$opts"
    1408     if {[llength $portlist] == 0} {
    1409         print_help
    1410         return 0
     1430    global global_options
     1431    if {[require_portlist portlist]} {
     1432        return 1
    14111433    }
    14121434    foreachport $portlist {
     
    14451467            array set portinfo [lindex $result 1]
    14461468        }
    1447         if {[catch {set mport [mportopen $porturl [array get options] [array get merged_variations]]} result]} {
    1448             ui_debug "$::errorInfo"
    1449             break_softcontinue "Unable to open port: $result" 1 status
    1450          }
    1451          array unset portinfo
    1452          array set portinfo [mportinfo $mport]
    1453 
    1454          append logfile $portinfo(name)
    1455          append logfile "/main.log"
    1456          mportclose $mport                       
    1457          if {[file exists $logfile]} {
    1458             set fp [open $logfile r]
     1469        set portpath [macports::getportdir $porturl]
     1470        set logfile [file join [macports::getportlogpath $portpath] "main.log"]
     1471        if {[file exists $logfile]} {
     1472            if {[catch {set fp [open $logfile r]} result]} {
     1473                break_softcontinue "Could not open file $logfile: $result" 1 status
     1474            }
    14591475            set data [read $fp]
    14601476            set data [split $data "\n"]
     
    14731489            set match ""
    14741490            foreach line $data {
    1475                 set exp "^:($prefix|any):($stage|any) .*$"
    1476                 regexp $exp $line match
    1477                 if {$match == $line} {
    1478                     regsub "^:\[a-z\]*:\[a-z\]* "  $line "" line
    1479                     puts $line
    1480                 }
    1481             }
    1482            
     1491                set exp "^:($prefix|any):($stage|any) (.*)$"
     1492                if {[regexp $exp $line -> priority phase msg] == 1} {
     1493                    puts "[macports::ui_prefix_default $priority]$msg"
     1494                }
     1495            }
     1496
    14831497            close $fp
    14841498        } else {
    1485             ui_msg "Log file not found"
     1499            ui_msg "Log file for port $portname not found"
    14861500        }
    14871501    }
     
    27472761    # Simply echo back the port specs given to this command
    27482762    foreachport $portlist {
    2749         set opts {}
    2750         foreach { key value } [array get options] {
    2751             lappend opts "$key=$value"
    2752         }
    2753        
    2754         set composite_version [composite_version $portversion [array get variations] 1]
    2755         if { $composite_version != "" } {
    2756             set ver_field "@$composite_version"
     2763        if {![macports::ui_isset ports_quiet]} {
     2764            set opts {}
     2765            foreach { key value } [array get options] {
     2766                lappend opts "$key=$value"
     2767            }
     2768
     2769            set composite_version [composite_version $portversion [array get variations] 1]
     2770            if { $composite_version != "" } {
     2771                set ver_field "@$composite_version"
     2772            } else {
     2773                set ver_field ""
     2774            }
     2775            puts [format "%-30s %s %s" $portname $ver_field  [join $opts " "]]
    27572776        } else {
    2758             set ver_field ""
    2759         }
    2760         puts [format "%-30s %s %s" $portname $ver_field  [join $opts " "]]
    2761     }
    2762    
     2777            puts "$portname"
     2778        }
     2779    }
     2780
    27632781    return 0
    27642782}
     
    30633081#   1 strings     Expects some strings as text argument
    30643082#   2 ports       Wants an expanded list of ports as text argument
    3065 # Use action_args_const to translate them
    30663083global action_array
    3067 proc action_args_const {arg} {
    3068     switch -- $arg {
    3069         none {
    3070             return 0
    3071         }
    3072         strings {
    3073             return 1
    3074         }
    3075         default -
    3076         ports {
    3077             return 2
    3078         }
    3079     }
    3080 }
     3084
     3085# Define global constants
     3086const ACTION_ARGS_NONE 0
     3087const ACTION_ARGS_STRINGS 1
     3088const ACTION_ARGS_PORTS 2
     3089
    30813090array set action_array [list \
    3082     usage          [list action_usage           [action_args_const strings]] \
    3083     help           [list action_help            [action_args_const strings]] \
     3091    usage          [list action_usage           [ACTION_ARGS_STRINGS]] \
     3092    help           [list action_help            [ACTION_ARGS_STRINGS]] \
    30843093    \
    3085     echo           [list action_echo            [action_args_const ports]] \
     3094    echo           [list action_echo            [ACTION_ARGS_PORTS]] \
    30863095    \
    3087     info           [list action_info            [action_args_const ports]] \
    3088     notes          [list action_notes           [action_args_const ports]] \
    3089     provides       [list action_provides        [action_args_const strings]] \
    3090     installimage   [list action_installimage    [action_args_const strings]] \
    3091     log         [list action_log            [action_args_const ports]] \
     3096    info           [list action_info            [ACTION_ARGS_PORTS]] \
     3097    notes          [list action_notes           [ACTION_ARGS_PORTS]] \
     3098    provides       [list action_provides        [ACTION_ARGS_STRINGS]] \
     3099    installimage   [list action_installimage    [ACTION_ARGS_STRINGS]] \
     3100    log            [list action_log             [ACTION_ARGS_PORTS]] \
    30923101    \
    3093     activate       [list action_activate        [action_args_const ports]] \
    3094     deactivate     [list action_deactivate      [action_args_const ports]] \
     3102    activate       [list action_activate        [ACTION_ARGS_PORTS]] \
     3103    deactivate     [list action_deactivate      [ACTION_ARGS_PORTS]] \
    30953104    \
    3096     select         [list action_select          [action_args_const strings]] \
     3105    select         [list action_select          [ACTION_ARGS_STRINGS]] \
    30973106    \
    3098     sync           [list action_sync            [action_args_const none]] \
    3099     selfupdate     [list action_selfupdate      [action_args_const none]] \
     3107    sync           [list action_sync            [ACTION_ARGS_NONE]] \
     3108    selfupdate     [list action_selfupdate      [ACTION_ARGS_NONE]] \
    31003109    \
    3101     upgrade        [list action_upgrade         [action_args_const ports]] \
     3110    upgrade        [list action_upgrade         [ACTION_ARGS_PORTS]] \
    31023111    \
    3103     version        [list action_version         [action_args_const none]] \
    3104     platform       [list action_platform        [action_args_const none]] \
     3112    version        [list action_version         [ACTION_ARGS_NONE]] \
     3113    platform       [list action_platform        [ACTION_ARGS_NONE]] \
    31053114    \
    3106     uninstall      [list action_uninstall       [action_args_const ports]] \
     3115    uninstall      [list action_uninstall       [ACTION_ARGS_PORTS]] \
    31073116    \
    3108     installed      [list action_installed       [action_args_const ports]] \
    3109     outdated       [list action_outdated        [action_args_const ports]] \
    3110     contents       [list action_contents        [action_args_const ports]] \
    3111     dependents     [list action_dependents      [action_args_const ports]] \
    3112     deps           [list action_info            [action_args_const ports]] \
    3113     variants       [list action_variants        [action_args_const ports]] \
     3117    installed      [list action_installed       [ACTION_ARGS_PORTS]] \
     3118    outdated       [list action_outdated        [ACTION_ARGS_PORTS]] \
     3119    contents       [list action_contents        [ACTION_ARGS_PORTS]] \
     3120    dependents     [list action_dependents      [ACTION_ARGS_PORTS]] \
     3121    deps           [list action_info            [ACTION_ARGS_PORTS]] \
     3122    variants       [list action_variants        [ACTION_ARGS_PORTS]] \
    31143123    \
    3115     search         [list action_search          [action_args_const strings]] \
    3116     list           [list action_list            [action_args_const ports]] \
     3124    search         [list action_search          [ACTION_ARGS_STRINGS]] \
     3125    list           [list action_list            [ACTION_ARGS_PORTS]] \
    31173126    \
    3118     ed             [list action_portcmds        [action_args_const ports]] \
    3119     edit           [list action_portcmds        [action_args_const ports]] \
    3120     cat            [list action_portcmds        [action_args_const ports]] \
    3121     dir            [list action_portcmds        [action_args_const ports]] \
    3122     work           [list action_portcmds        [action_args_const ports]] \
    3123     cd             [list action_portcmds        [action_args_const ports]] \
    3124     url            [list action_portcmds        [action_args_const ports]] \
    3125     file           [list action_portcmds        [action_args_const ports]] \
    3126     gohome         [list action_portcmds        [action_args_const ports]] \
     3127    ed             [list action_portcmds        [ACTION_ARGS_PORTS]] \
     3128    edit           [list action_portcmds        [ACTION_ARGS_PORTS]] \
     3129    cat            [list action_portcmds        [ACTION_ARGS_PORTS]] \
     3130    dir            [list action_portcmds        [ACTION_ARGS_PORTS]] \
     3131    work           [list action_portcmds        [ACTION_ARGS_PORTS]] \
     3132    cd             [list action_portcmds        [ACTION_ARGS_PORTS]] \
     3133    url            [list action_portcmds        [ACTION_ARGS_PORTS]] \
     3134    file           [list action_portcmds        [ACTION_ARGS_PORTS]] \
     3135    gohome         [list action_portcmds        [ACTION_ARGS_PORTS]] \
    31273136    \
    3128     fetch          [list action_target          [action_args_const ports]] \
    3129     checksum       [list action_target          [action_args_const ports]] \
    3130     extract        [list action_target          [action_args_const ports]] \
    3131     patch          [list action_target          [action_args_const ports]] \
    3132     configure      [list action_target          [action_args_const ports]] \
    3133     build          [list action_target          [action_args_const ports]] \
    3134     imagefile      [list action_target          [action_args_const ports]] \
    3135     destroot       [list action_target          [action_args_const ports]] \
    3136     install        [list action_target          [action_args_const ports]] \
    3137     clean          [list action_target          [action_args_const ports]] \
    3138     test           [list action_target          [action_args_const ports]] \
    3139     lint           [list action_target          [action_args_const ports]] \
    3140     submit         [list action_target          [action_args_const ports]] \
    3141     trace          [list action_target          [action_args_const ports]] \
    3142     livecheck      [list action_target          [action_args_const ports]] \
    3143     distcheck      [list action_target          [action_args_const ports]] \
    3144     mirror         [list action_target          [action_args_const ports]] \
    3145     load           [list action_target          [action_args_const ports]] \
    3146     unload         [list action_target          [action_args_const ports]] \
    3147     distfiles      [list action_target          [action_args_const ports]] \
     3137    fetch          [list action_target          [ACTION_ARGS_PORTS]] \
     3138    checksum       [list action_target          [ACTION_ARGS_PORTS]] \
     3139    extract        [list action_target          [ACTION_ARGS_PORTS]] \
     3140    patch          [list action_target          [ACTION_ARGS_PORTS]] \
     3141    configure      [list action_target          [ACTION_ARGS_PORTS]] \
     3142    build          [list action_target          [ACTION_ARGS_PORTS]] \
     3143    imagefile      [list action_target          [ACTION_ARGS_PORTS]] \
     3144    destroot       [list action_target          [ACTION_ARGS_PORTS]] \
     3145    install        [list action_target          [ACTION_ARGS_PORTS]] \
     3146    clean          [list action_target          [ACTION_ARGS_PORTS]] \
     3147    test           [list action_target          [ACTION_ARGS_PORTS]] \
     3148    lint           [list action_target          [ACTION_ARGS_PORTS]] \
     3149    submit         [list action_target          [ACTION_ARGS_PORTS]] \
     3150    trace          [list action_target          [ACTION_ARGS_PORTS]] \
     3151    livecheck      [list action_target          [ACTION_ARGS_PORTS]] \
     3152    distcheck      [list action_target          [ACTION_ARGS_PORTS]] \
     3153    mirror         [list action_target          [ACTION_ARGS_PORTS]] \
     3154    load           [list action_target          [ACTION_ARGS_PORTS]] \
     3155    unload         [list action_target          [ACTION_ARGS_PORTS]] \
     3156    distfiles      [list action_target          [ACTION_ARGS_PORTS]] \
    31483157    \
    3149     dmg            [list action_target          [action_args_const ports]] \
    3150     mdmg           [list action_target          [action_args_const ports]] \
    3151     dpkg           [list action_target          [action_args_const ports]] \
    3152     mpkg           [list action_target          [action_args_const ports]] \
    3153     pkg            [list action_target          [action_args_const ports]] \
    3154     portpkg        [list action_target          [action_args_const ports]] \
    3155     rpm            [list action_target          [action_args_const ports]] \
    3156     srpm           [list action_target          [action_args_const ports]] \
     3158    dmg            [list action_target          [ACTION_ARGS_PORTS]] \
     3159    mdmg           [list action_target          [ACTION_ARGS_PORTS]] \
     3160    dpkg           [list action_target          [ACTION_ARGS_PORTS]] \
     3161    mpkg           [list action_target          [ACTION_ARGS_PORTS]] \
     3162    pkg            [list action_target          [ACTION_ARGS_PORTS]] \
     3163    portpkg        [list action_target          [ACTION_ARGS_PORTS]] \
     3164    rpm            [list action_target          [ACTION_ARGS_PORTS]] \
     3165    srpm           [list action_target          [ACTION_ARGS_PORTS]] \
    31573166    \
    3158     quit           [list action_exit            [action_args_const none]] \
    3159     exit           [list action_exit            [action_args_const none]] \
     3167    quit           [list action_exit            [ACTION_ARGS_NONE]] \
     3168    exit           [list action_exit            [ACTION_ARGS_NONE]] \
    31603169]
    31613170
     
    34533462            }
    34543463            default {
    3455                 if {[action_args_const none] == $expand} {
     3464                if {[ACTION_ARGS_NONE] == $expand} {
    34563465                    ui_error "$action does not accept string arguments"
    34573466                    set action_status 1
    34583467                    break
    3459                 } elseif {[action_args_const strings] == $expand} {
     3468                } elseif {[ACTION_ARGS_STRINGS] == $expand} {
    34603469                    while { [moreargs] && ![match ";"] } {
    34613470                        lappend portlist [lookahead]
    34623471                        advance
    34633472                    }
    3464                 } elseif {[action_args_const ports] == $expand} {
     3473                } elseif {[ACTION_ARGS_PORTS] == $expand} {
    34653474                    # Parse port specifications into portlist
    34663475                    if {![portExpr portlist]} {
  • branches/images-and-archives/base/src/port1.0/portstartupitem.tcl

    r62809 r64293  
    575575    puts ${plist} "<key>Disabled</key><true/>"
    576576    puts ${plist} "<key>OnDemand</key><false/>"
    577     puts ${plist} "<key>RunAtLoad</key><false/>"
    578577   
    579578    if { [llength ${startupitem.logfile}] } {
     
    608607    ui_msg "# and to cause it to launch at startup:"
    609608    ui_msg "#"
    610     ui_msg "# sudo launchctl load -w /Library/${daemondest}/${plistname}"
     609    ui_msg "# sudo port load ${name}"
    611610    ui_msg "###########################################################"
    612611}
Note: See TracChangeset for help on using the changeset viewer.