<pre style='margin:0'>
Joshua Root (jmroot) pushed a commit to branch master
in repository macports-base.
</pre>
<p><a href="https://github.com/macports/macports-base/commit/12a73c47fd7a8056090bfe4783d61683b4525356">https://github.com/macports/macports-base/commit/12a73c47fd7a8056090bfe4783d61683b4525356</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit 12a73c47fd7a8056090bfe4783d61683b4525356
</span>Author: Joshua Root <jmr@macports.org>
AuthorDate: Fri Dec 16 02:21:47 2016 +1100
<span style='display:block; white-space:pre;color:#404040;'> Add rdepends: selector
</span>---
doc/port.1.txt | 1 +
src/port/port.tcl | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++----
2 files changed, 53 insertions(+), 4 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/doc/port.1.txt b/doc/port.1.txt
</span><span style='display:block; white-space:pre;color:#808080;'>index 9671f41..f67fafc 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/doc/port.1.txt
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/doc/port.1.txt
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -81,6 +81,7 @@ recursive dependencies or dependents of the given portname:
</span> [options="compact"]
- 'depof'
- 'rdepof'
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ - 'rdepends'
</span> - 'dependentof'
- 'rdependentof'
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/port/port.tcl b/src/port/port.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index bfb7ba4..46c89a0 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/port/port.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/port/port.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -108,9 +108,9 @@ about the ports. In all such cases, a standard regex pattern following
</span> the colon will be used to select the set of ports to which the
pseudo-portname expands.
<span style='display:block; white-space:pre;background:#ffe0e0;'>-Pseudo-portnames starting with depof:, rdepof:, dependentof:, and rdependentof:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-select ports that are direct or recursive dependencies or dependents of the
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-following portname, respectively.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+Pseudo-portnames starting with depof:, rdepof:, rdepends:, dependentof:, and
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+rdependentof: select ports that are direct or recursive dependencies or
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+dependents of the following portname, respectively.
</span>
Portnames that contain standard glob characters will be expanded to the
set of ports matching the glob pattern.
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -979,6 +979,45 @@ proc get_dependent_ports {portname recursive} {
</span> }
<span style='display:block; white-space:pre;background:#e0ffe0;'>+proc get_rdepends_ports {portname} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![info exists ::portDependenciesArray]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # make an associative array of all the port names and their (reverse) dependencies
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # much faster to build this once than to call mportsearch thousands of times
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set deptypes {depends_fetch depends_extract depends_build depends_lib depends_run depends_test}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach {pname pinfolist} [mportlistall] {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ array unset pinfo
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ array set pinfo $pinfolist
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach dtype $deptypes {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[info exists pinfo($dtype)]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach depspec $pinfo($dtype) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ lappend ::portDependenciesArray([string tolower [lindex [split $depspec :] end]]) $pname
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set results {}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set portList [list [string tolower $portname]]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ while {[llength $portList] > 0} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set aPort [lindex $portList 0]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set portList [lreplace $portList 0 0]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[info exists ::portDependenciesArray($aPort)]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach possiblyNewPort $::portDependenciesArray($aPort) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set lcport [string tolower $possiblyNewPort]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![info exists seen($lcport)]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set seen($lcport) 1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ lappend portList $lcport
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ add_to_portlist results [list name $possiblyNewPort]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return [portlist_sort $results]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> proc get_dep_ports {portname recursive} {
global global_variations
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -1321,7 +1360,6 @@ proc element { resname } {
</span> ^(depends):(.*) { # A port selector shorthand for depends_{lib,build,run,fetch,extract}
advance
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set field [lindex $matchvar 1]
</span> set pat [lindex $matchvar 2]
add_multiple_ports reslist [get_matching_ports $pat no regexp "depends_lib"]
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -1334,6 +1372,16 @@ proc element { resname } {
</span> set el 1
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ ^(rdepends):(.*) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ advance
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set portname [lindex $matchvar 2]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ add_multiple_ports reslist [get_rdepends_ports $portname]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set el 1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> ^(dependentof):(.*) -
^(rdependentof):(.*) {
advance
</pre><pre style='margin:0'>
</pre>