Ignore:
Timestamp:
May 25, 2015, 4:31:37 AM (4 years ago)
Author:
larryv@…
Message:

select-1.0: Allow multiple select files

Ports that wish to install multiple select files -- possibly for
multiple groups -- can now use the select.entries option. Assuming
that the group1_select and group2_select ports configure the
group1 and group2 groups:

    PortGroup       select 1.0
    ...
    depends_run     port:group1_select \
                    port:group2_select
    select.entries  {group1 foo} \
                    {group1 bar} \
                    {group2 baz quux}

This uses ${filespath}/foo and ${filespath}/bar to create "foo" and
"bar" entries in the group1 group. An entry can have an optional third
argument if its name should differ from the name of the select file.
Above, ${filespath}/baz creates a "quux" entry in the group2 group.

Ports that only install one select file may continue using
select.group and select.file, if desired. If a portfile contains all
three of select.group, select.file, and select.entries, then
select.group and select.file are combined and prepended to
select.entries. (There's no reason to write a portfile this way,
though. Just use select.entries.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dports/_resources/port1.0/group/select-1.0.tcl

    r136722 r136723  
    11# et:ts=4
    2 # select-1.0.tcl
    3 #
    42# $Id$
    53#
    6 # Copyright (c) 2009 The MacPorts Project
    74# Copyright (c) 2009 Rainer Mueller <raimue@macports.org>
     5# Copyright (c) 2009-2015 The MacPorts Project
    86# All rights reserved.
    97#
     
    3331# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    3432#
     33#
     34#
     35# select-1.0.tcl
     36#
     37# This portgroup provides access to the port selection mechanism exposed
     38# by the `port select` command. (Refer to the port(1) and port-select(1)
     39# man pages for end-user information).
    3540
    36 options select.group select.file
     41options select.group select.file select.entries
    3742
    3843default select.group {}
    3944default select.file {}
     45default select.entries {}
    4046
    4147namespace eval select {}
     
    6672
    6773post-destroot {
    68     if {${select.file} ne "" && ${select.group} ne ""} {
    69         select::install ${select.group} ${select.file}
    70     } else {
    71         ui_debug "PortGroup select: select.group or select.file not set"
     74    if {${select.file} ne "" || ${select.group} ne ""} {
     75        select.entries-prepend [list ${select.group} ${select.file}]
     76    }
     77    ui_debug {PortGroup select: Installing select files to destroot}
     78    foreach entry ${select.entries} {
     79        set extras [lassign $entry group file name]
     80        if {[llength $extras] > 0} {
     81            ui_debug "PortGroup select:\
     82                    Ignoring entry with too many elements: '$entry'"
     83            continue
     84        }
     85        if {$group eq ""} {
     86            ui_debug "PortGroup select:\
     87                    Ignoring entry with missing group name: '$entry'"
     88            continue
     89        }
     90        if {$file eq ""} {
     91            ui_debug "PortGroup select:\
     92                    Ignoring entry with missing file name: '$entry'"
     93            continue
     94        }
     95        select::install $group $file $name
    7296    }
    7397}
Note: See TracChangeset for help on using the changeset viewer.