Changeset 5617


Ignore:
Timestamp:
Feb 26, 2004, 9:34:52 AM (16 years ago)
Author:
pguyot (Paul Guyot)
Message:
  • Fixed what we used to refer to as the pango problem. It is in fact a bug in the

dependency graph building and walking code.

  • Optimized the way the graph is built and walked by:
  • avoiding duplicate vertices. However, I don't think it has any real impact on the

speed.

  • avoiding building (and hence walking) subgraphs of nodes that are already

satisfied. This will fasten compilation of something like control-center when
you already have metacity installed (or py-gnome when you already have all
gnome ports installed).

Full description of the problem and the fix:
http://www.opendarwin.org/pipermail/darwinports/2004-February/020177.html
(I'm not sure I was extremely clear, tho).

Example of users who experienced that problem:
http://www.opendarwin.org/pipermail/darwinports/2004-February/019994.html
http://www.opendarwin.org/pipermail/darwinports/2004-February/020012.html

Location:
trunk/base/src/darwinports1.0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/darwinports1.0/darwinports.tcl

    r5561 r5617  
    354354# DYLD_FALLBACK_FRAMEWORK_PATH, and DYLD_FALLBACK_LIBRARY_PATH take precedence
    355355
    356 proc _libtest {dport} {
     356proc _libtest {dport depspec} {
    357357    global env tcl_platform
    358     set depspec [ditem_key $dport depspec]
    359358        set depline [lindex [split $depspec :] 1]
    360359        set prefix [_dportkey $dport prefix]
     
    391390### _bintest is private; subject to change without notice
    392391
    393 proc _bintest {dport} {
     392proc _bintest {dport depspec} {
    394393    global env
    395     set depspec [ditem_key $dport depspec]
    396394        set depregex [lindex [split $depspec :] 1]
    397395        set prefix [_dportkey $dport prefix]
     
    406404### _pathtest is private; subject to change without notice
    407405
    408 proc _pathtest {dport} {
     406proc _pathtest {dport depspec} {
    409407    global env
    410     set depspec [ditem_key $dport depspec]
    411408        set depregex [lindex [split $depspec :] 1]
    412409        set prefix [_dportkey $dport prefix]
     
    427424}
    428425
    429 ### _dportest is private; may change without notice
    430 
    431 proc _dporttest {dport} {
     426### _dportinstalled is private; may change without notice
     427
     428# Determine if a port is already *installed*, as in "in the registry".
     429proc _dportinstalled {dport} {
    432430        # Check for the presense of the port in the registry
    433431        set workername [ditem_key $dport workername]
     
    437435                return 1
    438436        } else {
     437                return 0
     438        }
     439}
     440
     441### _dporispresent is private; may change without notice
     442
     443# Determine if some depspec is satisfied or if the given port is installed.
     444# We actually start with the registry (faster?)
     445#
     446# dport         the port to test (to figure out if it's present)
     447# depspec       the dependency test specification (path, bin, lib, etc.)
     448proc _dportispresent {dport depspec} {
     449        # Check for the presense of the port in the registry
     450        set workername [ditem_key $dport workername]
     451        set res [$workername eval registry_exists \${portname} \${portversion}]
     452        if {$res != ""} {
     453                ui_debug "Found Dependency: receipt: $res"
     454                return 1
     455        } else {
    439456                # The receipt test failed, use one of the depspec regex mechanisms
    440                 set depspec [ditem_key $dport depspec]
    441457                set type [lindex [split $depspec :] 0]
    442458                switch $type {
    443                         lib { return [_libtest $dport] }
    444                         bin { return [_bintest $dport] }
    445                         path { return [_pathtest $dport] }
     459                        lib { return [_libtest $dport $depspec] }
     460                        bin { return [_bintest $dport $depspec] }
     461                        path { return [_pathtest $dport $depspec] }
    446462                        default {return -code error "unknown depspec type: $type"}
    447463                }
     
    498514
    499515                # install them
    500                 set dlist [dlist_eval $dlist _dporttest [list _dportexec "install"]]
     516                set dlist [dlist_eval $dlist _dportinstalled [list _dportexec "install"]]
    501517               
    502518                if {$dlist != {}} {
     
    650666                set options [ditem_key $dport options]
    651667                set variations [ditem_key $dport variations]
    652                
    653                 # XXX: This should use the depspec flavor of dportopen,
    654                 # but for now, simply set the key directly.
     668
     669                # Figure out the subport.       
    655670                set subport [dportopen $porturl $options $variations]
    656                 ditem_key $subport depspec $depspec
    657 
    658                 # Append the sub-port's provides to the port's requirements list.
    659                 ditem_append $dport requires "[ditem_key $subport provides]"
    660 
    661                 if {$recurseDeps != ""} {
    662                         # Skip the port if it's already in the accumulated list.
    663                         if {[lsearch $accDeps $portname] == -1} {
    664                                 # Add it to the list
    665                                 lappend accDeps $portname
     671
     672                # Is that dependency satisfied or this port installed?
     673                # If not, add it to the list. Otherwise, don't.
     674                if {![_dportispresent $subport $depspec]} {
     675                        # Append the sub-port's provides to the port's requirements list.
     676                        ditem_append_unique $dport requires "[ditem_key $subport provides]"
     677       
     678                        if {$recurseDeps != ""} {
     679                                # Skip the port if it's already in the accumulated list.
     680                                if {[lsearch $accDeps $portname] == -1} {
     681                                        # Add it to the list
     682                                        lappend accDeps $portname
    666683                               
    667                                 # We'll recursively iterate on it.
    668                                 lappend subPorts $subport
     684                                        # We'll recursively iterate on it.
     685                                        lappend subPorts $subport
     686                                }
    669687                        }
    670688                }
  • trunk/base/src/darwinports1.0/darwinports_dlist.tcl

    r5269 r5617  
    148148}
    149149
     150# ditem_append_unique
     151# Appends the value to the given key of the dependency item if
     152# they were not there yet.
     153#       ditem - the dependency item to operate on
     154#       key   - the key to append to
     155#       value - the value to append to the key
     156
     157proc ditem_append_unique {ditem key args} {
     158        eval "return \[darwinports_dlist::ditem_append_unique $ditem $key $args\]"
     159}
     160
    150161# ditem_contains
    151162# Tests whether the ditem key contains the specified value;
     
    341352}
    342353
     354proc ditem_append_unique {ditem key args} {
     355        variable $ditem
     356        set x [lindex [array get $ditem $key] 1]
     357        if {$x != {}} {
     358                eval "lappend x $args"
     359                set x [lsort -unique $x]
     360        } else {
     361                set x $args
     362        }
     363        array set $ditem [list $key $x]
     364        return $x
     365}
     366
    343367proc ditem_contains {ditem key args} {
    344368        variable $ditem
Note: See TracChangeset for help on using the changeset viewer.