commit:     c7f4f90b6c95d33d713cadc94a13f11cbbf3eeef
Author:     Florian Schmaus <flow <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 10 10:52:58 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Sep 11 11:26:59 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=c7f4f90b

bintree: Suppress up-to-date message if it isn't true

Portage would emit a message claiming that the local copy of the remote
index is up-to-date when getbinpkg_refresh=False. However, if
getbinpkg_refresh is set to False, then this doesn't mean that the
local copy is up-to-date. It means that we didn't check if it's
up-to-date.

Since populate() is potentially multiple times, typically the second
time with getbinpkg_refresh set to False, this leads to multiple
"Local copy of remote index is up-to-date" messages, even if just one
binhost is configured.

To avoid this potentially confusing behavior, suppress the message in
case getbinpkg_refresh is set to False.

Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>
Part-of: https://github.com/gentoo/portage/pull/1456
Closes: https://github.com/gentoo/portage/pull/1456
Signed-off-by: Sam James <sam <AT> gentoo.org>

 lib/portage/dbapi/bintree.py | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/lib/portage/dbapi/bintree.py b/lib/portage/dbapi/bintree.py
index f6bc0d7490..7152e72eba 100644
--- a/lib/portage/dbapi/bintree.py
+++ b/lib/portage/dbapi/bintree.py
@@ -1580,16 +1580,18 @@ class binarytree:
                         )
             except UseCachedCopyOfRemoteIndex:
                 changed = False
-                desc = "frozen" if repo.frozen else "up-to-date"
-                writemsg_stdout("\n")
-                writemsg_stdout(
-                    colorize(
-                        "GOOD",
-                        _("Local copy of remote index is %s and will be 
used.") % desc,
-                    )
-                    + "\n"
-                )
                 rmt_idx = pkgindex
+                if getbinpkg_refresh or repo.frozen:
+                    desc = "frozen" if repo.frozen else "up-to-date"
+                    writemsg_stdout("\n")
+                    writemsg_stdout(
+                        colorize(
+                            "GOOD",
+                            _("Local copy of remote index is %s and will be 
used.")
+                            % desc,
+                        )
+                        + "\n"
+                    )
             except OSError as e:
                 # This includes URLError which is raised for SSL
                 # certificate errors when PEP 476 is supported.

Reply via email to