Skip to content

Commit

Permalink
Add 'rleaves' alias
Browse files Browse the repository at this point in the history
  • Loading branch information
danchr committed Feb 17, 2017
1 parent 0e729c0 commit b042c0e
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
11 changes: 11 additions & 0 deletions doc/port.1
Expand Up @@ -162,6 +162,17 @@ When passing \fIportnames\fR to an \fIaction\fR, \fBport\fR recognizes various \
\fIleaves\fR: installed ports that are unrequested and have no dependents
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fIrleaves\fR: installed ports that are unrequested and that no requested ports depend on
.RE
.sp
Sets of ports can also be specified with \fIpseudo\-portname selectors\fR, which expand to the ports in which the value of the \fIPortfile\fR option corresponding to the selector\(cqs name (in either singular or plural form where applicable) matches the given regular expression\&. Usage is: selector:regex
.PP
\fBThe \fR\fB\fIpseudo\-portname selectors\fR\fR\fB are:\fR
Expand Down
2 changes: 2 additions & 0 deletions doc/port.1.txt
Expand Up @@ -52,6 +52,8 @@ available port tree(s). These may be used in the same way as a 'portname'.
- 'unrequested': installed ports that were installed only to satisfy
dependencies
- 'leaves': installed ports that are unrequested and have no dependents
- 'rleaves': installed ports that are unrequested and that no
requested ports depend on

Sets of ports can also be specified with 'pseudo-portname selectors', which
expand to the ports in which the value of the 'Portfile' option corresponding
Expand Down
21 changes: 21 additions & 0 deletions src/port/port.tcl 100644 → 100755
Expand Up @@ -934,6 +934,26 @@ proc get_leaves_ports {} {
return [portlist_sort [opIntersection $results [get_unrequested_ports]]]
}

proc get_rleaves_ports {} {
if { [catch {set ilist [get_unrequested_ports]} result] } {
if {$result ne "Registry error: No ports registered as installed."} {
ui_debug $::errorInfo
fatal "port installed failed: $result"
}
}
registry::open_dep_map
set requested [get_requested_ports]
set results {}
foreach i $ilist {
set iname [lindex $i 9]
set deplist [get_dependent_ports $iname 1]
if {$deplist eq "" || [opIntersection $deplist $requested] eq ""} {
add_to_portlist results $i
}
}
return [portlist_sort $results]
}

proc get_dependent_ports {portname recursive} {
registry::open_dep_map
set deplist [registry::list_dependents $portname]
Expand Down Expand Up @@ -1295,6 +1315,7 @@ proc element { resname } {
^(inactive)(@.*)?$ -
^(actinact)(@.*)?$ -
^(leaves)(@.*)?$ -
^(rleaves)(@.*)?$ -
^(outdated)(@.*)?$ -
^(obsolete)(@.*)?$ -
^(requested)(@.*)?$ -
Expand Down

0 comments on commit b042c0e

Please sign in to comment.