Ignore:
Timestamp:
Oct 28, 2002, 8:09:14 AM (16 years ago)
Author:
kevin
Message:

Preliminary support for variant conflicts.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/port1.0/portutil.tcl

    r1139 r1164  
    217217    set args [lrange $args 0 [expr $len - 2]]
    218218   
    219     set provides [list]
    220     set requires [list]
    221    
    222     # halfway through the list we'll hit 'requires' which tells us
    223     # to switch into processing required flavors/depspecs.
    224     set after_requires 0
     219    set obj [variant_new "temp-variant"]
     220   
     221    # mode indicates what the arg is interpreted as.
     222        # possible mode keywords are: requires, conflicts, provides
     223        # The default mode is provides.  Arguments are added to the
     224        # most recently specified mode (left to right).
     225    set mode "provides"
    225226    foreach arg $args {
    226         if ([string equal $arg requires]) {
    227             set after_requires 1
    228             continue
     227                switch -exact $arg {
     228                        provides { set mode "provides" }
     229                        requires { set mode "requires" }
     230                        conflicts { set mode "conflicts" }
     231                        default { $obj append $mode $arg }             
    229232        }
    230         if ($after_requires) {
    231             lappend requires $arg
    232         } else {
    233             lappend provides $arg
    234         }
    235     }
    236     set name "variant-[join $provides -]"
    237     set obj [variant_new $name]
    238     $obj append provides $provides
    239     $obj append requires $requires
     233    }
     234    $obj set name "[join [$obj get provides] -]"
    240235
    241236    # make a user procedure named variant-blah-blah
    242     # well will call this procedure during variant-run
    243     makeuserproc $name \{$code\}
     237    # we will call this procedure during variant-run
     238    makeuserproc "variant-[$obj get name]" \{$code\}
    244239    lappend all_variants $obj
    245240   
    246241    # Export provided variant to PortInfo
    247     lappend PortInfo(variants) $provides
     242    lappend PortInfo(variants) [$obj get provides]
    248243}
    249244
     
    726721    set name [$this get name]
    727722    ui_debug "Executing $name provides [$this get provides]"
     723
     724        # test for conflicting variants
     725        foreach v [$this get conflicts] {
     726                if {[variant_isset $v]} {
     727                        ui_error "Variant $name conflicts with $v"
     728                        return 1
     729                }
     730        }
     731
    728732    # execute proc with same name as variant.
    729     if {[catch ${name} result]} {
     733    if {[catch "variant-${name}" result]} {
    730734        ui_error "Error executing $name: $result"
    731735        return 1
Note: See TracChangeset for help on using the changeset viewer.