[88238] branches/gsoc11-rev-upgrade/base

cal at macports.org cal at macports.org
Thu Dec 22 13:48:49 PST 2011


Revision: 88238
          http://trac.macports.org/changeset/88238
Author:   cal at macports.org
Date:     2011-12-22 13:48:46 -0800 (Thu, 22 Dec 2011)
Log Message:
-----------
rev-upgrade: Merge from trunk

Modified Paths:
--------------
    branches/gsoc11-rev-upgrade/base/ChangeLog
    branches/gsoc11-rev-upgrade/base/src/port/port.tcl
    branches/gsoc11-rev-upgrade/base/src/port1.0/portlivecheck.tcl

Property Changed:
----------------
    branches/gsoc11-rev-upgrade/base/


Property changes on: branches/gsoc11-rev-upgrade/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:78828-87909
/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:78828-88237
/users/perry/base-bugs_and_notes:45682-46060
/users/perry/base-select:44044-44692

Modified: branches/gsoc11-rev-upgrade/base/ChangeLog
===================================================================
--- branches/gsoc11-rev-upgrade/base/ChangeLog	2011-12-22 18:06:25 UTC (rev 88237)
+++ branches/gsoc11-rev-upgrade/base/ChangeLog	2011-12-22 21:48:46 UTC (rev 88238)
@@ -5,6 +5,9 @@
 
 Unreleased changes:
 
+    - port livecheck regex finds multiple matches on the same line
+      (raimue in r88031)
+
     - port lint now recognizes licenses (snc in r85929, r86016)
 
     - Implement new option-replace using lsearch/lreplace. The old behavior is

Modified: branches/gsoc11-rev-upgrade/base/src/port/port.tcl
===================================================================
--- branches/gsoc11-rev-upgrade/base/src/port/port.tcl	2011-12-22 18:06:25 UTC (rev 88237)
+++ branches/gsoc11-rev-upgrade/base/src/port/port.tcl	2011-12-22 21:48:46 UTC (rev 88238)
@@ -334,11 +334,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)
@@ -366,15 +365,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
 
@@ -686,30 +691,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]
 }
@@ -724,13 +730,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
@@ -1168,7 +1168,7 @@
             set reslist [opUnion $reslist $blist]
         }
     }
-
+    
     return $result
 }
 
@@ -1437,22 +1437,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 {}
     
@@ -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 [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

Modified: branches/gsoc11-rev-upgrade/base/src/port1.0/portlivecheck.tcl
===================================================================
--- branches/gsoc11-rev-upgrade/base/src/port1.0/portlivecheck.tcl	2011-12-22 18:06:25 UTC (rev 88237)
+++ branches/gsoc11-rev-upgrade/base/src/port1.0/portlivecheck.tcl	2011-12-22 21:48:46 UTC (rev 88238)
@@ -169,12 +169,15 @@
                     set updated_version 0
                     set foundmatch 0
                     while {[gets $chan line] >= 0} {
-                        if {[regexp $the_re $line matched upver]} {
+                        set lastoff 0
+                        while {[regexp -start $lastoff -indices $the_re $line offsets]} {
+                            regexp -start $lastoff $the_re $line matched upver
                             set foundmatch 1
                             if {$updated_version == 0 || [vercmp $upver $updated_version] > 0} {
                                 set updated_version $upver
                             }
                             ui_debug "The regex matched \"$matched\", extracted \"$upver\""
+                            lassign $offsets firstoff lastoff
                         }
                     }
                     if {$foundmatch == 1} {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20111222/bca9617b/attachment.html>


More information about the macports-changes mailing list