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

cal at macports.org cal at macports.org
Thu Jul 28 09:00:15 PDT 2011


Revision: 81272
          http://trac.macports.org/changeset/81272
Author:   cal at macports.org
Date:     2011-07-28 09:00:13 -0700 (Thu, 28 Jul 2011)
Log Message:
-----------
rev-upgrade: Repeat scanning and rebuilding until all errors are fixed or a port has been marked as broken more than 3 times.

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 15:24:35 UTC (rev 81271)
+++ branches/gsoc11-rev-upgrade/base/src/macports1.0/macports.tcl	2011-07-28 16:00:13 UTC (rev 81272)
@@ -3748,6 +3748,21 @@
 }
 
 proc macports::revupgrade {args} {
+    set run_loop 1
+    array set broken_port_counts {}
+    while {$run_loop == 1} {
+        if {[catch {revupgrade_scanandrebuild broken_port_counts} run_loop] == 1} {
+            ui_error "An error occured while scanning for broken ports and/or trying to rebuild them"
+            error "An error occured while scanning for broken ports and/or trying to rebuild them"
+        }
+    }
+    return 0;
+}
+
+# returns 1 if ports were rebuilt and revupgrade_scanandrebuild should be called again
+proc revupgrade_scanandrebuild {broken_port_counts_name} {
+    upvar $broken_port_counts_name broken_port_counts
+
     set files [registry::file search active 1 binary -null]
     if {[llength $files] > 0} {
         registry::write {
@@ -3760,7 +3775,7 @@
                     $f binary [fileIsBinary [$f path]]
                 }
             } catch {*} {
-                ui_msg "Updating database of binaries failed"
+                ui_error "Updating database of binaries failed"
                 throw
             }
         }
@@ -3785,7 +3800,7 @@
             set result     [lindex $resultlist 1]
 
             if {$returncode != $machista::SUCCESS} {
-                ui_warn "Error parsing file [$b path]: [machista::strerror $returncode]"
+                ui_info "Error parsing file [$b path]: [machista::strerror $returncode]"
                 continue;
             }
 
@@ -3857,6 +3872,17 @@
         }
         set broken_ports [lsort -unique $broken_ports]
 
+        foreach port $broken_ports {
+            if {![info exists broken_port_counts([$port name])]} {
+                set broken_port_counts([$port name]) 0
+            }
+            incr broken_port_counts([$port name])
+            if {$broken_port_counts([$port name]) > 3} {
+                ui_error "Port [$port name] is still broken after rebuiling it more than 3 times. You might want to file a bug for this."
+                error "Port [$port name] still broken after rebuilding $broken_port_counts([$port name]) time(s)"
+            }
+        }
+
         ui_msg "---> Found [llength $broken_ports] broken port(s), determining rebuild order"
         # broken_ports are the nodes in our graph
         # now we need adjacents
@@ -3903,6 +3929,8 @@
         foreach port $topsort_ports {
             ui_msg "     [$port name] @[$port version] [$port variants][$port negated_variants]"
         }
+
+        return 1;
     }
 
     return 0;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20110728/c0e9ec8b/attachment.html>


More information about the macports-changes mailing list