Changeset 53670


Ignore:
Timestamp:
Jul 11, 2009, 3:08:45 PM (10 years ago)
Author:
jmr@…
Message:

Distinguish variants that the user requested (e.g. on the command line) from existing ones pulled from the registry. Fixes #19961.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/port/port.tcl

    r53660 r53670  
    261261    #   version         (version_revision)
    262262    #   variants array  (variant=>+-)
     263    #   requested_variants array  (variant=>+-)
    263264    #   options array   (key=>value)
    264265    #   fullname        (name/version_revision+-variants)
     
    269270    if {![info exists port(version)]}   { set port(version) "" }
    270271    if {![info exists port(variants)]}  { set port(variants) "" }
     272    if {![info exists port(requested_variants)]}  { set port(requested_variants) "" }
    271273    if {![info exists port(options)]}   { set port(options) [array get global_options] }
    272274
     
    301303        array set port $portentry
    302304        if ([info exists overrides(version)])   { set port(version) $overrides(version) }
    303         if ([info exists overrides(variants)])  { set port(variants) $overrides(variants)   }
     305        if ([info exists overrides(variants)])  { set port(variants) $overrides(variants) }
     306        if ([info exists overrides(requested_variants)])  { set port(requested_variants) $overrides(requested_variants) }
    304307        if ([info exists overrides(options)])   { set port(options) $overrides(options) }
    305308        add_to_portlist portlist [array get port]
     
    365368            array unset variations
    366369            array set variations $portspec(variants)
     370            array unset requested_variations
     371            array set requested_variations $portspec(requested_variants)
    367372            array unset options
    368373            array set options $portspec(options)
     
    881886    set name ""
    882887    set version ""
    883     array unset variants
     888    array unset requested_variants
    884889    array unset options
    885890   
     
    975980            set name [url_to_portname $token]
    976981            if {$name != ""} {
    977                 parsePortSpec version variants options
     982                parsePortSpec version requested_variants options
    978983                add_to_portlist reslist [list url $token \
    979984                  name $name \
    980985                  version $version \
    981                   variants [array get variants] \
     986                  requested_variants [array get requested_variants] \
     987                  variants [array get requested_variants] \
    982988                  options [array get options]]
    983989            } else {
     
    990996        default             { # Treat anything else as a portspec (portname, version, variants, options
    991997            # or some combination thereof).
    992             parseFullPortSpec url name version variants options
     998            parseFullPortSpec url name version requested_variants options
    993999            add_to_portlist reslist [list url $url \
    9941000              name $name \
    9951001              version $version \
    996               variants [array get variants] \
     1002              requested_variants [array get requested_variants] \
     1003              variants [array get requested_variants] \
    9971004              options [array get options]]
    9981005            set el 1
     
    10141021    array unset overrides
    10151022    if {$version != ""} { set overrides(version) $version }
    1016     if {[array size variants]} { set overrides(variants) [array get variants] }
     1023    if {[array size variants]} {
     1024        # we always record the requested variants separately,
     1025        # but requested ones always override existing ones
     1026        set overrides(requested_variants) [array get variants]
     1027        set overrides(variants) [array get variants]
     1028    }
    10171029    if {[array size options]} { set overrides(options) [array get options] }
    10181030
     
    19962008            # First filter out implicit variants from the explicitly set/unset variants.
    19972009            set global_variations_list [mport_filtervariants [array get global_variations] yes]
    1998             set variations_list [mport_filtervariants [array get variations] yes]
     2010            set variations_list [mport_filtervariants [array get requested_variations] yes]
    19992011           
    20002012            macports::upgrade $portname "port:$portname" $global_variations_list $variations_list [array get options] depscache
     
    28282840        }
    28292841       
    2830         # Add any global_variations to the variations
    2831         # specified for the port
    2832         foreach { variation value } [array get global_variations] {
    2833             if { ![info exists variations($variation)] } {
    2834                 set variations($variation) $value
    2835             }
     2842        # use existing variants iff none were explicitly requested
     2843        if {[array get requested_variations] == "" && [array get variations] != ""} {
     2844            array unset requested_variations
     2845            array set requested_variations [array get variations]
     2846            set filtered_variations [mport_filtervariants [array get variations] no]
     2847        } else {
     2848            set filtered_variations [mport_filtervariants [array get requested_variations] yes]
    28362849        }
    28372850        # Filter out implicit variants from the explicitly set/unset variants.
     
    28412854            mirror {}
    28422855            default {
    2843                 set variationslist [mport_filtervariants [array get variations] yes]
    2844                 array unset variations
    2845                 array set variations $variationslist
     2856                array unset requested_variations
     2857                array set requested_variations $filtered_variations
     2858            }
     2859        }
     2860       
     2861        # Add any global_variations to the variations
     2862        # specified for the port
     2863        foreach { variation value } [array get global_variations] {
     2864            if { ![info exists requested_variations($variation)] } {
     2865                set requested_variations($variation) $value
    28462866            }
    28472867        }
     
    28522872            set options(ports_version_glob) $portversion
    28532873        }
    2854         if {[catch {set workername [mportopen $porturl [array get options] [array get variations]]} result]} {
     2874        if {[catch {set workername [mportopen $porturl [array get options] [array get requested_variations]]} result]} {
    28552875            global errorInfo
    28562876            ui_debug "$errorInfo"
Note: See TracChangeset for help on using the changeset viewer.