Ticket #25970: allow-specifying-case-insensitive-variants.diff

File allow-specifying-case-insensitive-variants.diff, 3.7 KB (added by neverpanic (Clemens Lang), 7 years ago)
  • src/port/port.tcl

    diff --git a/src/port/port.tcl b/src/port/port.tcl
    index f0b256bf..9ee1fe14 100755
    a b proc action_variants { action portlist opts } { 
    36823682                    }
    36833683
    36843684                    # XXX Keep these varmodifiers in sync with action_info, or create a wrapper for it
    3685                     if {[info exists variations($v)]} {
    3686                         set varmodifier "  $variations($v)"
    3687                     } elseif {[info exists global_variations($v)]} {
     3685                    set user_supplied_vname [lsearch -inline -nocase -exact [array names variations] $v]
     3686                    set user_supplied_global_vname [lsearch -inline -nocase -exact [array names global_variations] $v]
     3687                    if {[info exists variations($user_supplied_vname)]} {
     3688                        set varmodifier "  $variations($user_supplied_vname)"
     3689                    } elseif {[info exists global_variations($user_supplied_global_vname)]} {
    36883690                        # selected by variants.conf, prefixed with (+)/(-)
    3689                         set varmodifier "($global_variations($v))"
     3691                        set varmodifier "($global_variations($user_supplied_global_vname))"
    36903692                    } elseif {[info exists variant(is_default)]} {
    36913693                        set varmodifier "\[$variant(is_default)\]"
    36923694                    }
  • src/port1.0/portutil.tcl

    diff --git a/src/port1.0/portutil.tcl b/src/port1.0/portutil.tcl
    index 31fd56b7..b29782d6 100644
    a b proc variant {args} { 
    660660proc variant_isset {name} {
    661661    global variations
    662662
    663     if {[info exists variations($name)] && $variations($name) eq "+"} {
     663    set canonical_name [lsearch -exact -nocase -inline [array names variations] $name]
     664    if {$canonical_name eq ""} {
     665        return 0
     666    }
     667    if {$variations($canonical_name) eq "+"} {
    664668        return 1
    665669    }
    666670    return 0
    proc eval_variants {variations} { 
    19641968    global all_variants PortInfo requested_variations portvariants negated_variants
    19651969    set dlist $all_variants
    19661970    upvar $variations upvariations
    1967     set chosen [choose_variants $dlist upvariations]
    1968     set negated [lindex $chosen 1]
    1969     set chosen [lindex $chosen 0]
    1970     set portname [option subport]
    19711971
    19721972    # Check to make sure the requested variations are available with this
    19731973    # port, if one is not, warn the user and remove the variant from the
    proc eval_variants {variations} { 
    19751975    # Save the originally requested set in requested_variations.
    19761976    array set requested_variations [array get upvariations]
    19771977    foreach key [array names upvariations *] {
    1978         if {![info exists PortInfo(variants)] ||
    1979             $key ni $PortInfo(variants)} {
     1978        set canonical_variant_key ""
     1979        if {[info exists PortInfo(variants)]} {
     1980            set canonical_variant_key [lsearch -inline -nocase -exact $PortInfo(variants) $key]
     1981        }
     1982        if {$canonical_variant_key eq ""} {
    19801983            ui_debug "Requested variant $upvariations($key)$key is not provided by port $portname."
    19811984            array unset upvariations $key
     1985        } else {
     1986            set varspec $upvariations($key)
     1987            array unset upvariations $key
     1988            set upvariations($canonical_variant_key) $varspec
     1989            puts "Replacing $key variant with $canonical_variant_key"
    19821990        }
    19831991    }
    19841992
     1993    set chosen [choose_variants $dlist upvariations]
     1994    set negated [lindex $chosen 1]
     1995    set chosen [lindex $chosen 0]
     1996    set portname [option subport]
     1997
    19851998    # now that we've selected variants, change all provides [a b c] to [a-b-c]
    19861999    # this will eliminate ambiguity between item a, b, and a-b while fulfilling requirements.
    19872000    #foreach obj $dlist {