<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/30dbb2f218232bdca20fb257d16babed745a6151">https://github.com/macports/macports-base/commit/30dbb2f218232bdca20fb257d16babed745a6151</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit 30dbb2f218232bdca20fb257d16babed745a6151
</span>Author: Joshua Root <jmr@macports.org>
AuthorDate: Mon Jul 8 17:14:27 2024 +1000
<span style='display:block; white-space:pre;color:#404040;'> Add --rsync option for selfupdate
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Forces use of rsync to download bases sources, just in case there are
</span><span style='display:block; white-space:pre;color:#404040;'> unforeseen issues with http. Don't delete the base sources after
</span><span style='display:block; white-space:pre;color:#404040;'> successful update with this option, since rsync updates them
</span><span style='display:block; white-space:pre;color:#404040;'> incrementally.
</span>---
doc/port-selfupdate.1.txt | 8 ++++++--
src/macports1.0/selfupdate.tcl | 21 +++++++++++++++------
src/port/port.tcl | 2 +-
3 files changed, 22 insertions(+), 9 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/doc/port-selfupdate.1.txt b/doc/port-selfupdate.1.txt
</span><span style='display:block; white-space:pre;color:#808080;'>index d7a6bb0c5..86a145b85 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/doc/port-selfupdate.1.txt
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/doc/port-selfupdate.1.txt
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -9,7 +9,7 @@ port-selfupdate - Upgrade MacPorts itself and update the port definition files.
</span> SYNOPSIS
--------
[cmdsynopsis]
<span style='display:block; white-space:pre;background:#ffe0e0;'>-*port* [*-qvdf*] *selfupdate* [--no-sync] [--migrate]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+*port* [*-qvdf*] *selfupdate* [--no-sync] [--migrate] [--rsync]
</span>
DESCRIPTION
-----------
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -34,6 +34,10 @@ OPTIONS
</span> available. Contrary to *-f*, this flag will prevent downgrades. This flag is
useful when upgrading to a newer macOS major version.
<span style='display:block; white-space:pre;background:#e0ffe0;'>+*--rsync*::
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ Use the older rsync method for downloading the new version of MacPorts.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ The default is to try HTTP(S) first, and use rsync only if that fails.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> include::global-flags.txt[]
*-q*::
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -85,7 +89,7 @@ If *selfupdate* fails, it usually does so in one of two places: The network
</span> connection, or the installation of the update.
Network Problems::
<span style='display:block; white-space:pre;background:#ffe0e0;'>-MacPorts uses the 'rsync' protocol to update its port tree to the latest version.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+MacPorts uses the 'rsync' protocol to update its ports tree to the latest version.
</span> This will fail if you are on a network that blocks TCP connections to the rsync
port 873. Talk to your network administrators and ask them to allow connections
to port 873 if this happens to you. Alternatively, you can just download a new
<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 7292b88dd..956049c10 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;'>@@ -494,7 +494,8 @@ proc selfupdate::install {source} {
</span>
proc selfupdate::cleanup_sources {mp_source_path} {
global macports::portdbpath macports::rsync_server
<span style='display:block; white-space:pre;background:#ffe0e0;'>- file delete -force $mp_source_path [file join $portdbpath sources $rsync_server]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set rsync_base_files [glob -nocomplain -directory [file join $portdbpath sources $rsync_server] base*]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ file delete -force $mp_source_path {*}$rsync_base_files
</span> }
proc selfupdate::do_sync {options presync} {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -540,6 +541,7 @@ proc selfupdate::main {{options {}} {updatestatusvar {}}} {
</span> }
ui_debug "MacPorts sources location: $mp_source_path"
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ set prefer_rsync [expr {[dict exists $options ports_selfupdate_rsync] && [dict get $options ports_selfupdate_rsync]}]
</span> set rsync_fetched 0
macports_try -pass_signal {
set macports_version_new [get_current_version $mp_source_path]
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -583,10 +585,14 @@ proc selfupdate::main {{options {}} {updatestatusvar {}}} {
</span> ui_msg "$ui_prefix MacPorts base is outdated, installing new version $macports_version_new"
if {!$rsync_fetched} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- macports_try -pass_signal {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set source_code [download_source $mp_source_path $macports_version_new]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- } on error {eMessage} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_debug "download_source failed: $eMessage"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {!$prefer_rsync} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ macports_try -pass_signal {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set source_code [download_source $mp_source_path $macports_version_new]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } on error {eMessage} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_debug "download_source failed: $eMessage"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set source_code [download_source_rsync]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span> set source_code [download_source_rsync]
}
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -596,7 +602,10 @@ proc selfupdate::main {{options {}} {updatestatusvar {}}} {
</span> dict set updatestatus base_updated yes
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- cleanup_sources $mp_source_path
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Keep sources for future syncing if preferring rsync
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {!$prefer_rsync} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ cleanup_sources $mp_source_path
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span> # Return here, port.tcl will re-execute selfupdate with the updated
# base to trigger sync and portindex with the new version
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 793646cbf..8a9dfa29b 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;'>@@ -4208,7 +4208,7 @@ set cmd_opts_array [dict create {*}{
</span> depends description epoch exact glob homepage line
long_description maintainer maintainers name platform
platforms portdir regex revision variant variants version}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- selfupdate {migrate no-sync nosync}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ selfupdate {migrate no-sync nosync rsync}
</span> space {{units 1} total}
activate {no-exec}
deactivate {no-exec}
</pre><pre style='margin:0'>
</pre>