[136723] trunk/dports/_resources/port1.0/group/select-1.0.tcl

larryv at macports.org larryv at macports.org
Sun May 24 21:31:37 PDT 2015


Revision: 136723
          https://trac.macports.org/changeset/136723
Author:   larryv at macports.org
Date:     2015-05-24 21:31:37 -0700 (Sun, 24 May 2015)
Log 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`.)

Modified Paths:
--------------
    trunk/dports/_resources/port1.0/group/select-1.0.tcl

Modified: trunk/dports/_resources/port1.0/group/select-1.0.tcl
===================================================================
--- trunk/dports/_resources/port1.0/group/select-1.0.tcl	2015-05-25 04:31:35 UTC (rev 136722)
+++ trunk/dports/_resources/port1.0/group/select-1.0.tcl	2015-05-25 04:31:37 UTC (rev 136723)
@@ -1,10 +1,8 @@
 # et:ts=4
-# select-1.0.tcl
-#
 # $Id$
 #
-# Copyright (c) 2009 The MacPorts Project
 # Copyright (c) 2009 Rainer Mueller <raimue at macports.org>
+# Copyright (c) 2009-2015 The MacPorts Project
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -32,11 +30,19 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #
+#
+#
+# select-1.0.tcl
+#
+# This portgroup provides access to the port selection mechanism exposed
+# by the `port select` command. (Refer to the port(1) and port-select(1)
+# man pages for end-user information).
 
-options select.group select.file
+options select.group select.file select.entries
 
 default select.group {}
 default select.file {}
+default select.entries {}
 
 namespace eval select {}
 
@@ -65,9 +71,27 @@
 }
 
 post-destroot {
-    if {${select.file} ne "" && ${select.group} ne ""} {
-        select::install ${select.group} ${select.file}
-    } else {
-        ui_debug "PortGroup select: select.group or select.file not set"
+    if {${select.file} ne "" || ${select.group} ne ""} {
+        select.entries-prepend [list ${select.group} ${select.file}]
     }
+    ui_debug {PortGroup select: Installing select files to destroot}
+    foreach entry ${select.entries} {
+        set extras [lassign $entry group file name]
+        if {[llength $extras] > 0} {
+            ui_debug "PortGroup select:\
+                    Ignoring entry with too many elements: '$entry'"
+            continue
+        }
+        if {$group eq ""} {
+            ui_debug "PortGroup select:\
+                    Ignoring entry with missing group name: '$entry'"
+            continue
+        }
+        if {$file eq ""} {
+            ui_debug "PortGroup select:\
+                    Ignoring entry with missing file name: '$entry'"
+            continue
+        }
+        select::install $group $file $name
+    }
 }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20150524/e982b9c9/attachment.html>


More information about the macports-changes mailing list