<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/792035415475efa9c97a5c39051980f2e423832b">https://github.com/macports/macports-base/commit/792035415475efa9c97a5c39051980f2e423832b</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 792035415 Use registry2 in get_{installed,outdated}_ports
</span>792035415 is described below
<span style='display:block; white-space:pre;color:#808000;'>commit 792035415475efa9c97a5c39051980f2e423832b
</span>Author: Joshua Root <jmr@macports.org>
AuthorDate: Wed Feb 7 17:41:31 2024 +1100
<span style='display:block; white-space:pre;color:#404040;'> Use registry2 in get_{installed,outdated}_ports
</span>---
src/port/port.tcl | 151 +++++++++++++++++++++++-------------------------------
1 file changed, 63 insertions(+), 88 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 a9a0d1f4e..56e034de6 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;'>@@ -472,29 +472,21 @@ proc get_current_port {} {
</span>
proc get_installed_ports { {ignore_active yes} {active yes} } {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set ilist [list]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if { [catch {set ilist [registry::installed]} result] } {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {$result ne "Registry error: No ports registered as installed."} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_debug $::errorInfo
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- fatal "port installed failed: $result"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[catch {registry::entry imaged} results]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_debug $::errorInfo
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fatal "port installed failed: $results"
</span> }
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set results [list]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach i $ilist {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set iname [lindex $i 0]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set iversion [lindex $i 1]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set irevision [lindex $i 2]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set ivariants [split_variants [lindex $i 3]]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set iactive [lindex $i 4]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if { ${ignore_active} eq "yes" || (${active} eq "yes") == (${iactive} != 0) } {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- add_to_portlist_with_defaults results [dict create name $iname version "${iversion}_${irevision}" variants $ivariants]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set portlist [list]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach i $results {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set ivariants [split_variants [$i variants]]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {${ignore_active} eq "yes" || (${active} eq "yes") == ([$i state] eq "installed")} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ add_to_portlist_with_defaults portlist [dict create name [$i name] version [$i version]_[$i revision] variants $ivariants]
</span> }
}
# Return the list of ports, sorted
<span style='display:block; white-space:pre;background:#ffe0e0;'>- return [portlist_sort $results]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return [portlist_sort $portlist]
</span> }
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -542,91 +534,74 @@ proc get_actinact_ports {} {
</span>
proc get_outdated_ports {} {
# Get the list of installed ports
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set ilist [list]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if { [catch {set ilist [registry::installed]} result] } {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {$result ne "Registry error: No ports registered as installed."} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_debug $::errorInfo
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- fatal "port installed failed: $result"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if { [catch {set ilist [registry::entry imaged]} result] } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_debug $::errorInfo
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fatal "getting installed ports failed: $result"
</span> }
# Now process the list, keeping only those ports that are outdated
set results [list]
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if { [llength $ilist] > 0 } {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach i $ilist {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # Get information about the installed port
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set portname [lindex $i 0]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set installed_version [lindex $i 1]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set installed_revision [lindex $i 2]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set installed_compound "${installed_version}_${installed_revision}"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set installed_variants [lindex $i 3]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {${macports::cxx_stdlib} eq "libc++"} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set wrong_stdlib libstdc++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set wrong_stdlib libc++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach i $ilist {
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set is_active [lindex $i 4]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {$is_active == 0} continue
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Get information about the installed port
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set portname [$i name]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set installed_compound [$i version]_[$i revision]
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set installed_epoch [lindex $i 5]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[$i state] eq "imaged"} continue
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>- # Get info about the port from the index
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[catch {set res [mportlookup $portname]} result]} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_debug $::errorInfo
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- fatal "lookup of portname $portname failed: $result"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[llength $res] < 2} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[macports::ui_isset ports_debug]} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- puts stderr "$portname ($installed_compound is installed; the port was not found in the port index)"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- continue
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Get info about the port from the index
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[catch {set res [mportlookup $portname]} result]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_debug $::errorInfo
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fatal "lookup of portname $portname failed: $result"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[llength $res] < 2} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[macports::ui_isset ports_debug]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts stderr "$portname ($installed_compound is installed; the port was not found in the port index)"
</span> }
<span style='display:block; white-space:pre;background:#ffe0e0;'>- array unset portinfo
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- array set portinfo [lindex $res 1]
</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;'>+ array unset portinfo
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ array set portinfo [lindex $res 1]
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>- # Get information about latest available version and revision
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set latest_version $portinfo(version)
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set latest_revision 0
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[info exists portinfo(revision)] && $portinfo(revision) > 0} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set latest_revision $portinfo(revision)
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set latest_compound "${latest_version}_${latest_revision}"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set latest_epoch 0
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[info exists portinfo(epoch)]} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set latest_epoch $portinfo(epoch)
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Get information about latest available version and revision
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set latest_version $portinfo(version)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set latest_revision 0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[info exists portinfo(revision)] && $portinfo(revision) > 0} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set latest_revision $portinfo(revision)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set latest_epoch 0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[info exists portinfo(epoch)]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set latest_epoch $portinfo(epoch)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>- # Compare versions, first checking epoch, then version, then revision
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set comp_result 0
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {$installed_version != $latest_version} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set comp_result [expr {$installed_epoch - $latest_epoch}]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if { $comp_result == 0 } {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set comp_result [vercmp $installed_version $latest_version]
</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;'>+ # Compare versions, first checking epoch, then version, then revision
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set comp_result 0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[$i version] != $latest_version} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set comp_result [expr {[$i epoch] - $latest_epoch}]
</span> if { $comp_result == 0 } {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set comp_result [expr {$installed_revision - $latest_revision}]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set comp_result [vercmp [$i version] $latest_version]
</span> }
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {$comp_result == 0} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set regref [registry::open_entry $portname $installed_version $installed_revision $installed_variants $installed_epoch]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set os_platform_installed [registry::property_retrieve $regref os_platform]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set os_major_installed [registry::property_retrieve $regref os_major]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set cxx_stdlib_installed [registry::property_retrieve $regref cxx_stdlib]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set cxx_stdlib_overridden [registry::property_retrieve $regref cxx_stdlib_overridden]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {${macports::cxx_stdlib} eq "libc++"} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set wrong_stdlib libstdc++
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- } else {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set wrong_stdlib libc++
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {($os_platform_installed ni [list any "" 0] && $os_major_installed ni [list "" 0]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- && ($os_platform_installed != ${macports::os_platform}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- || ($os_major_installed ne "any" && $os_major_installed != ${macports::os_major})))
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- || ($cxx_stdlib_overridden == 0 && $cxx_stdlib_installed eq $wrong_stdlib)} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set comp_result -1
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if { $comp_result == 0 } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set comp_result [expr {[$i revision] - $latest_revision}]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {$comp_result == 0} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {([$i os_platform] ni [list any "" 0] && [$i os_major] ni [list "" 0]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ && ([$i os_platform] ne ${macports::os_platform}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ || ([$i os_major] ne "any" && [$i os_major] != ${macports::os_major})))
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ || ([$i cxx_stdlib_overridden] == 0 && [$i cxx_stdlib] eq $wrong_stdlib)} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set comp_result -1
</span> }
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>- # Add outdated ports to our results list
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if { $comp_result < 0 } {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- add_to_portlist_with_defaults results [dict create name $portname version $installed_compound variants [split_variants $installed_variants]]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Add outdated ports to our results list
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if { $comp_result < 0 } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ add_to_portlist_with_defaults results [dict create name $portname version $installed_compound variants [split_variants [$i variants]]]
</span> }
}
</pre><pre style='margin:0'>
</pre>