[81265] branches/gsoc11-rev-upgrade/base/src/macports1.0/macports.tcl

cal at macports.org cal at macports.org
Thu Jul 28 06:18:42 PDT 2011


Revision: 81265
          http://trac.macports.org/changeset/81265
Author:   cal at macports.org
Date:     2011-07-28 06:18:42 -0700 (Thu, 28 Jul 2011)
Log Message:
-----------
rev-upgrade: Use entry objects rather than port names for topsort

Modified Paths:
--------------
    branches/gsoc11-rev-upgrade/base/src/macports1.0/macports.tcl

Modified: branches/gsoc11-rev-upgrade/base/src/macports1.0/macports.tcl
===================================================================
--- branches/gsoc11-rev-upgrade/base/src/macports1.0/macports.tcl	2011-07-28 12:31:02 UTC (rev 81264)
+++ branches/gsoc11-rev-upgrade/base/src/macports1.0/macports.tcl	2011-07-28 13:18:42 UTC (rev 81265)
@@ -3843,8 +3843,8 @@
         set broken_ports {}
         set broken_files [lsort -unique $broken_files]
         foreach file $broken_files {
-            set port [registry::file_registered $file]
-            if {$port == 0} {
+            set port [registry::entry owner $file]
+            if {$port == ""} {
                 ui_error "Broken file `$file' doesn't belong to any port."
             }
             lappend broken_ports $port
@@ -3881,6 +3881,7 @@
                     # add it to topsorted list
                     lappend topsort_ports $port
                     # remove from unsorted list
+                    # TODO: use lremove(n)
                     set index [lsearch $unsorted_ports $port]
                     set unsorted_ports [concat [lrange $unsorted_ports 0 $index-1] [lrange $unsorted_ports $index+1 end]]
 
@@ -3893,7 +3894,10 @@
             }
         }
 
-        ui_msg "---> Rebuilding in order: $topsort_ports"
+        ui_msg "---> Rebuilding in order"
+        foreach port $topsort_ports {
+            ui_msg "     [$port name] @[$port version] [$port variants][$port negated_variants]"
+        }
     }
 
     return 0;
@@ -3905,33 +3909,30 @@
     upvar $revadjlistname revadjlist
     upvar $visitedname visited
 
-    ui_debug "Processing port $port"
-    set dependent_ports [get_dependent_ports $port false]
+    ui_debug "Processing port [$port name] @[$port epoch]:[$port version]_[$port revision] [$port variants] [$port negated_variants]"
+    set dependent_ports [$port dependents]
     foreach dep $dependent_ports {
-        array set deparray $dep
-        set depname $deparray(name)
-
-        if {[info exists visited($depname)]} {
+        if {[info exists visited($dep)]} {
             continue
         }
-        set visited($depname) true
+        set visited($dep) true
         set is_broken_port false
 
-        if {[info exists adjlist($depname)]} {
-            ui_debug "Dependency $depname is broken, adding edge from [lindex $stack 0] to $depname"
-            ui_debug "Making $depname new head of stack"
+        if {[info exists adjlist($dep)]} {
+            ui_debug "Dependency [$dep name] is broken, adding edge from [[lindex $stack 0] name] to [$dep name]"
+            ui_debug "Making [$dep name] new head of stack"
             # $dep is one of the broken ports
             # add an edge to the last broken port in the DFS
-            lappend adjlist([lindex $stack 0]) $depname
-            lappend revadjlist($depname) [lindex $stack 0]
+            lappend revadjlist([lindex $stack 0]) $dep
+            lappend adjlist($dep) [lindex $stack 0]
             # make this port the new last broken port by prepending it to the stack
-            set stack [linsert last_visited 0 $depname]
+            set stack [linsert $stack 0 $dep]
             
             set is_broken_port true
         }
-        revupgrade_buildgraph $depname stack adjlist revadjlist visited
+        revupgrade_buildgraph $dep stack adjlist revadjlist visited
         if {$is_broken_port} {
-            ui_debug "Removing $depname from stack"
+            ui_debug "Removing [$dep name] from stack"
             # remove $dep from the stack
             set stack [lrange $stack 1 end]
         }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20110728/05b9262a/attachment.html>


More information about the macports-changes mailing list