commit:     cfa675701264f00ea43127efcfe6819f3039db9d
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Mon Jun 23 02:56:21 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jun 23 10:37:10 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=cfa67570

emerge-webrsync: don't show news if invoked by portage

Presently, the sync_local() function executes emerge(1) for the purpose
of displaying news, provided that the 'FEATURES' variable contains
"news". While it makes sense to do so in the case that the user executes
emerge-webrsync directly, it does not in the case that emerge-webrsync
is executed by portage - as will happen if "sync-type = webrsync" is in
effect for the gentoo repo.

Address the issue by introducing a heuristic by which emerge-webrsync
can determine whether it was invoked by portage, and by refraining from
displaying news in that event.

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

 bin/emerge-webrsync | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/bin/emerge-webrsync b/bin/emerge-webrsync
index da39f78f24..8e7db13602 100755
--- a/bin/emerge-webrsync
+++ b/bin/emerge-webrsync
@@ -435,9 +435,10 @@ sync_local() {
        fi
 
        # --quiet suppresses output if there are no relevant news items
-       if contains_word news "${FEATURES}"; then
+       if (( ! from_portage )) && contains_word news "${FEATURES}"; then
                "${emerge}" --check-news --quiet
        fi
+
        return 0
 }
 
@@ -607,6 +608,9 @@ do_latest_snapshot() {
        done
 }
 
+# Determine whether emerge-webrsync was executed by portage.
+from_portage=${PORTAGE_BIN_PATH:+1}
+
 # Use emerge and portageq from the same directory/prefix as the current script,
 # so that we don't have to rely on PATH including the current EPREFIX.
 if ! emerge=$(PATH=${BASH_SOURCE%/*}:${PATH} type -P emerge); then

Reply via email to