[37046] trunk/base/src/macports1.0/macports.tcl

jmr at macports.org jmr at macports.org
Sat May 24 07:24:56 PDT 2008


Revision: 37046
          http://trac.macosforge.org/projects/macports/changeset/37046
Author:   jmr at macports.org
Date:     2008-05-24 07:24:54 -0700 (Sat, 24 May 2008)

Log Message:
-----------
upgrade: when following dependents (-R), only upgrade the dependents of the
specified port, not those of all its dependencies as well. Also use the
depscache for dependents as well as dependencies. These changes reduce the
amount of work done by 'port -R upgrade', by an enormous amount in some cases.
Fixes #10827.

Modified Paths:
--------------
    trunk/base/src/macports1.0/macports.tcl

Modified: trunk/base/src/macports1.0/macports.tcl
===================================================================
--- trunk/base/src/macports1.0/macports.tcl	2008-05-24 07:43:24 UTC (rev 37045)
+++ trunk/base/src/macports1.0/macports.tcl	2008-05-24 14:24:54 UTC (rev 37046)
@@ -2021,13 +2021,25 @@
         ui_debug "Not following dependencies"
         set depflag 0
     } else {
+        # If we're following dependents, we only want to follow this port's
+        # dependents, not those of all its dependencies. Otherwise, we would
+        # end up processing this port's dependents n+1 times (recursively!),
+        # where n is the number of dependencies this port has, since this port
+        # is of course a dependent of each of its dependencies. Plus the
+        # dependencies could have any number of unrelated dependents.
+        
+        # So we save whether we're following dependents, unset the option
+        # while doing the dependencies, and restore it afterwards.
+        set saved_do_dependents [info exists options(ports_do_dependents)]
+        unset -nocomplain options(ports_do_dependents)
+        
         # build depends is upgraded
         if {[info exists portinfo(depends_build)]} {
             foreach i $portinfo(depends_build) {
                 if {![llength [array get depscache $i]]} {
                 set d [lindex [split $i :] end]
                     set depscache($i) 1
-                    upgrade $d $i $variationslist $optionslist depscache
+                    upgrade $d $i $variationslist [array get options] depscache
                 } 
             }
         }
@@ -2037,7 +2049,7 @@
                 if {![llength [array get depscache $i]]} {
                 set d [lindex [split $i :] end]
                     set depscache($i) 1
-                    upgrade $d $i $variationslist $optionslist depscache
+                    upgrade $d $i $variationslist [array get options] depscache
                 } 
             }
         }
@@ -2047,10 +2059,15 @@
                 if {![llength [array get depscache $i]]} {
                 set d [lindex [split $i :] end]
                     set depscache($i) 1
-                    upgrade $d $i $variationslist $optionslist depscache
+                    upgrade $d $i $variationslist [array get options] depscache
                 } 
             }
         }
+        
+        # restore dependent-following to its former value
+        if {$saved_do_dependents} {
+            set options(ports_do_dependents) yes
+        }
     }
 
     # check installed version against version in ports
@@ -2070,8 +2087,11 @@
 
                 if { [llength deplist] > 0 } {
                     foreach dep $deplist {
-                        set mpname [lindex $dep 2] 
-                        macports::upgrade $mpname "port:$mpname" [array get variations] [array get options]
+                        set mpname [lindex $dep 2]
+                        if {![llength [array get depscache port:${mpname}]]} {
+                            set depscache(port:${mpname}) 1
+                            macports::upgrade $mpname port:${mpname} [array get variations] [array get options] depscache
+                        }
                     }
                 }
             }
@@ -2166,8 +2186,11 @@
 
         if { [llength deplist] > 0 } {
             foreach dep $deplist {
-                set mpname [lindex $dep 2] 
-                macports::upgrade $mpname "port:$mpname" [array get variations] [array get options]
+                set mpname [lindex $dep 2]
+                if {![llength [array get depscache port:${mpname}]]} {
+                    set depscache(port:${mpname}) 1
+                    macports::upgrade $mpname port:${mpname} [array get variations] [array get options] depscache
+                }
             }
         }
     }

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20080524/1a01a804/attachment-0001.htm 


More information about the macports-changes mailing list