From patchwork Thu Feb 26 20:00:35 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1966 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1772136209; bh=VEsdfnqPk/tp+CiP3247SP//uYLh9E6uCnZEvbi3gX4=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=ewWgdkthyW69o5bEc3ElkuzTJKbViFvfTvircGXkDQwBUV/5jpV3WJ3m3tHX+WeKM AkPKQTg3I6gh1GzQ30wczM/2cVUh1BCvLGcEU2k9LNv3KCpQ/8LPBru+8yYSFkTkVL u35i1mDfwesEpTYuYipY7iR6h35uk4v/doGtViPMkLXUfHNOpw522D8orxp4dYiwTW D2pG7U3VYMZa81Ii+It+E1tRFTKoDyGu7SyWYxaaGCO4aXNkECKh2w4rxASirJe3gm WhaITj9znrJzV6p0b8YPNpF24Q2pBpzTb1tqAiWNKVCP/nPG2KG3eaNKAsuAadoaOl Zub8yoqRoVgog== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 08FEA69E42 for ; Thu, 26 Feb 2026 13:03:29 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id mv0XmaOswvUV for ; Thu, 26 Feb 2026 13:03:28 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1772136208; bh=VEsdfnqPk/tp+CiP3247SP//uYLh9E6uCnZEvbi3gX4=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=tBqV6d281xyaNrpwslvs3irXmDb1PLcG2Csq0VNrLqZwPVcCrAJjukjjxsXcVs5t2 deqhnvoS+7zv80QP00RZww34StTafiT+kQ95Nco2xO5mLn/tF25S4u2H38GadjZRxQ TBlf9OpRwPnBFm5NH/0t29Z14dPjyznYGKXme6OCqDVpVX72R18wFUoWKu43vXsewj QO7b75GhNICPmeBpj4h1uj3LDbp6zG5urXo/sg7LQ9vWuTxiNS+yhSKoMef6PKyLYR 72okPJQjDwQmbyFYTsq+qS96JN2FE0vHBB1Ir2mSYl+4V7vMFP118+htGAzlFllRPn XRBqImRqX1apw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E9C9F69E35 for ; Thu, 26 Feb 2026 13:03:28 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1772136207; bh=qYowomTjymAN/18PC6b/xbnemNjKJzI7Lm3ZeU5RtQA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sEitmiLx3J/OxicZj7eXWK7xwwzDqiv9AxoMoIx3fdvJZ5fgCwwANWIOY8i2kg/A5 e+ka0MFCE6QrAvnJywuh4DiyuHqybQzLfhDae0yzHNpfLfeF1YxBTJ/R7SjYtNWmrI i/2HGtT+SkhbUMK5gFFr0X54V99bBiETbc1hTvQ0HoBwn5ChJTx9MFsqhPrloigVQV rnBS6UHmNAmQjUnFaq2/MQVodJ8JeRQFBqKHRJiwrIcqRp+wp/nkWfbw5l6krUObEC KTp4qpXKt69ftYfu54/3wQNY0GCThLEfsZRDb9c+W+Hc29KUZ0z/rGAXDYZ8ImhvF6 Xf9ydOYOgF3hA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2CB5D69D8A; Thu, 26 Feb 2026 13:03:27 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id bvAtTE1Qzxwr; Thu, 26 Feb 2026 13:03:27 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1772136203; bh=hgRZ0LCS3MNFlLMipz1bN1NSFxG/nvAWA5Ed6UneA8U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UehYtf3i4TrscOF8IQL+cF0pXZNIdIiu02TtAAzC1U4r1NTlzvC/PEQ0okOyLJadc Yo60oX13nSt7akNhYsCXVgSl3FFeaEwJyfDNiGpBknlfRoggnnpkfGlB7KtXaLEy+a QMdhjqPsy+tFdbCsqKbTmdgG8SV82NmSERn8HZSlNlxAgLVjnRkQ7693KD7OWFsi+3 6zSOsMr/3X4qtQcdDX01cpEK3DA74ai/O3bAVowmlVx+rK/3nrPcPPdx1uGHZrQ9ub Fm3YPAYk27CP1w2h9A2dOkOxZKcfowmbLGOH+ippnhEeZX9latSaqftETCMTBc1JK3 koc5qM2JvMrYg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id BFCBD69D4A; Thu, 26 Feb 2026 13:03:22 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Thu, 26 Feb 2026 13:00:35 -0700 Message-ID: <20260226200106.1727176-30-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260226200106.1727176-1-sjg@u-boot.org> References: <20260226200106.1727176-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: Z47W353CFFAOMZKYJAEHCFWUY6ABJP7F X-Message-ID-Hash: Z47W353CFFAOMZKYJAEHCFWUY6ABJP7F X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 29/32] patman: Improve autolink wait with progress and backoff List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Use tout.progress() to show an updating status line while waiting for a series to appear on patchwork, instead of printing the full match table every iteration. Only show matches when they change. Back off the sleep interval from 5s up to 30s to reduce server load. On failure, print the patman autolink command to use later. Remove the noisy "Sleeping for N seconds" message from sleep(). Signed-off-by: Simon Glass --- tools/patman/cser_helper.py | 1 - tools/patman/cseries.py | 43 +++++++++++++++++++++++++++++++----- tools/patman/test_common.py | 1 + tools/patman/test_cseries.py | 28 +++++++++++++++-------- 4 files changed, 57 insertions(+), 16 deletions(-) diff --git a/tools/patman/cser_helper.py b/tools/patman/cser_helper.py index dd654738c06..ec3956db4d5 100644 --- a/tools/patman/cser_helper.py +++ b/tools/patman/cser_helper.py @@ -205,7 +205,6 @@ class CseriesHelper: Args: time_s (float): Amount of seconds to sleep for """ - print(f'Sleeping for {time_s} seconds') if self._fake_time is not None: self._fake_sleep(time_s) else: diff --git a/tools/patman/cseries.py b/tools/patman/cseries.py index 81a8712b3de..0b4ce91b024 100644 --- a/tools/patman/cseries.py +++ b/tools/patman/cseries.py @@ -284,27 +284,58 @@ class Cseries(cser_helper.CseriesHelper): start = self.get_time() stop = start + wait_s sleep_time = 5 + last_options = None while True: pws, options, name, version, desc = self.link_search( pwork, series, version) if pws: + tout.clear_progress() if wait_s: tout.notice('Link completed after ' f'{self.get_time() - start} seconds') break - print(f"Possible matches for '{name}' v{version} desc '{desc}':") - print(' Link Version Description') - for opt in options: - print(f"{opt['id']:6} {opt['version']:7} {opt['name']}") if not wait_s or self.get_time() > stop: + tout.clear_progress() + if options != last_options: + self._show_autolink_matches(name, version, desc, + options) delay = f' after {wait_s} seconds' if wait_s else '' - raise ValueError(f"Cannot find series '{desc}{delay}'") - + raise ValueError( + f"Cannot find series '{desc}'{delay}; " + 'to try again later:\n' + f" patman series autolink -s {name} -V {version}") + + if options != last_options: + tout.clear_progress() + self._show_autolink_matches(name, version, desc, options) + last_options = options + + elapsed = int(self.get_time() - start) + tout.progress( + f'Waiting for series on patchwork ({elapsed}s)') self.sleep(sleep_time) + sleep_time = min(sleep_time + 5, 30) self.link_set(name, version, pws, update_commit) + def _show_autolink_matches(self, name, version, desc, options): + """Show possible autolink matches + + Args: + name (str): Series name + version (int): Series version + desc (str): Series description + options (list of dict): Possible matches from patchwork + """ + print(f"Possible matches for '{name}' v{version} desc '{desc}':") + if options: + print(' Link Version Description') + for opt in options: + print(f"{opt['id']:6} {opt['version']:7} {opt['name']}") + else: + print(' (none)') + def link_auto_all(self, pwork, update_commit, link_all_versions, replace_existing, dry_run, show_summary=True): """Automatically find a series link by looking in patchwork diff --git a/tools/patman/test_common.py b/tools/patman/test_common.py index 7da995dda22..6cf007cc1f2 100644 --- a/tools/patman/test_common.py +++ b/tools/patman/test_common.py @@ -66,6 +66,7 @@ class TestCommon: self.gitdir = os.path.join(self.tmpdir, '.git') tout.init(tout.DEBUG if self.verbosity else tout.INFO, allow_colour=False) + tout.stdout_is_tty = False def tearDown(self): """Delete the temporary dir""" diff --git a/tools/patman/test_cseries.py b/tools/patman/test_cseries.py index 3d475956ff9..c0beb128265 100644 --- a/tools/patman/test_cseries.py +++ b/tools/patman/test_cseries.py @@ -3750,15 +3750,25 @@ Date: .* with terminal.capture() as (out, _): cser.link_auto(pwork, 'second3', 3, True, 50) itr = iter(out.getvalue().splitlines()) - for i in range(7): - self.assertEqual( - "Possible matches for 'second' v3 desc 'Series for my board':", - next(itr), f'failed at i={i}') - self.assertEqual(' Link Version Description', next(itr)) - self.assertEqual(' 456 1 Series for my board', next(itr)) - self.assertEqual(' 457 2 Series for my board', next(itr)) - self.assertEqual('Sleeping for 5 seconds', next(itr)) - self.assertEqual('Link completed after 35 seconds', next(itr)) + + # Matches shown only once (they don't change between retries) + self.assertEqual( + "Possible matches for 'second' v3 desc 'Series for my board':", + next(itr)) + self.assertEqual(' Link Version Description', next(itr)) + self.assertEqual(' 456 1 Series for my board', next(itr)) + self.assertEqual(' 457 2 Series for my board', next(itr)) + + # Progress messages with backoff (5, 10, 15, 20s sleeps) + self.assertEqual( + 'Waiting for series on patchwork (0s)...', next(itr)) + self.assertEqual( + 'Waiting for series on patchwork (5s)...', next(itr)) + self.assertEqual( + 'Waiting for series on patchwork (15s)...', next(itr)) + self.assertEqual( + 'Waiting for series on patchwork (30s)...', next(itr)) + self.assertEqual('Link completed after 50 seconds', next(itr)) self.assertRegex( next(itr), 'Checking out upstream commit refs/heads/base: .*') self.assertEqual(