Projects
New Ticket     Wiki     Browse Source     Timeline     Roadmap     Bug Reports     Search

Changeset 37433 for trunk/base/src

Show
Ignore:
Timestamp:
06/07/08 08:54:47 (6 months ago)
Author:
jmr@…
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.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/base/src/macports1.0/macports.tcl

    r37349 r37433  
    19361936                    return 1 
    19371937                } 
     1938                # we just installed it, so mark it done in the cache 
     1939                set depscache(port:${portname}) 1 
    19381940            } else { 
    19391941                # port installed outside MacPorts 
    19401942                ui_debug "$portname installed outside the MacPorts system" 
    19411943                set depflag 1 
     1944                # mark this depspec as satisfied in the cache 
     1945                set depscache($dspec) 1 
    19421946            } 
    19431947 
     
    19461950            exit 1 
    19471951        } 
     1952    } else { 
     1953        # we'll now take care of upgrading it, so we can add it to the cache 
     1954        set depscache(port:${portname}) 1 
    19481955    } 
    19491956    set anyactive no 
     
    20402047        unset -nocomplain options(ports_do_dependents) 
    20412048         
    2042         # build depends is upgraded 
    2043         if {[info exists portinfo(depends_build)]} { 
    2044             foreach i $portinfo(depends_build) { 
    2045                 if {![llength [array get depscache $i]]} { 
    2046                 set d [lindex [split $i :] end] 
    2047                     set depscache($i) 1 
    2048                     upgrade $d $i $variationslist [array get options] depscache 
    2049                 }  
    2050             } 
    2051         } 
    2052         # library depends is upgraded 
    2053         if {[info exists portinfo(depends_lib)]} { 
    2054             foreach i $portinfo(depends_lib) { 
    2055                 if {![llength [array get depscache $i]]} { 
    2056                 set d [lindex [split $i :] end] 
    2057                     set depscache($i) 1 
    2058                     upgrade $d $i $variationslist [array get options] depscache 
    2059                 }  
    2060             } 
    2061         } 
    2062         # runtime depends is upgraded 
    2063         if {[info exists portinfo(depends_run)]} { 
    2064             foreach i $portinfo(depends_run) { 
    2065                 if {![llength [array get depscache $i]]} { 
    2066                 set d [lindex [split $i :] end] 
    2067                     set depscache($i) 1 
    2068                     upgrade $d $i $variationslist [array get options] depscache 
    2069                 }  
     2049        # each dep type is upgraded 
     2050        foreach dtype {depends_build depends_lib depends_run} { 
     2051            if {[info exists portinfo($dtype)]} { 
     2052                foreach i $portinfo($dtype) { 
     2053                    set d [lindex [split $i :] end] 
     2054                    if {![llength [array get depscache port:${d}]] && ![llength [array get depscache $i]]} { 
     2055                        upgrade $d $i $variationslist [array get options] depscache 
     2056                    }  
     2057                } 
    20702058            } 
    20712059        } 
     
    20962084                        set mpname [lindex $dep 2] 
    20972085                        if {![llength [array get depscache port:${mpname}]]} { 
    2098                             set depscache(port:${mpname}) 1 
    20992086                            macports::upgrade $mpname port:${mpname} [array get variations] [array get options] depscache 
    21002087                        } 
     
    21952182                set mpname [lindex $dep 2] 
    21962183                if {![llength [array get depscache port:${mpname}]]} { 
    2197                     set depscache(port:${mpname}) 1 
    21982184                    macports::upgrade $mpname port:${mpname} [array get variations] [array get options] depscache 
    21992185                }