<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/08e9c464c372b09ed643c28a69ff1cb7fb99f65c">https://github.com/macports/macports-base/commit/08e9c464c372b09ed643c28a69ff1cb7fb99f65c</a></p>
<pre style="white-space: pre; background: #F8F8F8">The following commit(s) were added to refs/heads/master by this push:
<span style='display:block; white-space:pre;color:#404040;'> new 08e9c464c Use registry2 in action_dependents
</span>08e9c464c is described below
<span style='display:block; white-space:pre;color:#808000;'>commit 08e9c464c372b09ed643c28a69ff1cb7fb99f65c
</span>Author: Joshua Root <jmr@macports.org>
AuthorDate: Fri Feb 9 18:22:41 2024 +1100
<span style='display:block; white-space:pre;color:#404040;'> Use registry2 in action_dependents
</span>---
src/port/port.tcl | 73 +++++++++++++++++++++++---------------------
src/portlist1.0/portlist.tcl | 21 +++++++++++++
2 files changed, 59 insertions(+), 35 deletions(-)
<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 98c2f395c..a90c9abc7 100755
</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;'>@@ -145,8 +145,12 @@ proc map_friendly_field_names { field } {
</span> }
<span style='display:block; white-space:pre;background:#ffe0e0;'>-proc registry_installed {portname {portversion ""}} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set possible_matches [registry::entry imaged $portname]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+proc registry_installed {portname {portversion ""} {require_single yes} {only_active no}} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {!$only_active} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set possible_matches [registry::entry imaged $portname]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set possible_matches [registry::entry installed $portname]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span> if {$portversion ne ""} {
set matches [list]
foreach p $possible_matches {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -159,6 +163,10 @@ proc registry_installed {portname {portversion ""}} {
</span> set matches $possible_matches
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {!$require_single} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return $matches
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> if {[llength $matches] > 1} {
# set portname again since the one we were passed may not have had the correct case
set portname [[lindex $matches 0] name]
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -2525,45 +2533,31 @@ proc action_dependents { action portlist opts } {
</span> }
set ilist [list]
<span style='display:block; white-space:pre;background:#ffe0e0;'>- registry::open_dep_map
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span> set status 0
foreachport $portlist {
set composite_version [composite_version $portversion $variations]
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if { [catch {set ilist [registry::installed $portname $composite_version]} result] } {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_debug $::errorInfo
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- break_softcontinue "$result" 1 status
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- } else {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # choose the active version if there is one
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set index 0
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach i $ilist {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[lindex $i 4]} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set found 1
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- break
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- incr index
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {![info exists found]} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set index 0
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # set portname again since the one we were passed may not have had the correct case
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set portname [lindex $ilist $index 0]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set iversion [lindex $ilist $index 1]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set irevision [lindex $ilist $index 2]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set ivariants [lindex $ilist $index 3]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # choose the active version if there is one
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set ilist [registry_installed $portname $composite_version no yes]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {$ilist eq ""} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set ilist [registry_installed $portname $composite_version no no]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {$ilist eq ""} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ break_softcontinue "[string trim "$portname $composite_version"] is not installed" 1 status
</span> }
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ set regref [lindex $ilist 0]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set portname [$regref name]
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set deplist [registry::list_dependents $portname $iversion $irevision $ivariants]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set deplist [portlist_sortregrefs [$regref dependents]]
</span> if { [llength $deplist] > 0 } {
if {$action eq "rdependents"} {
set toplist $deplist
while 1 {
set newlist [list]
foreach dep $deplist {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set depname [lindex $dep 2]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set depname [$dep name]
</span> if {![info exists seen($depname)]} {
set seen($depname) 1
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set rdeplist [registry::list_dependents $depname]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set rdeplist [portlist_sortregrefs [$dep dependents]]
</span> foreach rdep $rdeplist {
lappend newlist $rdep
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -2579,6 +2573,7 @@ proc action_dependents { action portlist opts } {
</span> set portstack [list $toplist]
set pos_stack [list 0]
array unset seen
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ set rdependents_full [expr {[dict exists $options ports_rdependents_full] && [string is true -strict [dict get $options ports_rdependents_full]]}]
</span> ui_notice "The following ports are dependent on ${portname}:"
while 1 {
set cur_portlist [lindex $portstack end]
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -2593,10 +2588,14 @@ proc action_dependents { action portlist opts } {
</span> }
}
set cur_port [lindex $cur_portlist $cur_pos]
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set cur_portname [lindex $cur_port 2]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set cur_portname [$cur_port name]
</span> set spaces [string repeat " " [expr {[llength $pos_stack] * 2}]]
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {![info exists seen($cur_portname)] || ([dict exists $options ports_rdependents_full] && [string is true -strict [dict get $options ports_rdependents_full]])} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- puts "${spaces}${cur_portname}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![info exists seen($cur_portname)] || $rdependents_full} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {$rdependents_full || [macports::ui_isset ports_verbose]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts "${spaces}${cur_portname} @[$cur_port version]_[$cur_port revision][$cur_port variants]"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts "${spaces}${cur_portname}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span> set seen($cur_portname) 1
incr cur_pos
set pos_stack [lreplace $pos_stack end end $cur_pos]
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -2611,13 +2610,17 @@ proc action_dependents { action portlist opts } {
</span> }
} else {
foreach dep $deplist {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set depport [lindex $dep 2]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set depportname [$dep name]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[info exists seen($depportname)] && ([macports::ui_isset ports_quiet] || ![macports::ui_isset ports_verbose])} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ continue
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set seen($depportname) 1
</span> if {[macports::ui_isset ports_quiet]} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_msg "$depport"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_msg "$depportname"
</span> } elseif {![macports::ui_isset ports_verbose]} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_msg "$depport depends on $portname"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_msg "$depportname depends on $portname"
</span> } else {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_msg "$depport depends on $portname (by [lindex $dep 1]:)"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_msg "$depportname @[$dep version]_[$dep revision][$dep variants] depends on $portname (by port:)"
</span> }
}
}
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/portlist1.0/portlist.tcl b/src/portlist1.0/portlist.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index d9963a551..5d0b3108b 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/portlist1.0/portlist.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/portlist1.0/portlist.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -179,6 +179,27 @@ proc portlist_sortint {portlist} {
</span> return [lsort -command portlist_compareint $portlist]
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+proc portlist_compareregrefs {a b} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set byname [string compare -nocase [$a name] [$b name]]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {$byname != 0} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return $byname
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set byvers [vercmp [$a version] [$b version]]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {$byvers != 0} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return $byvers
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set byrevision [expr {[$a revision] - [$b revision]}]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {$byrevision != 0} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return $byrevision
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return [string compare -nocase [$a variants] [$b variants]]
</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;'>+# Sort a list of registry references
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+proc portlist_sortregrefs {reflist} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return [lsort -command portlist_compareregrefs $reflist]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> proc unique_entries {entries} {
# Form the list of all the unique elements in the list a,
# considering only the port fullname, and taking the first
</pre><pre style='margin:0'>
</pre>