From patchwork Sat Apr 4 21:28:56 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2135 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=1775338341; bh=V1DOrbx33rsziM3GcrxzPI6za9gGVPNg3uXilQFxyi0=; 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=BjZWVZN0bEJ1ZAg/V5t4xUsj6nk8KwWX7M86pPrthzcpf5h1KoivH7gppx9eRf53R sCSlu26Rst8uOOxW7CDLiUkWfvgC8wTUT0VN6nlFIUQ9AkA7jBrIicYr4aYOsM0v7+ R2C6GsZF2iO0JPy6Dfgzr6d90FH5nT/sfHTbQ8hY2Dlxdje2L5sB+q1RXSvvzAPGEx CTeDGBxstJ4efMEV6LeS19UUu+HlgNNQcMK0syR8FEzNXUxfFRRUiX+TbSiT1DQeO7 2ExxYdJesQvK4bytSKLbomSLQZOIRcLYEK2LiKR756NbqqK7UJsaO8TxEflNVrkyGc ZL+Y81lLSVgeg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 33FDD5FC8F for ; Sat, 4 Apr 2026 15:32:21 -0600 (MDT) 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 7HZ99GZyLytK for ; Sat, 4 Apr 2026 15:32:21 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1775338341; bh=V1DOrbx33rsziM3GcrxzPI6za9gGVPNg3uXilQFxyi0=; 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=BjZWVZN0bEJ1ZAg/V5t4xUsj6nk8KwWX7M86pPrthzcpf5h1KoivH7gppx9eRf53R sCSlu26Rst8uOOxW7CDLiUkWfvgC8wTUT0VN6nlFIUQ9AkA7jBrIicYr4aYOsM0v7+ R2C6GsZF2iO0JPy6Dfgzr6d90FH5nT/sfHTbQ8hY2Dlxdje2L5sB+q1RXSvvzAPGEx CTeDGBxstJ4efMEV6LeS19UUu+HlgNNQcMK0syR8FEzNXUxfFRRUiX+TbSiT1DQeO7 2ExxYdJesQvK4bytSKLbomSLQZOIRcLYEK2LiKR756NbqqK7UJsaO8TxEflNVrkyGc ZL+Y81lLSVgeg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 218E36833B for ; Sat, 4 Apr 2026 15:32:21 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1775338339; bh=Tn33w8C+9ufzXyqjnNvXdDnD/23OUHVQTnuT/TU5o4Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oOt2p3l52sf9AlJZTwIVpCz+IOZKsj2379nulhc1YR46nJl2gs1xJpaffJCyMEg8o wT62OIzohbSYDHuzxWAgXRo0wLy3JNJVUZTFA78WaIshIvaxZvgwbgUdLISbnkybrn kzxQuo1QhxEnTu20+9mmdjrAIJY0HO2YmiiPaLdu85vf3VvJwwtfJHUDGni4ftOSF+ B8NJO9UeejOW+tOAO19yHQKC2mI1Oa+OqSAHD3Xo1m6FnGPk5/1jYXNciueXpabmkI 6CTm8MGwvBeAkHuKYHrmSwATQh48IgC83h3+Wx4B3MNoEw9wvmi+EPmqu9zBwJe/cy HFq2x2uV4PQ1A== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B0ED65E7B4; Sat, 4 Apr 2026 15:32:19 -0600 (MDT) 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 r90ShjJB5wpO; Sat, 4 Apr 2026 15:32:19 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1775338335; bh=liX7xR7mc4/0e6iHbYIc65eJbaA5Bo+hEtIU3OlRjF8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CP9ul5J6ltkHvylu4WA6hNVYEzddhrWxWdarxEASuR+mJ3AEZv5DcAW9LWZN48twF 1pjg/3nRL6kfzkrme/MJipharUVq3/KaMNSp800FeW/r62IBIBVa2R5TEz3IRS4oAX X9VibCUTMdWbXjZuvTQYflWPXR8Dt0qV5k8YEL1kfkUTGiAsinb1Cjmuj2RSJbSAgG oLuneAU905v6JdNQCAPvqupbUZ1iqsC3ExJiqkgh6WYyno1SOFXYfR81SAspVCVLUw iRSrchgYGRU9NmzK+ozBO3ktP/LW4y41FinrLPdXPntPH4cIdXyFqKndZ2h/yaQKr2 KeJ8AOrRu0+mA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 54B3D6833B; Sat, 4 Apr 2026 15:32:15 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Sat, 4 Apr 2026 15:28:56 -0600 Message-ID: <20260404213020.372253-21-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260404213020.372253-1-sjg@u-boot.org> References: <20260404213020.372253-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: UVMG4APUSKIZUKPOEVQOJ36ZTC2VXK7E X-Message-ID-Hash: UVMG4APUSKIZUKPOEVQOJ36ZTC2VXK7E 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 20/37] patman: Move link resolution from control.py into status.py 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 The patchwork_status() function in control.py handles both series metadata parsing and patchwork link resolution. The latter belongs in status.py alongside the other status-checking logic. Extract the link resolution, URL override and Patchwork construction into a new find_link_and_show_status() function in status.py. This also fixes a bug where Patchwork() is constructed twice, with the second call dropping the single_thread parameter. Signed-off-by: Simon Glass --- tools/patman/control.py | 21 +++++---------------- tools/patman/status.py | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 16 deletions(-) diff --git a/tools/patman/control.py b/tools/patman/control.py index 87598622eb7..1c1b998ddd6 100644 --- a/tools/patman/control.py +++ b/tools/patman/control.py @@ -54,14 +54,14 @@ def patchwork_status(branch, count, start, end, dest_branch, force, """Check the status of patches in patchwork This finds the series in patchwork using the Series-link tag, checks for new - comments and review tags, displays then and creates a new branch with the + comments and review tags, displays them and creates a new branch with the review tags. Args: branch (str): Branch to create patches from (None = current) count (int): Number of patches to produce, or -1 to produce patches for the current branch back to the upstream commit - start (int): Start partch to use (0=first / top of branch) + start (int): Start patch to use (0=first / top of branch) end (int): End patch to use (0=last one in series, 1=one before that, etc.) dest_branch (str): Name of new branch to create with the updated tags @@ -96,20 +96,9 @@ def patchwork_status(branch, count, start, end, dest_branch, force, if not links: raise ValueError("Branch has no Series-links value") - _, version = patchstream.split_name_version(branch) - link = series.get_link_for_version(version, links) - if not link: - raise ValueError(f'Series-links has no link for v{version}') - tout.debug(f"Link '{link}") - - # Allow the series to override the URL - if 'patchwork_url' in series: - url = series.patchwork_url - pwork = Patchwork(url, single_thread=single_thread) - - pwork = Patchwork(url) - status.check_and_show_status(series, link, branch, dest_branch, force, - show_comments, False, pwork) + status.find_link_and_show_status( + series, branch, url, dest_branch, force, show_comments, False, + single_thread) def _setup_patchwork(cser, pwork, ups, pw_url): diff --git a/tools/patman/status.py b/tools/patman/status.py index 2828e4a3bfc..8673eeb697e 100644 --- a/tools/patman/status.py +++ b/tools/patman/status.py @@ -381,6 +381,44 @@ async def check_status(link, pwork, read_comments=False, read_cover_comments) +def find_link_and_show_status(series, branch, url, dest_branch, force, + show_comments, show_cover_comments, + single_thread=False): + """Find the patchwork link for a series and show its status + + Resolves the patchwork link from the series metadata, then checks + and displays the review status. + + Args: + series (Series): Series object for the existing branch + branch (str): Branch name (used to determine the version) + url (str): Patchwork server URL. Overridden by Series-patchwork-url + if present in the series. + dest_branch (str): Name of new branch to create, or None + force (bool): True to force overwriting dest_branch if it exists + show_comments (bool): True to show comments on each patch + show_cover_comments (bool): True to show cover letter comments + single_thread (bool): True to use a single thread for patchwork + """ + from patman import patchstream + from patman.patchwork import Patchwork + from u_boot_pylib import tout + + _, version = patchstream.split_name_version(branch) + links = series.get('links') + link = series.get_link_for_version(version, links) + if not link: + raise ValueError(f'Series-links has no link for v{version}') + tout.debug(f"Link '{link}") + + if 'patchwork_url' in series: + url = series.patchwork_url + pwork = Patchwork(url, single_thread=single_thread) + + check_and_show_status(series, link, branch, dest_branch, force, + show_comments, show_cover_comments, pwork) + + def check_and_show_status(series, link, branch, dest_branch, force, show_comments, show_cover_comments, pwork, test_repo=None):