commit: 3c143b00082ee16c4a7605c2ffdef5d154fa3219
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 16 05:34:32 2026 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Feb 16 06:01:35 2026 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=3c143b00
emaint: sync: simplify _do_pkg_moves
Early-return if --package-moves=n and move 2 of the configs into a variable
to reduce line length (we wrote one of them out twice anyway). quiet shouldn't
change either so check it earlier rather than re-checking on each
_global_updates
call.
Signed-off-by: Sam James <sam <AT> gentoo.org>
lib/portage/emaint/modules/sync/sync.py | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/lib/portage/emaint/modules/sync/sync.py
b/lib/portage/emaint/modules/sync/sync.py
index 787d66cec3..d4f578d437 100644
--- a/lib/portage/emaint/modules/sync/sync.py
+++ b/lib/portage/emaint/modules/sync/sync.py
@@ -267,19 +267,22 @@ class SyncRepos:
def _do_pkg_moves(self):
configs = [self.emerge_config.target_config]
- if (
- self.emerge_config.target_config.root
- != self.emerge_config.running_config.root
- ):
- configs.append(self.emerge_config.running_config)
+ target_config = self.emerge_config.target_config
+ running_config = self.emerge_config.running_config
+ package_moves = self.emerge_config.opts.get("--package-moves") != "n"
+ quiet = "--quiet" in self.emerge_config.opts
+ if not package_moves:
+ return
+
+ if target_config.root != running_config.root:
+ configs.append(running_config)
+
for root_config in configs:
- if self.emerge_config.opts.get(
- "--package-moves"
- ) != "n" and _global_updates(
+ if _global_updates(
root_config.root,
self.emerge_config.trees,
root_config.mtimedb["updates"],
- quiet=("--quiet" in self.emerge_config.opts),
+ quiet=quiet,
):
root_config.mtimedb.commit()
# Reload the whole config.