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

jmr at macports.org jmr at macports.org
Sat Jun 7 08:54:49 PDT 2008


Revision: 37433
          http://trac.macosforge.org/projects/macports/changeset/37433
Author:   jmr at macports.org
Date:     2008-06-07 08:54:47 -0700 (Sat, 07 Jun 2008)

Log Message:
-----------
upgrade: refactor handling of dependencies
 * depscache entries are now added by the callee instead of the caller
 * a 'port:' entry is always added if the port is installed
 * a 'port:' entry in the cache immediately satisfies other depspecs involving that port
 * factored out redundant code for different depends_* types
Fixes #15520.

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-06-07 15:14:37 UTC (rev 37432)
+++ trunk/base/src/macports1.0/macports.tcl	2008-06-07 15:54:47 UTC (rev 37433)
@@ -1935,16 +1935,23 @@
                     ui_error "Unable to exec port: $result"
                     return 1
                 }
+                # we just installed it, so mark it done in the cache
+                set depscache(port:${portname}) 1
             } else {
                 # port installed outside MacPorts
                 ui_debug "$portname installed outside the MacPorts system"
                 set depflag 1
+                # mark this depspec as satisfied in the cache
+                set depscache($dspec) 1
             }
 
         } else {
             ui_error "Checking installed version failed: $result"
             exit 1
         }
+    } else {
+        # we'll now take care of upgrading it, so we can add it to the cache
+        set depscache(port:${portname}) 1
     }
     set anyactive no
     set version_installed {}
@@ -2039,36 +2046,17 @@
         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 [array get options] depscache
-                } 
+        # each dep type is upgraded
+        foreach dtype {depends_build depends_lib depends_run} {
+            if {[info exists portinfo($dtype)]} {
+                foreach i $portinfo($dtype) {
+                    set d [lindex [split $i :] end]
+                    if {![llength [array get depscache port:${d}]] && ![llength [array get depscache $i]]} {
+                        upgrade $d $i $variationslist [array get options] depscache
+                    } 
+                }
             }
         }
-        # library depends is upgraded
-        if {[info exists portinfo(depends_lib)]} {
-            foreach i $portinfo(depends_lib) {
-                if {![llength [array get depscache $i]]} {
-                set d [lindex [split $i :] end]
-                    set depscache($i) 1
-                    upgrade $d $i $variationslist [array get options] depscache
-                } 
-            }
-        }
-        # runtime depends is upgraded
-        if {[info exists portinfo(depends_run)]} {
-            foreach i $portinfo(depends_run) {
-                if {![llength [array get depscache $i]]} {
-                set d [lindex [split $i :] end]
-                    set depscache($i) 1
-                    upgrade $d $i $variationslist [array get options] depscache
-                } 
-            }
-        }
         
         # restore dependent-following to its former value
         if {$saved_do_dependents} {
@@ -2095,7 +2083,6 @@
                     foreach dep $deplist {
                         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
                         }
                     }
@@ -2194,7 +2181,6 @@
             foreach dep $deplist {
                 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/20080607/e207d481/attachment.htm 


More information about the macports-changes mailing list