Changeset 34854


Ignore:
Timestamp:
Mar 9, 2008, 2:11:27 AM (13 years ago)
Author:
raimue@…
Message:

port/port.tcl:
Use new API macports::getsourceconfigdir

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/variant-descs-14482/base/src/port/port.tcl

    r34469 r34854  
    445445##
    446446# Get description for a variant from global descriptions file
     447#
    447448# @param porturl url to a port
    448449# @param variant name
     
    451452    global variant_descs_global
    452453
    453     # TODO: find a better way to find the path to .config
    454     set sourcepath [file join [macports::getportdir $porturl] .. ..]
    455     set sourcepath [file normalize $sourcepath]
    456     set descfile [file join $sourcepath .config variant_descriptions]
     454    set sourcepath [macports::getsourceconfigdir $porturl]
     455    if {$sourcepath == ""} {
     456        # protocol does not support global variants
     457        return ""
     458    }
     459    set descfile [file join $sourcepath variant_descriptions.conf]
    457460    if {![info exists variant_descs_global($sourcepath)]} {
    458461        set variant_descs_global($sourcepath) yes
     
    460463        if {[file exists $descfile]} {
    461464            set fd [open $descfile r]
     465            set lineno 0
    462466            while {[gets $fd line] >= 0} {
    463                 set variant_descs_global(${sourcepath}_[lindex $line 0]) [join [lrange $line 1 end]]
     467                incr lineno
     468                if {[regexp {^(\w+)([ \t]+(.*))?$} $line match option ignore val] == 1} {
     469                    set variant_descs_global(${sourcepath}_$option) $val
     470                } else {
     471                    ui_warn "Invalid variant description in $descfile at line $lineno"
     472                }
    464473            }
    465474            close $fd
Note: See TracChangeset for help on using the changeset viewer.