<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/4ae6d9826afeaa3ce008459fa99cab37b8060723">https://github.com/macports/macports-base/commit/4ae6d9826afeaa3ce008459fa99cab37b8060723</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 4ae6d9826 selfupdate: report number of outdated ports
</span>4ae6d9826 is described below
<span style='display:block; white-space:pre;color:#808000;'>commit 4ae6d9826afeaa3ce008459fa99cab37b8060723
</span>Author: Xavier Hsinyuan <me@lstlx.com>
AuthorDate: Wed Jan 3 13:38:11 2024 +0800
<span style='display:block; white-space:pre;color:#404040;'> selfupdate: report number of outdated ports
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Change the updatestatusvar into a dict, and return extra status
</span><span style='display:block; white-space:pre;color:#404040;'> information in it: whether the ports tree was synced, and whether
</span><span style='display:block; white-space:pre;color:#404040;'> portindex still needs to be run. Use this information to print messages
</span><span style='display:block; white-space:pre;color:#404040;'> referring to port(1) commands in action_selfupdate instead of in
</span><span style='display:block; white-space:pre;color:#404040;'> selfupdate::main, where they may not have been appropriate if using a
</span><span style='display:block; white-space:pre;color:#404040;'> different client.
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Closes: https://trac.macports.org/ticket/33820
</span>---
src/macports1.0/selfupdate.tcl | 22 ++++++++++++----------
src/port/port.tcl | 28 ++++++++++++++++++++++++----
2 files changed, 36 insertions(+), 14 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/macports1.0/selfupdate.tcl b/src/macports1.0/selfupdate.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index ae1a0238b..7292b88dd 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/macports1.0/selfupdate.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/macports1.0/selfupdate.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -524,10 +524,13 @@ proc selfupdate::main {{options {}} {updatestatusvar {}}} {
</span> macports::portdbpath \
macports::ui_prefix
<span style='display:block; white-space:pre;background:#ffe0e0;'>- # variable that indicates whether we actually updated base
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # variable for communicating various status information to the caller:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # whether we actually updated base, and if portindex is still required
</span> if {$updatestatusvar ne ""} {
upvar $updatestatusvar updatestatus
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set updatestatus no
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set updatestatus [dict create base_updated no \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ needed_portindex no \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ synced no]
</span> }
set mp_source_path [file join $portdbpath sources selfupdate]
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -564,6 +567,10 @@ proc selfupdate::main {{options {}} {updatestatusvar {}}} {
</span> # pre-syncing ports tree if needed (batch, shell modes)
if {$comp > 0 && [dict exists $options ports_selfupdate_presync] && [dict get $options ports_selfupdate_presync]} {
lassign [do_sync $options 1] synced need_reindex
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[info exists updatestatus]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ dict set updatestatus needed_portindex $need_reindex
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ dict set updatestatus synced $synced
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span> }
# Check whether we need to re-install base because of a migration
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -586,13 +593,9 @@ proc selfupdate::main {{options {}} {updatestatusvar {}}} {
</span> install $source_code
if {[info exists updatestatus]} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set updatestatus yes
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ dict set updatestatus base_updated yes
</span> }
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[info exists need_reindex] && $need_reindex} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_msg "Not all sources could be fully synced using the old version of MacPorts."
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_msg "Please run selfupdate again now that MacPorts base has been updated."
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span> cleanup_sources $mp_source_path
# Return here, port.tcl will re-execute selfupdate with the updated
# base to trigger sync and portindex with the new version
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -605,9 +608,8 @@ proc selfupdate::main {{options {}} {updatestatusvar {}}} {
</span> }
lassign [do_sync $options 0] synced
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {$synced} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_msg "\nThe ports tree has been updated. To upgrade your installed ports, you should run"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_msg " port upgrade outdated"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[info exists updatestatus]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ dict set updatestatus synced $synced
</span> }
return 0
<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 fa660ab9b..e6009c5ec 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;'>@@ -2418,13 +2418,16 @@ proc action_selfupdate { action portlist opts } {
</span> if {[prefix_unwritable]} {
return 1
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- global global_options
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ global global_options ui_options
</span> set options [array get global_options]
if {[dict exists $options ports_${action}_nosync] && [dict get $options ports_${action}_nosync] eq "yes"} {
ui_warn "port selfupdate --nosync is deprecated, use --no-sync instead"
dict set options ports_${action}_no-sync [dict get $options ports_${action}_nosync]
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if { [catch {macports::selfupdate $options base_updated} result ] } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[info exists ui_options(ports_commandfiles)]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ dict set options ports_${action}_presync 1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if { [catch {macports::selfupdate $options selfupdate_status} result] } {
</span> ui_debug $::errorInfo
ui_error $result
if {![macports::ui_isset ports_verbose]} {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -2437,11 +2440,15 @@ proc action_selfupdate { action portlist opts } {
</span> fatal "port selfupdate failed: $result"
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {$base_updated} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # Base was upgraded, re-execute now to trigger sync and/or exit batch mode
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[dict get $selfupdate_status base_updated]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Base was upgraded, re-execute now to trigger sync if possible
</span> if {[info exists ui_options(ports_commandfiles)]} {
# Batch mode, just exit since re-executing all commands in the file
# may not be correct.
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[dict get $selfupdate_status needed_portindex]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_msg "Not all sources could be fully synced using the old version of MacPorts."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_msg "Please run selfupdate again now that MacPorts base has been updated."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span> return -999
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -2466,6 +2473,19 @@ proc action_selfupdate { action portlist opts } {
</span> ui_error "Failed to re-execute selfupdate, please run 'sudo port selfupdate' manually."
return -999
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[dict get $selfupdate_status synced]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_msg "\nThe ports tree has been updated."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set length_outdated [llength [get_outdated_ports]]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {$length_outdated == 0} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_msg "All installed ports are up to date."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_msg "\n$length_outdated [expr {$length_outdated == 1 ? "port is": "ports are"}] outdated. Run 'port outdated' for details."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_msg "To upgrade your installed ports, you should run"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_msg " port upgrade outdated"
</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> return 0
}
</pre><pre style='margin:0'>
</pre>