[90027] branches/release_2_0/base
jberry at macports.org
jberry at macports.org
Sun Feb 19 15:52:28 PST 2012
Revision: 90027
http://trac.macports.org/changeset/90027
Author: jberry at macports.org
Date: 2012-02-19 15:52:28 -0800 (Sun, 19 Feb 2012)
Log Message:
-----------
Merge r88179 and r88185 from trunk: resolve ambiguity of selection in portlists
Revision Links:
--------------
http://trac.macports.org/changeset/88179
http://trac.macports.org/changeset/88185
Modified Paths:
--------------
branches/release_2_0/base/src/port/port.tcl
Property Changed:
----------------
branches/release_2_0/base/
Property changes on: branches/release_2_0/base
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/gsoc08-privileges/base:37343-46937
/branches/gsoc09-logging/base:51231-60371
/branches/universal-sanity/base:51872-52323
/branches/variant-descs-14482/base:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base:79584,79586,79590-79594,79599-79600,79649,79686,79689,79692,79750,79762,79771-79774,79782,79787,79864,79943,80069,80088,80178,80220,80222,80224,80226,80229,80245,80287,80335,80443,80581,80583,80586,80779,80797-80798,80894,80928,80932,80934,80969,80971,81005,81119,81146,81171,81234,81269,81361,81371,81414-81415,81454,81464,81467,81475,81522,81556-81558,81562,81565,81567,81577,81630,81657,81830-81832,82111,82135,82767,82921,82924,82947,83136,83149,83267,83270-83271,83391,83395,83443,83471,83537,84351,88045,89988,89993-89994,90000,90002,90004,90010,90020
/users/perry/base-bugs_and_notes:45682-46060
/users/perry/base-select:44044-44692
+ /branches/gsoc08-privileges/base:37343-46937
/branches/gsoc09-logging/base:51231-60371
/branches/universal-sanity/base:51872-52323
/branches/variant-descs-14482/base:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base:79584,79586,79590-79594,79599-79600,79649,79686,79689,79692,79750,79762,79771-79774,79782,79787,79864,79943,80069,80088,80178,80220,80222,80224,80226,80229,80245,80287,80335,80443,80581,80583,80586,80779,80797-80798,80894,80928,80932,80934,80969,80971,81005,81119,81146,81171,81234,81269,81361,81371,81414-81415,81454,81464,81467,81475,81522,81556-81558,81562,81565,81567,81577,81630,81657,81830-81832,82111,82135,82767,82921,82924,82947,83136,83149,83267,83270-83271,83391,83395,83443,83471,83537,84351,88045,88179,88185,89988,89993-89994,90000,90002,90004,90010,90020
/users/perry/base-bugs_and_notes:45682-46060
/users/perry/base-select:44044-44692
Modified: branches/release_2_0/base/src/port/port.tcl
===================================================================
--- branches/release_2_0/base/src/port/port.tcl 2012-02-19 22:18:40 UTC (rev 90026)
+++ branches/release_2_0/base/src/port/port.tcl 2012-02-19 23:52:28 UTC (rev 90027)
@@ -332,11 +332,10 @@
}
-proc add_to_portlist {listname portentry} {
- upvar $listname portlist
+proc entry_for_portlist {portentry} {
global global_options global_variations
- # The portlist currently has the following elements in it:
+ # Each portlist entry currently has the following elements in it:
# url if any
# name
# version (version_revision)
@@ -364,15 +363,21 @@
}
}
-
# Form the fully discriminated portname: portname/version_revison+-variants
set port(fullname) "$port(name)/[composite_version $port(version) $port(variants)]"
- # Add it to our portlist
- lappend portlist [array get port]
+ return [array get port]
}
+proc add_to_portlist {listname portentry} {
+ upvar $listname portlist
+
+ # Form portlist entry and add to portlist
+ lappend portlist [entry_for_portlist $portentry]
+}
+
+
proc add_ports_to_portlist {listname ports {overridelist ""}} {
upvar $listname portlist
@@ -684,30 +689,31 @@
##########################################
# Port selection
##########################################
+proc unique_results_to_portlist {infos} {
+ set result {}
+ array unset unique
+ foreach {name info} $infos {
+ array unset portinfo
+ array set portinfo $info
+
+ array unset entry
+ array set entry [entry_for_portlist [list url $portinfo(porturl) name $name]]
+ if {[info exists unique($entry(fullname))]} continue
+ set unique($entry(fullname)) 1
+ lappend result [array get entry]
+ }
+ return $result
+}
+
+
proc get_matching_ports {pattern {casesensitive no} {matchstyle glob} {field name}} {
if {[catch {set res [mportsearch $pattern $casesensitive $matchstyle $field]} result]} {
global errorInfo
ui_debug "$errorInfo"
fatal "search for portname $pattern failed: $result"
}
-
- set results {}
- foreach {name info} $res {
- array unset portinfo
- array set portinfo $info
-
- #set variants {}
- #if {[info exists portinfo(variants)]} {
- # foreach variant $portinfo(variants) {
- # lappend variants $variant "+"
- # }
- #}
- # For now, don't include version or variants with all ports list
- #"$portinfo(version)_$portinfo(revision)"
- #$variants
- add_to_portlist results [list url $portinfo(porturl) name $name]
- }
-
+ set results [unique_results_to_portlist $res]
+
# Return the list of all ports, sorted
return [portlist_sort $results]
}
@@ -722,13 +728,7 @@
ui_debug "$errorInfo"
fatal "listing all ports failed: $result"
}
- set results {}
- foreach {name info} $res {
- array unset portinfo
- array set portinfo $info
- add_to_portlist results [list url $portinfo(porturl) name $name]
- }
-
+ set results [unique_results_to_portlist $res]
set all_ports_cache [portlist_sort $results]
}
return $all_ports_cache
@@ -1166,7 +1166,7 @@
set reslist [opUnion $reslist $blist]
}
}
-
+
return $result
}
@@ -1435,22 +1435,28 @@
}
-proc opUnion { a b } {
+proc unique_entries { 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 [unique_entries [concat $a $b]]
+}
+
+
proc opIntersection { a b } {
set result {}
@@ -1468,14 +1474,14 @@
# First create a list of the fully discriminated names in b
array unset bfull
set i 0
- foreach bitem $b {
+ foreach bitem [unique_entries $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 [unique_entries $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/20120219/e0bc16b4/attachment.html>
More information about the macports-changes
mailing list