Ignore:
Timestamp:
Apr 4, 2013, 12:45:15 AM (6 years ago)
Author:
cal@…
Message:

active_variants-1.1: support depspec-style dependencies, closes #38117, patch by michaelld

File:
1 edited

Legend:

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

    r102552 r104849  
    4646# where
    4747#  $name
    48 #    is the name of the port you're trying to check (required)
     48#    is the name of the port you're trying to check (required), which can be
     49#    specified as either just the port, or via "(bin:lib:path):FOO:port"
     50#    as accepted by the dependency parser.
    4951#  $required
    5052#    is a list of variants that must be enabled for the test to succeed
     
    8284#   - require_active_variants no longer needs to be used in a pre-configure
    8385#     phase manually, because it automatically wraps itself in pre-configure.
     86#   - the active_variants portgroup can now also deal with depspec-style
     87#     dependencies, e.g., require_active_variants path:foo/bar:standardport
     88#     variant
    8489
    8590proc active_variants {name required {forbidden {}}} {
     91        # get the port which will provide $name; this allows us to support e.g.,
     92        # path-style dependencies. This comes from port1.0/portutil.tcl and should
     93        # probably not be considered public API.
     94        set port [_get_dep_port $name]
     95        if {$port == ""} {
     96            ui_error "active_variants: Error: invalid port name '${name}'"
     97            ui_error "  expecting either: port or (bin:lib:path):foo:port"
     98            return 0
     99        }
     100        if {$name != $port} {
     101            ui_debug "Checking $port for active variants for depspec '$name'"
     102        }
     103
    86104        # registry_active comes from a list of aliased procedures in
    87105        # macports1.0/macports.tcl, line 1238 - 1303.
     
    106124
    107125        # this will throw if $name isn't active
    108         set installed [lindex [registry_active $name] 0]
     126        set installed [lindex [registry_active $port] 0]
    109127
    110128        # In $installed there are in order: name, version, revision, variants,
     
    112130        # we're interested in the field at offset 3.
    113131        set variants [lindex $installed 3]
    114         ui_debug "$name is installed with the following variants: $variants"
     132        ui_debug "$port is installed with the following variants: $variants"
    115133        ui_debug "  required: $required, forbidden: $forbidden"
    116134
Note: See TracChangeset for help on using the changeset viewer.