Ignore:
Timestamp:
Dec 19, 2013, 3:19:07 PM (5 years ago)
Author:
cal@…
Message:

active_variants 1.1: Only check for appropriate variants of dependencies that are in the dependency tree of the current operation, fixes ghc install without ghc-bootstrap

See https://lists.macosforge.org/pipermail/macports-users/2013-December/034220.html

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dports/_resources/port1.0/group/active_variants-1.1.tcl

    r106780 r114894  
    176176# function to be called in pre-configure to check for all items added using
    177177# require_active_variants
    178 proc _check_require_active_variants {} {
    179         global _require_active_variants_list
     178proc _check_require_active_variants {method} {
     179        global _require_active_variants_list PortInfo
     180
     181        # build a list of all dependencies to be checked in this pass
     182        set depends {}
     183        set deptypes {}
     184
     185        # determine the type of dependencies we need to consider
     186        switch $method {
     187                source {
     188                        set deptypes "depends_fetch depends_extract depends_lib depends_build depends_run"
     189                }
     190                archivefetch {
     191                        set deptypes "depends_lib depends_run"
     192                }
     193                default {
     194                        error "active_variants 1.1: internal error: _check_require_active_variants called with unsupported \$method"
     195                }
     196        }
     197
     198        # for each type we're considering
     199        foreach deptype $deptypes {
     200                # check that there are any dependencies by that type
     201                if {[info exists PortInfo($deptype)]} {
     202                        # and for each dependency
     203                        foreach depspec $PortInfo($deptype) {
     204                                # resolve names to actual ports
     205                                set depname [_get_dep_port $depspec]
     206
     207                                # if depname is empty the dependency is already satisfied (e.g.
     208                                # with bin: dependencies)
     209                                if {$depname ne ""} {
     210                                        # if the dependency isn't already in the list
     211                                        if {[lsearch -exact $depends $depname] == -1} {
     212                                                # append it
     213                                                lappend depends $depname
     214                                        }
     215                                }
     216                        }
     217                }
     218        }
     219
     220        ui_debug "Active variants check for ${method}-type install considers ${deptypes}: ${depends}"
     221
    180222        foreach _require_active_variant $_require_active_variants_list {
    181223                set depspec [lindex $_require_active_variant 0]
     
    183225                set required [lindex $_require_active_variant 1]
    184226                set forbidden [lindex $_require_active_variant 2]
     227
     228                if {[lsearch -exact $depends $port] == -1} {
     229                        ui_debug "Ignoring active_variants requirement for ${port} because ${method}-type install only considers ${deptypes} and those do not contain ${port}"
     230                        continue
     231                }
     232
    185233                if {[catch {set result [active_variants $depspec $required $forbidden]}] != 0} {
    186234                        error "${port} is required, but not active."
     
    206254# register pre-configure handler that checks for all requested variants
    207255pre-configure {
    208         _check_require_active_variants
     256        _check_require_active_variants source
    209257}
    210258
     
    213261# pre-configure is never run for those
    214262pre-archivefetch {
    215         _check_require_active_variants
    216 }
     263        _check_require_active_variants archivefetch
     264}
Note: See TracChangeset for help on using the changeset viewer.