[147361] trunk/base/src/port/port.tcl
raimue at macports.org
raimue at macports.org
Sat Apr 2 09:04:00 PDT 2016
Revision: 147361
https://trac.macports.org/changeset/147361
Author: raimue at macports.org
Date: 2016-04-02 09:04:00 -0700 (Sat, 02 Apr 2016)
Log Message:
-----------
port: use switch -matchvar from Tcl 8.5
Modified Paths:
--------------
trunk/base/src/port/port.tcl
Modified: trunk/base/src/port/port.tcl
===================================================================
--- trunk/base/src/port/port.tcl 2016-04-02 14:17:52 UTC (rev 147360)
+++ trunk/base/src/port/port.tcl 2016-04-02 16:04:00 UTC (rev 147361)
@@ -1259,7 +1259,7 @@
array unset options
set token [lookahead]
- switch -regex -- $token {
+ switch -regex -matchvar matchvar -- $token {
^\\)$ -
^\; -
^_EOF_$ { # End of expression/cmd/file
@@ -1273,59 +1273,60 @@
}
}
- ^all(@.*)?$ -
- ^installed(@.*)?$ -
- ^uninstalled(@.*)?$ -
- ^active(@.*)?$ -
- ^inactive(@.*)?$ -
- ^actinact(@.*)?$ -
- ^leaves(@.*)?$ -
- ^outdated(@.*)?$ -
- ^obsolete(@.*)?$ -
- ^requested(@.*)?$ -
- ^unrequested(@.*)?$ -
- ^current(@.*)?$ {
+ ^(all)(@.*)?$ -
+ ^(installed)(@.*)?$ -
+ ^(uninstalled)(@.*)?$ -
+ ^(active)(@.*)?$ -
+ ^(inactive)(@.*)?$ -
+ ^(actinact)(@.*)?$ -
+ ^(leaves)(@.*)?$ -
+ ^(outdated)(@.*)?$ -
+ ^(obsolete)(@.*)?$ -
+ ^(requested)(@.*)?$ -
+ ^(unrequested)(@.*)?$ -
+ ^(current)(@.*)?$ {
# A simple pseudo-port name
advance
# Break off the version component, if there is one
- regexp {^(\w+)(@.*)?} $token matchvar name remainder
+ set name [lindex $matchvar 1]
+ set remainder [lindex $matchvar 2]
add_multiple_ports reslist [get_${name}_ports] $remainder
set el 1
}
- ^variants: -
- ^variant: -
- ^description: -
- ^portdir: -
- ^homepage: -
- ^epoch: -
- ^platforms: -
- ^platform: -
- ^name: -
- ^long_description: -
- ^maintainers: -
- ^maintainer: -
- ^categories: -
- ^category: -
- ^version: -
- ^depends_lib: -
- ^depends_build: -
- ^depends_run: -
- ^depends_extract: -
- ^depends_fetch: -
- ^depends_test: -
- ^replaced_by: -
- ^revision: -
- ^subport: -
- ^subports: -
- ^license: { # Handle special port selectors
+ ^(variants):(.*) -
+ ^(variant):(.*) -
+ ^(description):(.*) -
+ ^(portdir):(.*) -
+ ^(homepage):(.*) -
+ ^(epoch):(.*) -
+ ^(platforms):(.*) -
+ ^(platform):(.*) -
+ ^(name):(.*) -
+ ^(long_description):(.*) -
+ ^(maintainers):(.*) -
+ ^(maintainer):(.*) -
+ ^(categories):(.*) -
+ ^(category):(.*) -
+ ^(version):(.*) -
+ ^(depends_lib):(.*) -
+ ^(depends_build):(.*) -
+ ^(depends_run):(.*) -
+ ^(depends_extract):(.*) -
+ ^(depends_fetch):(.*) -
+ ^(depends_test):(.*) -
+ ^(replaced_by):(.*) -
+ ^(revision):(.*) -
+ ^(subport):(.*) -
+ ^(subports):(.*) -
+ ^(license):(.*) { # Handle special port selectors
advance
- # Break up the token, because older Tcl switch doesn't support -matchvar
- regexp {^(\w+):(.*)} $token matchvar field pat
+ set field [lindex $matchvar 1]
+ set pat [lindex $matchvar 2]
# Remap friendly names to actual names
set field [map_friendly_field_names $field]
@@ -1334,11 +1335,11 @@
set el 1
}
- ^depends: { # A port selector shorthand for depends_{lib,build,run,fetch,extract}
+ ^(depends):(.*) { # A port selector shorthand for depends_{lib,build,run,fetch,extract}
advance
- # Break up the token, because older Tcl switch doesn't support -matchvar
- regexp {^(\w+):(.*)} $token matchvar field pat
+ set field [lindex $matchvar 1]
+ set pat [lindex $matchvar 2]
add_multiple_ports reslist [get_matching_ports $pat no regexp "depends_lib"]
add_multiple_ports reslist [get_matching_ports $pat no regexp "depends_build"]
@@ -1350,12 +1351,12 @@
set el 1
}
- ^dependentof: -
- ^rdependentof: {
+ ^(dependentof):(.*) -
+ ^(rdependentof):(.*) {
advance
- # Break up the token, because older Tcl switch doesn't support -matchvar
- regexp {^(\w+):(.*)} $token matchvar selector portname
+ set selector [lindex $matchvar 1]
+ set portname [lindex $matchvar 2]
set recursive [string equal $selector "rdependentof"]
add_multiple_ports reslist [get_dependent_ports $portname $recursive]
@@ -1363,12 +1364,12 @@
set el 1
}
- ^depof: -
- ^rdepof: {
+ ^(depof):(.*) -
+ ^(rdepof):(.*) {
advance
- # Break up the token, because older Tcl switch doesn't support -matchvar
- regexp {^(\w+):(.*)} $token matchvar selector portname
+ set selector [lindex $matchvar 1]
+ set portname [lindex $matchvar 2]
set recursive [string equal $selector "rdepof"]
add_multiple_ports reslist [get_dep_ports $portname $recursive]
@@ -1376,11 +1377,11 @@
set el 1
}
- ^subportof: {
+ ^(subportof):(.*) {
advance
- # Break up the token, because older Tcl switch doesn't support -matchvar
- regexp {^(\w+):(.*)} $token matchvar selector portname
+ set selector [lindex $matchvar 1]
+ set portname [lindex $matchvar 2]
add_multiple_ports reslist [get_subports $portname]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20160402/181b6a69/attachment.html>
More information about the macports-changes
mailing list