[78396] trunk/base/src
jmr at macports.org
jmr at macports.org
Fri May 6 04:11:15 PDT 2011
Revision: 78396
http://trac.macports.org/changeset/78396
Author: jmr at macports.org
Date: 2011-05-06 04:11:13 -0700 (Fri, 06 May 2011)
Log Message:
-----------
fix reusing already-open mport refs in mportopen by adding a new dlist match function for multiple keys, and by not modifying the options that are passed in
Modified Paths:
--------------
trunk/base/src/macports1.0/macports.tcl
trunk/base/src/macports1.0/macports_dlist.tcl
trunk/base/src/port1.0/portinstall.tcl
Modified: trunk/base/src/macports1.0/macports.tcl
===================================================================
--- trunk/base/src/macports1.0/macports.tcl 2011-05-06 08:48:16 UTC (rev 78395)
+++ trunk/base/src/macports1.0/macports.tcl 2011-05-06 11:11:13 UTC (rev 78396)
@@ -1245,9 +1245,7 @@
if {$nocache != ""} {
set mport {}
} else {
- set mport [dlist_search $macports::open_mports porturl $porturl]
- set mport [dlist_search $mport variations $variations]
- set mport [dlist_search $mport options $options]
+ set mport [dlist_match_multi $macports::open_mports [list porturl $porturl variations $variations options $options]]
}
if {$mport != {}} {
# just in case more than one somehow matches
@@ -1264,9 +1262,6 @@
} else {
set portdir ""
}
- if {![info exists options_array(ports_requested)]} {
- lappend options ports_requested 0
- }
set portpath [macports::getportdir $porturl $portdir]
ui_debug "Changing to port directory: $portpath"
@@ -2432,7 +2427,7 @@
if {[llength $deptypes] > 0} {
array set optionsarray [ditem_key $mport options]
# avoid propagating requested flag from parent
- set optionsarray(ports_requested) 0
+ unset -nocomplain optionsarray(ports_requested)
# subport will be different for deps
unset -nocomplain optionsarray(subport)
set options [array get optionsarray]
@@ -2500,9 +2495,7 @@
# Figure out the subport. Check the open_mports list first, since
# we potentially leak mport references if we mportopen each time,
# because mportexec only closes each open mport once.
- set subport [dlist_search $macports::open_mports porturl $dep_portinfo(porturl)]
- set subport [dlist_search $subport options $options]
- set subport [dlist_search $subport variations $variations]
+ set subport [dlist_match_multi $macports::open_mports [list porturl $dep_portinfo(porturl) options $options variations $variations]]
if {$subport == {}} {
# We haven't opened this one yet.
Modified: trunk/base/src/macports1.0/macports_dlist.tcl
===================================================================
--- trunk/base/src/macports1.0/macports_dlist.tcl 2011-05-06 08:48:16 UTC (rev 78395)
+++ trunk/base/src/macports1.0/macports_dlist.tcl 2011-05-06 11:11:13 UTC (rev 78396)
@@ -52,6 +52,28 @@
# Values in the status dict will be {-1, 0, 1} for {failure,
# pending, success} respectively.
+# dlist_match_multi
+# Returns all dependency entries for which the entry's value for 'key' exactly matches the given 'value'.
+# dlist - the dependency list to search
+# criteria - the key/value pairs to compare
+
+proc dlist_match_multi {dlist criteria} {
+ set result {}
+ foreach ditem $dlist {
+ set match 1
+ foreach {key value} $criteria {
+ if {[ditem_key $ditem $key] != $value} {
+ set match 0
+ break
+ }
+ }
+ if {$match} {
+ lappend result $ditem
+ }
+ }
+ return $result
+}
+
# dlist_search
# Returns all dependency entries whose 'key' contains 'value'.
# dlist - the dependency list to search
Modified: trunk/base/src/port1.0/portinstall.tcl
===================================================================
--- trunk/base/src/port1.0/portinstall.tcl 2011-05-06 08:48:16 UTC (rev 78395)
+++ trunk/base/src/port1.0/portinstall.tcl 2011-05-06 11:11:13 UTC (rev 78396)
@@ -520,7 +520,11 @@
set regref [registry::entry create $subport $version $revision $portvariants $epoch]
- $regref requested $user_options(ports_requested)
+ if {[info exists user_options(ports_requested)]} {
+ $regref requested $user_options(ports_requested)
+ } else {
+ $regref requested 0
+ }
$regref os_platform ${os.platform}
$regref os_major ${os.major}
$regref archs [get_canonical_archs]
@@ -557,7 +561,11 @@
registry_prop_store $regref location $location
- registry_prop_store $regref requested $user_options(ports_requested)
+ if {[info exists user_options(ports_requested)]} {
+ registry_prop_store $regref requested $user_options(ports_requested)
+ } else {
+ registry_prop_store $regref requested 0
+ }
registry_prop_store $regref categories $categories
registry_prop_store $regref os_platform ${os.platform}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20110506/0889457e/attachment.html>
More information about the macports-changes
mailing list