public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: /, lib/_emerge/
Date: Mon,  2 Oct 2023 12:22:27 +0000 (UTC)	[thread overview]
Message-ID: <1696249344.7b855cb2bb50c59d5310f9e0326e8c49e4f29111.sam@gentoo> (raw)

commit:     7b855cb2bb50c59d5310f9e0326e8c49e4f29111
Author:     Florian Schmaus <flow <AT> gentoo <DOT> org>
AuthorDate: Mon Oct  2 10:21:10 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Oct  2 12:22:24 2023 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=7b855cb2

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 <AT> gentoo.org>
Closes: https://github.com/gentoo/portage/pull/1107
Signed-off-by: Sam James <sam <AT> gentoo.org>

 NEWS                    |  2 ++
 lib/_emerge/depgraph.py | 21 +++++++++++++++------
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/NEWS b/NEWS
index bfa6261bb9..75680fce18 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 ef7dd54052..a0d69ff305 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(


             reply	other threads:[~2023-10-02 12:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-02 12:22 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-12-19  1:25 [gentoo-commits] proj/portage:master commit in: /, lib/_emerge/ Zac Medico
2024-08-02 13:38 James Le Cuirot
2023-10-02 11:47 Sam James
2023-08-17  6:53 Sam James
2023-07-09  6:25 Sam James
2023-02-18  0:00 Sam James
2023-01-10  3:28 Sam James
2023-01-10  3:28 Sam James
2022-11-23 23:02 Sam James

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1696249344.7b855cb2bb50c59d5310f9e0326e8c49e4f29111.sam@gentoo \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox