Ignore:
Timestamp:
Apr 6, 2008, 7:00:49 PM (10 years ago)
Author:
raimue@…
Message:

port1.0/portutil.tcl:
Avoid parsing Portfiles multiple times in recursive_collect_deps.
This makes tracemode a lot faster if there are many deps.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/port1.0/portutil.tcl

    r35675 r35790  
    12281228                        set portlist $depsPorts
    12291229                        foreach depName $depsPorts {
    1230                             set portlist [concat $portlist [recursive_collect_deps $depName $deptypes]]
     1230                            set portlist [recursive_collect_deps $depName $deptypes $portlist]
    12311231                        }
    1232                         #uniquer from http://aspn.activestate.com/ASPN/Cookbook/Tcl/Recipe/147663
    1233                         array set a [split "[join $portlist {::}]:" {:}]
    1234                         set depsPorts [array names a]
    12351232                   
    1236                         if {[llength $deptypes] > 0} {tracelib setdeps $depsPorts}
     1233                        if {[llength $deptypes] > 0} {tracelib setdeps $portlist}
    12371234                    }
    12381235                }
     
    13061303}
    13071304
    1308 # recursive found depends for portname
    1309 # It isn't ideal, because it scan many ports multiple time
    1310 proc recursive_collect_deps {portname deptypes} \
     1305# recursive dependency search for portname
     1306proc recursive_collect_deps {portname deptypes {depsfound {}}} \
    13111307{
    13121308    set res [mport_search ^$portname\$]
     
    13261322        }
    13271323    }
    1328    
    1329     set portdeps {}
     1324
     1325    set portdeps $depsfound
    13301326    foreach depspec $depends \
    13311327    {
    13321328        set portname [lindex [split $depspec :] end]
    1333         lappend portdeps $portname
    1334         set portdeps [concat $portdeps [recursive_collect_deps $portname $deptypes]]
     1329        if {[lsearch -exact $portdeps $portname] == -1} {
     1330            lappend portdeps $portname
     1331            set portdeps [recursive_collect_deps $portname $deptypes $portdeps]
     1332        }
    13351333    }
    13361334    return $portdeps
Note: See TracChangeset for help on using the changeset viewer.