[88179] trunk/base/src/port/port.tcl
jberry at macports.org
jberry at macports.org
Wed Dec 21 09:43:42 PST 2011
Revision: 88179
http://trac.macports.org/changeset/88179
Author: jberry at macports.org
Date: 2011-12-21 09:43:42 -0800 (Wed, 21 Dec 2011)
Log Message:
-----------
Before intersecting two port lists, make each list unique with respect
to the port's fullname. In uniqueing the lists, always take the first
item found.
This may solve some issues with ambiguity of selection where a portlist
contains entries from multiple repositories. A better solution may
be to ensure that entries returned in a repository search are unique to
begin with.
Modified Paths:
--------------
trunk/base/src/port/port.tcl
Modified: trunk/base/src/port/port.tcl
===================================================================
--- trunk/base/src/port/port.tcl 2011-12-21 17:42:53 UTC (rev 88178)
+++ trunk/base/src/port/port.tcl 2011-12-21 17:43:42 UTC (rev 88179)
@@ -1437,22 +1437,28 @@
}
-proc opUnion { a b } {
+proc uniqueEntries { entries } {
+ # Form the list of all the unique elements in the list a,
+ # considering only the port fullname, and taking the first
+ # found element first
set result {}
-
- # Walk through both lists a and b, adding to result only unique ports
array unset unique
- foreach item [concat $a $b] {
+ foreach item $entries {
array set port $item
if {[info exists unique($port(fullname))]} continue
set unique($port(fullname)) 1
lappend result $item
}
-
return $result
}
+proc opUnion { a b } {
+ # Return the unique elements in the combined two lists
+ return uniqueEntries [concat $a $b]
+}
+
+
proc opIntersection { a b } {
set result {}
@@ -1470,14 +1476,14 @@
# First create a list of the fully discriminated names in b
array unset bfull
set i 0
- foreach bitem $b {
+ foreach bitem [uniqueEntries $b] {
array set port $bitem
set bfull($port(fullname)) $i
incr i
}
# Walk through each item in a, matching against b
- foreach aitem $a {
+ foreach aitem [uniqueEntries $a] {
array set port $aitem
# Quote the fullname and portname to avoid special characters messing up the regexp
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20111221/d41fdbff/attachment-0001.html>
More information about the macports-changes
mailing list