[34854] branches/variant-descs-14482/base/src/port/port.tcl
raimue at macports.org
raimue at macports.org
Sat Mar 8 18:11:28 PST 2008
Revision: 34854
http://trac.macosforge.org/projects/macports/changeset/34854
Author: raimue at macports.org
Date: 2008-03-08 18:11:27 -0800 (Sat, 08 Mar 2008)
Log Message:
-----------
port/port.tcl:
Use new API macports::getsourceconfigdir
Modified Paths:
--------------
branches/variant-descs-14482/base/src/port/port.tcl
Modified: branches/variant-descs-14482/base/src/port/port.tcl
===================================================================
--- branches/variant-descs-14482/base/src/port/port.tcl 2008-03-09 02:10:05 UTC (rev 34853)
+++ branches/variant-descs-14482/base/src/port/port.tcl 2008-03-09 02:11:27 UTC (rev 34854)
@@ -444,23 +444,32 @@
##
# Get description for a variant from global descriptions file
+#
# @param porturl url to a port
# @param variant name
# @return description from descriptions file or an empty string
proc get_variant_desc {porturl desc} {
global variant_descs_global
- # TODO: find a better way to find the path to .config
- set sourcepath [file join [macports::getportdir $porturl] .. ..]
- set sourcepath [file normalize $sourcepath]
- set descfile [file join $sourcepath .config variant_descriptions]
+ set sourcepath [macports::getsourceconfigdir $porturl]
+ if {$sourcepath == ""} {
+ # protocol does not support global variants
+ return ""
+ }
+ set descfile [file join $sourcepath variant_descriptions.conf]
if {![info exists variant_descs_global($sourcepath)]} {
set variant_descs_global($sourcepath) yes
if {[file exists $descfile]} {
set fd [open $descfile r]
+ set lineno 0
while {[gets $fd line] >= 0} {
- set variant_descs_global(${sourcepath}_[lindex $line 0]) [join [lrange $line 1 end]]
+ incr lineno
+ if {[regexp {^(\w+)([ \t]+(.*))?$} $line match option ignore val] == 1} {
+ set variant_descs_global(${sourcepath}_$option) $val
+ } else {
+ ui_warn "Invalid variant description in $descfile at line $lineno"
+ }
}
close $fd
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20080308/ea1e7408/attachment.html
More information about the macports-changes
mailing list