commit:     f64504e61f1bf1c76999b0e77a7546ffe4052e07
Author:     Florian Schmaus <flow <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 15 19:15:15 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jun 17 02:58:32 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=f64504e6

binarytree: Relax local vs remote timestamp comparision

There seems to be a slight timestamp inconsistency that causes the
"local_timestamp != remote_timestap" expression to always evaluate to
true.

For example, on one of my systems, using
https://distfiles.gentoo.org/releases/amd64/binpackages/23.0/x86-64 as
as binhost, I end up with

remote timestamp: 1749900593
local  timestamp: 1749907793

The local timestamp is newer than the remote one. However portage
still performs expensive operations if "local_timestamp !=
remote_timestaps", causing a noticeable delay. Interestingly, it will
still print

    Local copy of remote index is up-to-date and will be used.

Changing the condition from

    local_timestamp != remote_timestamp

to

    local_timestamp < remote_timestamp

makes portage nearly immediately print the "Local copy … is up-to-date"
message, where it previously would take some seconds.

[sam: Add two bug tags.]

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

 lib/portage/dbapi/bintree.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/portage/dbapi/bintree.py b/lib/portage/dbapi/bintree.py
index 9da7898569..90f213f1cb 100644
--- a/lib/portage/dbapi/bintree.py
+++ b/lib/portage/dbapi/bintree.py
@@ -1558,7 +1558,9 @@ class binarytree:
                                 noiselevel=-1,
                             )
                             pkgindex = None
-                        elif local_timestamp != remote_timestamp:
+                        elif not local_timestamp or int(local_timestamp) < int(
+                            remote_timestamp
+                        ):
                             rmt_idx.readBody(f_dec)
                             pkgindex = rmt_idx
                 finally:

Reply via email to