aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Schmaus <flow@gentoo.org>2023-10-02 12:21:10 +0200
committerSam James <sam@gentoo.org>2023-10-02 13:22:24 +0100
commit7b855cb2bb50c59d5310f9e0326e8c49e4f29111 (patch)
tree3a499b7bab1e612fda2b63f55291593c3c058227
parentsearch: fix 'mlen' counter for ambiguous package names (diff)
downloadportage-7b855cb2bb50c59d5310f9e0326e8c49e4f29111.tar.gz
portage-7b855cb2bb50c59d5310f9e0326e8c49e4f29111.tar.bz2
portage-7b855cb2bb50c59d5310f9e0326e8c49e4f29111.zip
depgraph: show backtrack information after dep resolution
To improve user's awareness of the backtracking performed by portage and the related limit, show briefly how much backtracking was done. Signed-off-by: Florian Schmaus <flow@gentoo.org> Closes: https://github.com/gentoo/portage/pull/1107 Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r--NEWS2
-rw-r--r--lib/_emerge/depgraph.py21
2 files changed, 17 insertions, 6 deletions
diff --git a/NEWS b/NEWS
index bfa6261bb..75680fce1 100644
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,8 @@ Features:
* emerge: Use appropriate colors if binpkgs are used in e.g. pkg_pretend
messages as well as elog's mod_echo module (bug #914159).
+* Show backtrack information after dependency resolution.
+
Bug fixes:
* Prevent gpg from removing /dev/null when unlocking signing key (bug #912808).
diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py
index ef7dd5405..a0d69ff30 100644
--- a/lib/_emerge/depgraph.py
+++ b/lib/_emerge/depgraph.py
@@ -11401,7 +11401,7 @@ def _spinner_start(spinner, myopts):
spinner.start_time = time.time()
-def _spinner_stop(spinner):
+def _spinner_stop(spinner, backtracked: int = -1, max_retries: int = -1):
if spinner is None or spinner.update == spinner.update_quiet:
return
@@ -11414,7 +11414,14 @@ def _spinner_stop(spinner):
stop_time = time.time()
time_fmt = f"{stop_time - spinner.start_time:.2f}"
- portage.writemsg_stdout(f"Dependency resolution took {darkgreen(time_fmt)} s.\n\n")
+
+ backtrack_info = ""
+ if backtracked >= 0:
+ backtrack_info = f" (backtrack: {backtracked}/{max_retries})"
+
+ portage.writemsg_stdout(
+ f"Dependency resolution took {darkgreen(time_fmt)} s{backtrack_info}.\n\n"
+ )
def backtrack_depgraph(
@@ -11430,13 +11437,15 @@ def backtrack_depgraph(
Raises PackageSetNotFound if myfiles contains a missing package set.
"""
+ backtracked, max_retries = -1, -1
_spinner_start(spinner, myopts)
try:
- return _backtrack_depgraph(
+ success, mydepgraph, favorites, backtracked, max_retries = _backtrack_depgraph(
settings, trees, myopts, myparams, myaction, myfiles, spinner
)
+ return (success, mydepgraph, favorites)
finally:
- _spinner_stop(spinner)
+ _spinner_stop(spinner, backtracked, max_retries)
def _backtrack_depgraph(
@@ -11447,7 +11456,7 @@ def _backtrack_depgraph(
myaction: Optional[str],
myfiles: list[str],
spinner: "_emerge.stdout_spinner.stdout_spinner",
-) -> tuple[Any, depgraph, list[str]]:
+) -> tuple[Any, depgraph, list[str], int, int]:
debug = "--debug" in myopts
mydepgraph = None
max_retries = myopts.get("--backtrack", 10)
@@ -11540,7 +11549,7 @@ def _backtrack_depgraph(
)
success, favorites = mydepgraph.select_files(myfiles)
- return (success, mydepgraph, favorites)
+ return (success, mydepgraph, favorites, backtracked, max_retries)
def resume_depgraph(