Ticket #7361: _mportispresent.diff

File _mportispresent.diff, 2.1 KB (added by jmroot (Joshua Root), 17 years ago)

proposed fix

  • src/macports1.0/macports.tcl

     
    11341134    }
    11351135}
    11361136
     1137# Determine if a port is active (only for image mode)
     1138proc _mportactive {mport} {
     1139    set workername [ditem_key $mport workername]
     1140    if {[catch {set reslist [$workername eval registry_active \${portname}]} res]} {
     1141        return 0
     1142    } else {
     1143        return [expr [llength $reslist] > 0]
     1144    }
     1145}
     1146
    11371147### _mportispresent is private; may change without notice
    11381148
    1139 # Determine if some depspec is satisfied or if the given port is installed.
     1149# Determine if some depspec is satisfied or if the given port is installed
     1150# (and active, if we're in image mode).
    11401151# We actually start with the registry (faster?)
    11411152#
    11421153# mport     the port to test (to figure out if it's present)
    11431154# depspec   the dependency test specification (path, bin, lib, etc.)
    11441155proc _mportispresent {mport depspec} {
    1145     # Check for the presense of the port in the registry
    1146     set workername [ditem_key $mport workername]
    11471156    ui_debug "Searching for dependency: [ditem_key $mport provides]"
    1148     if {[catch {set reslist [$workername eval registry_installed \${portname}]} res]} {
    1149         set res 0
     1157    if {[string equal ${macports::registry.installtype} "image"]} {
     1158        set res [_mportactive $mport]
    11501159    } else {
    1151         set res [llength $reslist]
     1160        set res [_mportinstalled $mport]
    11521161    }
    11531162    if {$res != 0} {
    11541163        ui_debug "Found Dependency: receipt exists for [ditem_key $mport provides]"
     
    12371246        # xxx: as with below, this is ugly.  and deps need to be fixed to
    12381247        # understand Port Images before this can get prettier
    12391248        if { [string equal ${macports::registry.installtype} "image"] } {
    1240             set result [dlist_eval $dlist _mportinstalled [list _mportexec "activate"]]
     1249            set result [dlist_eval $dlist _mportactive [list _mportexec "activate"]]
    12411250        } else {
    12421251            set result [dlist_eval $dlist _mportinstalled [list _mportexec "install"]]
    12431252        }