[46938] trunk/base/src/macports1.0/macports.tcl

perry at macports.org perry at macports.org
Tue Feb 17 21:45:42 PST 2009


Revision: 46938
          http://trac.macports.org/changeset/46938
Author:   perry at macports.org
Date:     2009-02-17 21:45:42 -0800 (Tue, 17 Feb 2009)
Log Message:
-----------
macports.tcl - Implicit variants can no longer be explicitly set/unset.
* This commit addresses Ticket #12563.

Modified Paths:
--------------
    trunk/base/src/macports1.0/macports.tcl

Modified: trunk/base/src/macports1.0/macports.tcl
===================================================================
--- trunk/base/src/macports1.0/macports.tcl	2009-02-18 04:06:29 UTC (rev 46937)
+++ trunk/base/src/macports1.0/macports.tcl	2009-02-18 05:45:42 UTC (rev 46938)
@@ -982,6 +982,41 @@
         return -code error "Could not find Portfile in $portpath"
     }
 
+    # Filter out explicitly set/unset implicit variants.
+    array set isimplicit {}
+
+    # Use the global descriptions file to determine whether a variant is implicit.
+    set descfile [macports::getportresourcepath $porturl "port1.0/variant_descriptions.conf"]
+    if {[file exists $descfile] && ![catch {set fd [open $descfile r]}]} {
+        set i 0
+        while {[gets $fd line] >= 0} {
+            set name [lindex $line 0]
+            set desc [lindex $line 1]
+
+            if {[regexp {^(Platform variant)} $desc]} {
+                set isimplicit($name) 1
+            }
+            incr i
+        }
+        close $fd
+
+        # Iterate through the explicitly set/unset variants, filtering out
+        # implicit variants.
+        set filteredvariations {}
+        foreach {variation value} $variations {
+            if {[info exists isimplicit($variation)]} {
+                ui_warn [concat "Implicit variants should not be explicitly" \
+                                "set or unset. $variation will be ignored."]
+            } else {
+                lappend filteredvariations $variation $value
+            }
+        }
+    } else {
+        # If the global descriptions file cannot be read, use the unfiltered
+        # list of variants.
+        set filteredvariations $variations
+    }
+
     set workername [interp create]
 
     set mport [ditem_create]
@@ -990,11 +1025,11 @@
     ditem_key $mport portpath $portpath
     ditem_key $mport workername $workername
     ditem_key $mport options $options
-    ditem_key $mport variations $variations
+    ditem_key $mport variations $filteredvariations
     ditem_key $mport refcnt 1
-    
-    macports::worker_init $workername $portpath $porturl [macports::getportbuildpath $portpath] $options $variations
 
+    macports::worker_init $workername $portpath $porturl [macports::getportbuildpath $portpath] $options $filteredvariations
+
     $workername eval source Portfile
     
     # add the default universal variant, but only if
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090217/53f440e2/attachment.html>


More information about the macports-changes mailing list