From 6d1ee2c4f1ccd1bc783a6433a22166dbcfdd21e9 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Tue, 18 Jun 2024 11:27:55 +0200 Subject: JobStatusDisplay: show length of merge-wait queue Since FEATURES=merge-wait is now the default, the length of the merge-wait queue becomes more relevant. Hence show it as part of portage's job status display. Signed-off-by: Florian Schmaus Closes: https://github.com/gentoo/portage/pull/1347 Signed-off-by: James Le Cuirot --- NEWS | 1 + lib/_emerge/JobStatusDisplay.py | 10 +++++++++- lib/_emerge/Scheduler.py | 3 +++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index e8ba29df6..04ce6069d 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,7 @@ Features: * emerge: Make bare --root-deps option install build-time dependencies to ROOT as well as / for all EAPIs rather than instead of / for EAPI 6 and below (bug #435066). +* Show length of merge-wait queue as part of the status display Bug fixes: * ebuild: Handle Bash 5.2's change in behavior which enables the shopt diff --git a/lib/_emerge/JobStatusDisplay.py b/lib/_emerge/JobStatusDisplay.py index 9cf3c41db..f9e034c6e 100644 --- a/lib/_emerge/JobStatusDisplay.py +++ b/lib/_emerge/JobStatusDisplay.py @@ -1,4 +1,4 @@ -# Copyright 1999-2020 Gentoo Authors +# Copyright 1999-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 import io @@ -38,6 +38,7 @@ class JobStatusDisplay: object.__setattr__(self, "quiet", quiet) object.__setattr__(self, "xterm_titles", xterm_titles) object.__setattr__(self, "maxval", 0) + object.__setattr__(self, "merge_wait", 0) object.__setattr__(self, "merges", 0) object.__setattr__(self, "_changed", False) object.__setattr__(self, "_displayed", False) @@ -262,6 +263,13 @@ class JobStatusDisplay: f.pop_style() f.add_literal_data(" failed") + if self.merge_wait: + f.add_literal_data(", ") + f.push_style(number_style) + f.add_literal_data(f"{self.merge_wait}") + f.pop_style() + f.add_literal_data(" merge wait") + padding = self._jobs_column_width - len(plain_output.getvalue()) if padding > 0: f.add_literal_data(padding * " ") diff --git a/lib/_emerge/Scheduler.py b/lib/_emerge/Scheduler.py index e23ebeb7a..283144b55 100644 --- a/lib/_emerge/Scheduler.py +++ b/lib/_emerge/Scheduler.py @@ -1559,6 +1559,7 @@ class Scheduler(PollScheduler): self._deallocate_config(build.settings) self._jobs -= 1 self._status_display.running = self._jobs + self._status_display.merge_wait = len(self._merge_wait_queue) self._schedule() def _extract_exit(self, build): @@ -1836,6 +1837,8 @@ class Scheduler(PollScheduler): if task.is_system_pkg: break + self._status_display.merge_wait = len(self._merge_wait_queue) + if self._schedule_tasks_imp(): state_change += 1 -- cgit v1.2.3-65-gdbad