[44082] trunk/base/src/port/port.tcl

raimue at macports.org raimue at macports.org
Sat Dec 20 20:04:22 PST 2008


Revision: 44082
          http://trac.macports.org/changeset/44082
Author:   raimue at macports.org
Date:     2008-12-20 20:04:21 -0800 (Sat, 20 Dec 2008)
Log Message:
-----------
port/port.tcl:
Use a new array for the filters to avoid using other options as field, unset
the arrays after processing is done, see #15434

Modified Paths:
--------------
    trunk/base/src/port/port.tcl

Modified: trunk/base/src/port/port.tcl
===================================================================
--- trunk/base/src/port/port.tcl	2008-12-21 03:51:54 UTC (rev 44081)
+++ trunk/base/src/port/port.tcl	2008-12-21 04:04:21 UTC (rev 44082)
@@ -2181,8 +2181,15 @@
     # Copy global options as we are going to modify the array
     array set options [array get global_options]
 
+    if {[info exists options(ports_search_depends)] && $options(ports_search_depends) == "yes"} {
+        array unset options ports_search_depends
+        set options(ports_search_depends_build) yes
+        set options(ports_search_depends_lib) yes
+        set options(ports_search_depends_run) yes
+    }
+
     # Set default search filter if none was given
-    set optcnt 0
+    array set filters {}
     foreach { option } [array names options ports_search_*] {
         set opt [string range $option 13 end]
 
@@ -2191,19 +2198,16 @@
                 continue
             }
         }
-        incr optcnt
+        if { $options($option) != "yes" } {
+            continue
+        }
+
+        set filters($opt) "yes"
     }
-    if { $optcnt == 0 } {
-        set options(ports_search_name) "yes"
+    if { [array size filters] == 0 } {
+        set filters(name) "yes"
     }
 
-    if {[info exists options(ports_search_depends)] && $options(ports_search_depends) == "yes"} {
-        array unset options ports_search_depends
-        set options(ports_search_depends_build) yes
-        set options(ports_search_depends_lib) yes
-        set options(ports_search_depends_run) yes
-    }
-
     set separator ""
     foreach portname $portlist {
         puts -nonewline $separator
@@ -2216,9 +2220,7 @@
 
         set res {}
         set portfound 0
-        foreach { option } [array names options ports_search_*] {
-            set opt [string range $option 13 end]
-
+        foreach { opt } [array get filters] {
             # Map from friendly name
             set opt [map_friendly_field_names $opt]
 
@@ -2287,7 +2289,10 @@
 
         set separator "--\n"
     }
-    
+
+    array unset options
+    array unset filters
+
     return $status
 }
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20081220/cd2e135f/attachment.html>


More information about the macports-changes mailing list