commit:     3b551d0e89d75d347ac7607c8002c0e1ac51bdd0
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Wed Jul  2 06:05:31 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Jul  4 02:17:02 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=3b551d0e

emerge-webrsync: improve the diagnostic messages of sync_local()

As concerns the sync_local() function, increase the granularity and
utility of the informational messages that are shown. The revised
messages convey the following information:

- which utility is used to sync the repo, be it rsync(1) or tarsync
- the point at which tarball extraction begins, if using rsync(1)
- the location of the repo

Further, refrain from issuing suppositional claims in the event that
tar(1) or tarsync fail. There are various potential modes of failure and
it is a stretch to imply that the tarball be corrupt after undergoing
verification by checksum and - in most cases - by gemato or gpg(1).

Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 bin/emerge-webrsync | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/bin/emerge-webrsync b/bin/emerge-webrsync
index 541ca8d001..193f60bb8c 100755
--- a/bin/emerge-webrsync
+++ b/bin/emerge-webrsync
@@ -378,8 +378,6 @@ sync_local() {
        local ownership snapshot_dir
        local -a tarsync_opts rsync_opts
 
-       einfo "Syncing local repository ..."
-
        if ! contains_word usersync "${FEATURES}"; then
                ownership="${PORTAGE_USERNAME}:${PORTAGE_GRPNAME}"
        elif [[ ${USERLAND} == BSD ]]; then
@@ -389,6 +387,8 @@ sync_local() {
        fi || exit
 
        if hash tarsync 2>/dev/null; then
+               einfo "Using tarsync to refresh ${repo_location@Q} ..."
+
                tarsync_opts=( -s 1 -e /distfiles -e /packages -e /local )
                if chown "${ownership}" -- "${repo_location}" 2>/dev/null; then
                        tarsync_opts+=( -o "${ownership%:*}" -g 
"${ownership#*:}" )
@@ -397,18 +397,24 @@ sync_local() {
                        tarsync_opts+=( -v )
                fi
                if ! tarsync "${tarsync_opts[@]}" -- "${file}" 
"${repo_location}"; then
-                       eerror "tarsync failed; tarball is corrupt? (${file})"
+                       file=${file##*/}
+                       eerror "Failed to sync ${repo_location@Q} with 
${file@Q}"
                        return 1
                fi
        else
+               einfo "Extracting ${file@Q} ..."
+
                snapshot_dir=${tmpdir:?}/snapshot
                mkdir -- "${snapshot_dir}" && cd -- "${snapshot_dir}" || exit
 
                if ! do_tar "${file}" -x --strip-components=1 -f -; then
-                       eerror "tar failed to extract the image. tarball is 
corrupt? (${file})"
+                       file=${file##*/}
+                       eerror "Failed to extract the contents of ${file@Q}"
                        return 1
                fi
 
+               einfo "Using rsync to refresh ${repo_location@Q} ..."
+
                read -rd '' -a rsync_opts <<<"${PORTAGE_RSYNC_OPTS} 
${PORTAGE_RSYNC_EXTRA_OPTS}"
                if (( opt[quiet] )); then
                        rsync_opts+=( -q )

Reply via email to