From patchwork Mon Jan 5 18:30:22 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1277 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=1767637884; bh=l0Ylylmqf9+z0QjVhQB0Qmd4/MCh4plgv2N86RKlxJw=; 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=OIOW+iW3bK07nFgKENod4XGxxtIf6SUK4HirrzwuzYaIcq+wecuFiUhCD/F85mZp2 LeiK7/WB4bHhmwJxosVGc9XDdilhh2s4kwgrn0ocgYgFLUZBjCfKZo8nsIRU8lzlPJ e4348OKgQQ87qEEJQHWRZplkMLZAFo8jaBhcNWZwb9NVpVkJbDlSCe2iEoiql+kGr6 29nUsH/YBZejGzHAUIDC+slBM8/q/nXV4DJaGaSqGvpyvUAmlgMNJruiJgCpjyS63V dmRZDoqNhGEbXW1Ah6eFnfGpRiEe6jWaKfnTWLfZFsrhotkrAF/VpnbTRfanvl8wE3 C0s7GQuux+93Q== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1E90E6911F for ; Mon, 5 Jan 2026 11:31:24 -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 mk9hV3xeeu19 for ; Mon, 5 Jan 2026 11:31:24 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767637884; bh=l0Ylylmqf9+z0QjVhQB0Qmd4/MCh4plgv2N86RKlxJw=; 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=OIOW+iW3bK07nFgKENod4XGxxtIf6SUK4HirrzwuzYaIcq+wecuFiUhCD/F85mZp2 LeiK7/WB4bHhmwJxosVGc9XDdilhh2s4kwgrn0ocgYgFLUZBjCfKZo8nsIRU8lzlPJ e4348OKgQQ87qEEJQHWRZplkMLZAFo8jaBhcNWZwb9NVpVkJbDlSCe2iEoiql+kGr6 29nUsH/YBZejGzHAUIDC+slBM8/q/nXV4DJaGaSqGvpyvUAmlgMNJruiJgCpjyS63V dmRZDoqNhGEbXW1Ah6eFnfGpRiEe6jWaKfnTWLfZFsrhotkrAF/VpnbTRfanvl8wE3 C0s7GQuux+93Q== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0B7EE6911B for ; Mon, 5 Jan 2026 11:31:24 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767637881; bh=imtIJocjfdy8+VkfBc48kVn0ONnl+L4vuiUmp84svjc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AIpet9qsT93CX9XEIn1rnB5d7mQDKXBrIl35xMr/LqCTI3x7OXL06+/wKYjaQpxg1 XLLw7oX0R7oBDS8bkfEIQH2brgSmZgvokHDLOJFomBQnlAmosqcZXbo9G2d6i7aTIG Qms1jhzI8m8SxtfPqja/curqjbuVDF8ByMWuzfQImVyCvOxGTKt+2NbS1JOsf2FVMs RcQ8aKuvYH1BzMcMLZ3EopiE7C4UvEVjgVaurOvYfBCaMoVjwHRx5UAmd0bi2n3YDL eZOyDL6FPOl9QlDPBHEDxhlMUB+riv20DdJ5S4YghFcNaJAQ+2P3KC3gqYpsjrvEg7 M/Nqwgb8Fjr9Q== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BC3BC69116; Mon, 5 Jan 2026 11:31:21 -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 zxSw_GCOr3Ii; Mon, 5 Jan 2026 11:31:21 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767637875; bh=5XUf+WdwrxSgI+Cf2xttZsA7n6Bol0p0tm30aOK4i7k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l/3T0q3nG9FuqGvipq85JOVys2LmdCEuFRqhHYWRyIusjT0OtWjYmmU1DlzaMsW1Y 9u5QxhbHHEhcw605A1y8IB5XAt/X108N1IOobi6bHRLEOg1FygwvM9krDRHDN4Nmf7 g/t8BZHdo3mmKi029Upg+AwPPGGZKXdt9tkW1aGkf2B94lW/ZU9hDa/aQHcq/jSqWH NX5YurUd2WkECndsp2HgRP+pnXr7uNAAokD8ak4Zpm94UxYdyPvDRWvUyFqprbdZgZ YnztbrrXcsAC+d77jjLosZVVfxTzPkBmEyFsX8NcLOmdti2RhxV9OXiUg79EphA0N+ KgZRCfZ7bl/6Q== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 7863869045; Mon, 5 Jan 2026 11:31:15 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Mon, 5 Jan 2026 11:30:22 -0700 Message-ID: <20260105183030.1487468-8-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260105183030.1487468-1-sjg@u-boot.org> References: <20260105183030.1487468-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: OMOHN2HK4TBACQJPYSLHMQYRZEXFGEGW X-Message-ID-Hash: OMOHN2HK4TBACQJPYSLHMQYRZEXFGEGW 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 , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 07/11] buildman: Extract _do_build() from run_commit() 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 Move the build logic from the 'if will_build:' block in run_commit() into a separate _do_build() method. This improves readability and reduces the complexity of run_commit() The new method handles: - Obtaining a toolchain if needed - Checking for Kconfig changes that require reconfiguration - Calling _config_and_build() to perform the actual build Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- tools/buildman/builderthread.py | 81 +++++++++++++++++++++------------ 1 file changed, 53 insertions(+), 28 deletions(-) diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py index e0164b30a4e..8420698023a 100644 --- a/tools/buildman/builderthread.py +++ b/tools/buildman/builderthread.py @@ -592,6 +592,56 @@ class BuilderThread(threading.Thread): return result, do_config + def _do_build(self, req, commit_upto, do_config, mrproper, config_only, + out_dir, out_rel_dir, result): + """Perform a build if a toolchain can be obtained + + Args: + req (RunRequest): Run request (see RunRequest for details) + commit_upto (int): Commit number to build (0...n-1) + do_config (bool): True to run a make _defconfig on the source + mrproper (bool): True to run mrproper first + config_only (bool): Only configure the source, do not build it + out_dir (str): Output directory for the build + out_rel_dir (str): Output directory relative to the current dir + result (CommandResult): Previous result + + Returns: + tuple: + result (CommandResult): Result of the build + do_config (bool): Whether config is needed next time + kconfig_reconfig (bool): Whether Kconfig triggered a reconfig + """ + kconfig_reconfig = False + + # We are going to have to build it. First, get a toolchain + if not self.toolchain: + try: + self.toolchain = self.builder.toolchains.select(req.brd.arch) + except ValueError as err: + result.return_code = 10 + result.stdout = '' + result.stderr = f'Tool chain error for {req.brd.arch}: {err}' + + if self.toolchain: + commit = self._checkout(commit_upto, req.work_dir) + + # Check if Kconfig files have changed since last config + if self.builder.kconfig_check: + config_file = os.path.join(out_dir, '.config') + if kconfig_changed_since(config_file, req.work_dir, + req.brd.target): + kconfig_reconfig = True + do_config = True + + result, do_config = self._config_and_build( + req, commit_upto, do_config, mrproper, config_only, + commit, out_dir, out_rel_dir, result) + + result.already_done = False + result.kconfig_reconfig = kconfig_reconfig + return result, do_config, kconfig_reconfig + def run_commit(self, req, commit_upto, do_config, mrproper, config_only, force_build, force_build_failures): """Build a particular commit. @@ -623,35 +673,10 @@ class BuilderThread(threading.Thread): force_build, force_build_failures) - kconfig_reconfig = False if will_build: - # We are going to have to build it. First, get a toolchain - if not self.toolchain: - try: - self.toolchain = self.builder.toolchains.select( - req.brd.arch) - except ValueError as err: - result.return_code = 10 - result.stdout = '' - result.stderr = (f'Tool chain error for {req.brd.arch}: ' - f'{str(err)}') - - if self.toolchain: - commit = self._checkout(commit_upto, req.work_dir) - - # Check if Kconfig files have changed since last config - if self.builder.kconfig_check: - config_file = os.path.join(out_dir, '.config') - if kconfig_changed_since(config_file, req.work_dir, - req.brd.target): - kconfig_reconfig = True - do_config = True - - result, do_config = self._config_and_build( - req, commit_upto, do_config, mrproper, config_only, - commit, out_dir, out_rel_dir, result) - result.already_done = False - result.kconfig_reconfig = kconfig_reconfig + result, do_config, _ = self._do_build( + req, commit_upto, do_config, mrproper, config_only, + out_dir, out_rel_dir, result) result.toolchain = self.toolchain result.brd = req.brd