Changeset 2081


Ignore:
Timestamp:
Feb 26, 2003, 8:36:25 AM (17 years ago)
Author:
kevin
Message:

Added darwinports_dlist package for dependency list evaluation in both the
DarwinPorts API and Port API.

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

Legend:

Unmodified
Added
Removed
  • trunk/base/src/darwinports1.0/Makefile

    r1862 r2081  
    1 SRCS=           darwinports.tcl
     1SRCS=           darwinports.tcl darwinports_dlist.tcl
    22
    33all:
  • trunk/base/src/darwinports1.0/darwinports.tcl

    r1590 r2081  
    253253                return 1
    254254        }
     255
     256        set name [$workername eval return \$portname]
     257        puts "xxx: $name depends: [dportdepends $name 1 1]"
     258       
     259       
    255260       
    256261        return [$workername eval eval_targets $target]
     
    332337    interp delete $workername
    333338}
     339
     340##### Private Depspec API #####
     341# This API should be considered work in progress and subject to change without notice.
     342##### "
     343
     344# dportdepends returns a list of port names which the given port depends on.
     345# xxx: should return the depspec itself once we have better depspec processing.
     346# - optionally includes the build dependencies in the list.
     347# - optionally recurses through the dependencies, looking for dependencies
     348#       of dependencies.
     349
     350proc dportdepends {portname includeBuildDeps recurseDeps} {
     351        set result {}
     352
     353        if {[catch {set res [dportsearch "^$portname\$"]} error]} {
     354                ui_puts err "Internal error: port search failed: $error"
     355                return
     356        }
     357
     358        foreach {name array} $res {
     359                array set portinfo $array
     360                set depends {}
     361                if {[info exists portinfo(depends_run)]} { eval "lappend depends $portinfo(depends_run)" }
     362                if {[info exists portinfo(depends_lib)]} { eval "lappend depends $portinfo(depends_lib)" }
     363                if {$includeBuildDeps != "" && [info exists portinfo(depends_build)]} {
     364                        eval "lappend depends $portinfo(depends_build)"
     365                }
     366                foreach depspec $depends {
     367                        # grab the portname portion of the depspec
     368                        set dep [lindex [split $depspec :] 2]
     369                       
     370                        lappend result $dep
     371                       
     372                        if {$recurseDeps != ""} {
     373                                set rdeps [dportdepends $dep $includeBuildDeps $recurseDeps]
     374                                if {$rdeps == -1} {
     375                                        return -1
     376                                } else {
     377                                        eval "lappend result $rdeps"
     378                                }
     379                        }
     380                }
     381        }
     382       
     383        return $result
     384}
Note: See TracChangeset for help on using the changeset viewer.