[Concept,15/37] patman: Add debug logging to autolink and patchwork queries

Message ID 20260404213020.372253-16-sjg@u-boot.org
State New
Headers
Series patman: Autolink fixes and AI-assisted patch review |

Commit Message

Simon Glass April 4, 2026, 9:28 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

Add tout.debug() calls throughout the autolink pipeline so failures
can be diagnosed with -v. Log the patchwork URL resolution, project
lookup, series queries and autolink progress.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/patman/control.py   | 1 +
 tools/patman/cseries.py   | 8 ++++++++
 tools/patman/patchwork.py | 5 +++--
 3 files changed, 12 insertions(+), 2 deletions(-)
  

Patch

diff --git a/tools/patman/control.py b/tools/patman/control.py
index a37893785ad..61379cc108e 100644
--- a/tools/patman/control.py
+++ b/tools/patman/control.py
@@ -182,6 +182,7 @@  def do_series(args, test_db=None, pwork=None, cser=None):
         cser.open_database()
         if args.subcmd in needs_patchwork:
             ups = cser.get_series_upstream(args.series)
+            tout.debug(f'Series upstream: {ups!r}')
             pwork = _setup_patchwork(
                 cser, pwork, ups, args.patchwork_url)
         elif pwork and pwork is not True:
diff --git a/tools/patman/cseries.py b/tools/patman/cseries.py
index 5569eb6f4f5..1dd1550f367 100644
--- a/tools/patman/cseries.py
+++ b/tools/patman/cseries.py
@@ -302,11 +302,19 @@  class Cseries(cser_helper.CseriesHelper):
         stop = start + wait_s
         sleep_time = 5
         last_options = None
+        first = True
         while True:
             pws, options, name, version, desc = self.link_search(
                 pwork, series, version)
+            if first:
+                tout.debug(f"Autolinking series '{name}' v{version}"
+                           f" (timeout {wait_s}s)")
+                first = False
+            tout.debug(f"Searching {pwork.url} project {pwork.proj_id}"
+                       f" for '{desc}'")
             if pws:
                 tout.clear_progress()
+                tout.debug(f'Found link: {pws}')
                 if wait_s:
                     tout.notice('Link completed after '
                                 f'{self.get_time() - start} seconds')
diff --git a/tools/patman/patchwork.py b/tools/patman/patchwork.py
index de676161eee..3e8f7c6c62c 100644
--- a/tools/patman/patchwork.py
+++ b/tools/patman/patchwork.py
@@ -281,8 +281,9 @@  class Patchwork:
             list of series matches, each a dict, see get_series()
         """
         query = desc.replace(' ', '+')
-        return await self._request(
-            client, f'series/?project={self.proj_id}&q={query}')
+        subpath = f'series/?project={self.proj_id}&q={query}'
+        tout.debug(f'  GET {self.url}/api/1.2/{subpath}')
+        return await self._request(client, subpath)
 
     async def _find_series(self, client, svid, ser_id, version, ser):
         """Find a series on the server