<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/5dbc5abec55db643d0ad19962386c138e697d212">https://github.com/macports/macports-base/commit/5dbc5abec55db643d0ad19962386c138e697d212</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit 5dbc5abec55db643d0ad19962386c138e697d212
</span>Author: Joshua Root <jmr@macports.org>
AuthorDate: Wed Jan 31 08:52:45 2024 +1100
<span style='display:block; white-space:pre;color:#404040;'> Remove port.tcl specific from entry_for_portlist
</span>---
src/port/port.tcl | 58 ++++++++++++++++++++++++++++++--------------
src/portlist1.0/portlist.tcl | 15 +-----------
2 files changed, 41 insertions(+), 32 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 1f3f44098..f3711328d 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;'>@@ -169,6 +169,28 @@ proc registry_installed {portname {portversion ""}} {
</span> }
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+# Add the entry to the given portlist, adding default values for name,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# porturl and options if not set.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+proc add_to_portlist_with_defaults {listname portentry} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ upvar $listname portlist
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![dict exists $portentry options]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ dict set portentry options [array get ::global_options]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # If neither portname nor url is specified, then default to the current port
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![dict exists $portentry url] && ![dict exists $portentry name]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set url file://.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set portname [url_to_portname $url]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ dict set portentry url $url
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ dict set portentry name $portname
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {$portname eq ""} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_error "A default port name could not be supplied."
</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;'>+ # Form portlist entry and add to portlist
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ add_to_portlist portlist $portentry
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span>
proc url_to_portname { url {quiet 0} } {
# Save directory and restore the directory, since mportopen changes it
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -383,7 +405,7 @@ proc unique_results_to_portlist {infos} {
</span> array unset portinfo
array set portinfo $info
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set portentry [entry_for_portlist [list url $portinfo(porturl) name $name]]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set portentry [entry_for_portlist [list url $portinfo(porturl) name $name options [array get ::global_options]]]
</span>
array unset entry
array set entry $portentry
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -440,7 +462,7 @@ proc get_current_port {} {
</span> }
set results [list]
<span style='display:block; white-space:pre;background:#ffe0e0;'>- add_to_portlist results [list url $url name $portname]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ add_to_portlist_with_defaults results [list url $url name $portname]
</span> return $results
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -463,7 +485,7 @@ proc get_installed_ports { {ignore_active yes} {active yes} } {
</span> set iactive [lindex $i 4]
if { ${ignore_active} eq "yes" || (${active} eq "yes") == (${iactive} != 0) } {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- add_to_portlist results [list name $iname version "${iversion}_${irevision}" variants $ivariants]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ add_to_portlist_with_defaults results [list name $iname version "${iversion}_${irevision}" variants $ivariants]
</span> }
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -603,7 +625,7 @@ proc get_outdated_ports {} {
</span>
# Add outdated ports to our results list
if { $comp_result < 0 } {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- add_to_portlist results [list name $portname version $installed_compound variants [split_variants $installed_variants]]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ add_to_portlist_with_defaults results [list name $portname version $installed_compound variants [split_variants $installed_variants]]
</span> }
}
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -652,7 +674,7 @@ proc get_ports_with_prop {propname propval} {
</span> set iepoch [lindex $i 5]
set regref [registry::open_entry $iname $iversion $irevision $ivariants $iepoch]
if {[registry::property_retrieve $regref $propname] eq $propval} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- add_to_portlist results [list name $iname version "${iversion}_${irevision}" variants [split_variants $ivariants]]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ add_to_portlist_with_defaults results [list name $iname version "${iversion}_${irevision}" variants [split_variants $ivariants]]
</span> }
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -681,7 +703,7 @@ proc get_leaves_ports {} {
</span> foreach i $ilist {
set iname [lindex $i 0]
if {[registry::list_dependents $iname] eq ""} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- add_to_portlist results [list name $iname version "[lindex $i 1]_[lindex $i 2]" variants [split_variants [lindex $i 3]]]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ add_to_portlist_with_defaults results [list name $iname version "[lindex $i 1]_[lindex $i 2]" variants [split_variants [lindex $i 3]]]
</span> }
}
return [portlist_sort [opIntersection $results [get_unrequested_ports]]]
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -701,7 +723,7 @@ proc get_rleaves_ports {} {
</span> set iname [lindex $i 9]
set deplist [get_dependent_ports $iname 1]
if {$deplist eq "" || [opIntersection $deplist $requested] eq ""} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- add_to_portlist results $i
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ add_to_portlist_with_defaults results $i
</span> }
}
return [portlist_sort $results]
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -713,7 +735,7 @@ proc get_dependent_ports {portname recursive} {
</span> # could return specific versions here using registry2.0 features
set results [list]
foreach dep $deplist {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- add_to_portlist results [list name [lindex $dep 2]]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ add_to_portlist_with_defaults results [list name [lindex $dep 2]]
</span> }
# actually do this iteratively to avoid hitting Tcl's recursion limit
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -728,7 +750,7 @@ proc get_dependent_ports {portname recursive} {
</span> set rdeplist [registry::list_dependents $depname]
foreach rdep $rdeplist {
lappend newlist $rdep
<span style='display:block; white-space:pre;background:#ffe0e0;'>- add_to_portlist rportlist [list name [lindex $rdep 2]]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ add_to_portlist_with_defaults rportlist [list name [lindex $rdep 2]]
</span> }
}
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -774,7 +796,7 @@ proc get_rdepends_ports {portname} {
</span> if {![info exists seen($lcport)]} {
set seen($lcport) 1
lappend portList $lcport
<span style='display:block; white-space:pre;background:#ffe0e0;'>- add_to_portlist results [list name $possiblyNewPort]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ add_to_portlist_with_defaults results [list name $possiblyNewPort]
</span> }
}
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -830,7 +852,7 @@ proc get_dep_ports {portname recursive} {
</span> foreach type $deptypes {
if {[info exists portinfo($type)]} {
foreach dep $portinfo($type) {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- add_to_portlist results [list name [lindex [split $dep :] end]]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ add_to_portlist_with_defaults results [list name [lindex [split $dep :] end]]
</span> lappend deplist $dep
}
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -874,7 +896,7 @@ proc get_dep_ports {portname recursive} {
</span> foreach type $deptypes {
if {[info exists portinfo($type)]} {
foreach rdep $portinfo($type) {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- add_to_portlist results [list name [lindex [split $rdep :] end]]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ add_to_portlist_with_defaults results [list name [lindex [split $rdep :] end]]
</span> lappend rdeplist $rdep
}
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -883,7 +905,7 @@ proc get_dep_ports {portname recursive} {
</span> # add them to the lists
foreach rdep $rdeplist {
lappend newlist $rdep
<span style='display:block; white-space:pre;background:#ffe0e0;'>- add_to_portlist rportlist [list name [lindex [split $rdep :] end]]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ add_to_portlist_with_defaults rportlist [list name [lindex [split $rdep :] end]]
</span> }
}
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -942,7 +964,7 @@ proc get_subports {portname} {
</span>
if {[info exists portinfo(subports)]} {
foreach subport $portinfo(subports) {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- add_to_portlist results [list name $subport]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ add_to_portlist_with_defaults results [list name $subport]
</span> }
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -1235,7 +1257,7 @@ proc element { resname } {
</span> if {$version ne ""} {
lappend templist metadata [list explicit_version 1]
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- add_to_portlist reslist $templist
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ add_to_portlist_with_defaults reslist $templist
</span> set el 1
} else {
ui_error "Can't open URL '$token' as a port"
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -1255,7 +1277,7 @@ proc element { resname } {
</span> if {$version ne ""} {
lappend templist metadata [list explicit_version 1]
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- add_to_portlist reslist $templist
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ add_to_portlist_with_defaults reslist $templist
</span> set el 1
}
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -3527,7 +3549,7 @@ proc action_search { action portlist opts } {
</span>
set tmp [list]
foreach {name info} $matches {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- add_to_portlist tmp [concat [list name $name] $info]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ add_to_portlist_with_defaults tmp [concat [list name $name] $info]
</span> }
set res [opUnion $res $tmp]
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -3607,7 +3629,7 @@ proc action_list { action portlist opts } {
</span>
# Default to list all ports if no portnames are supplied
if { ![llength $portlist] && [info exists private_options(ports_no_args)] && $private_options(ports_no_args) eq "yes"} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- add_to_portlist portlist [list name "-all-"]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ add_to_portlist_with_defaults portlist [list name "-all-"]
</span> }
foreachport $portlist {
<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 c5bed852d..f96fa5260 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;'>@@ -56,8 +56,6 @@ proc split_variants {variants} {
</span> }
proc entry_for_portlist {portentry} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- global global_options
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span> # Each portlist entry currently has the following elements in it:
# url if any
# name
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -74,18 +72,7 @@ proc entry_for_portlist {portentry} {
</span> if {![info exists port(version)]} { set port(version) "" }
if {![info exists port(variants)]} { set port(variants) "" }
if {![info exists port(requested_variants)]} { set port(requested_variants) "" }
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {![info exists port(options)]} { set port(options) [array get global_options] }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # If neither portname nor url is specified, then default to the current port
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if { $port(url) eq "" && $port(name) eq "" } {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set url file://.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set portname [url_to_portname $url]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set port(url) $url
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set port(name) $portname
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {$portname eq ""} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_error "A default port name could not be supplied."
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![info exists port(options)]} { set port(options) "" }
</span>
# Form the fully discriminated portname: portname/version_revison+-variants
set port(fullname) [string tolower $port(name)]/[composite_version $port(version) $port(variants)]
</pre><pre style='margin:0'>
</pre>