From patchwork Mon Mar 16 15:47:15 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2002 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=1773676134; bh=PLUuM1UY+Elc4/fnO7PcvxU1Xbxe9OMVYTT6yS57bdw=; 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=TbJeSIIVnN+3OpyRsJGz1tQOwjfXNJ3UVvEG1NSAg9m8wiyj60Qhk0B9AwVk1Gg8s mqJq6481bjMXRBF6jsAgB2aJpjYjw2K4YQ5gPXsu0K0uHOfovAsdokeITd39F1aeo7 QIAjhOaae7Wb1y/+VmwQEmthzUbwviXqgfSOIMfL2q1FaDXpxWUm5ZcR3SF5E86wwd QJANglQRCjdyjfR+9YYDtwFiw11RY1JCjVeEctwHgsoG98Rg0apBgzuHz+0LxnB4g2 78if+SPGHtAug5V/RkFCg4kg9aSQEAeTEhm3X021mucDpoI/NCgDaqSyqXUvi/VPcS nLGnH6NTTz3xA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DBFC46A09C for ; Mon, 16 Mar 2026 09:48:54 -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 FuKIKhcargRq for ; Mon, 16 Mar 2026 09:48:54 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1773676133; bh=PLUuM1UY+Elc4/fnO7PcvxU1Xbxe9OMVYTT6yS57bdw=; 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=lL0cPtzheeui1nZe5qiKPgi2CUT+b1kiEf6R/Ufr4gilHiPQjujWLdSt0OgAezH75 HbG2cN7qIeyVhPoZuBalAtjS1WUF8vJ0jXJ//iJCTVTFwz+Ndqpz9O++tjYxmqsZXe gvLIR1KeL4n73IciybR1DHAHo5AMuCAu4zv0bs2jrS/87k5M9uXYMBH6/TGBmxQDNX OtDo/9DJTqd6IS2M1LzF6Uy52Tv95mQQBJn6DzKbqtSyQhxTBF7qykpxnN1YG6QbpG VozlLd4yeSx47ZqTAu1qI3k2zUyugBnWR0++cZSzOA8EWvtEj6GrJ9GfHvS2gm39SD CHbmRr8bE3Gog== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4117D6A07F for ; Mon, 16 Mar 2026 09:48:53 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1773676132; bh=nggwnXlvGJeir+B4s1y40mykKTAHS0Via+3MGLozL+g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aFC7TQ3lfP3iG5T9UT9HUb0Kf2fpZ9gbZUIrbDO8Zofo7Ut/5HRHY/3o1Z4hHaYGg lqdRGZnJrY2EF2K+QBWCdJtUO6c4JRbOeXERs8Q2dDPTrxQlVleBCeKCqCCo4ejN3H Ys4jmnztUFywd5jLgwB+cB0cpWSl/h+WQuk7etMoVuEWkcKrNV1FpYkqyuY9E5xBGb o9TEBgA7aEYiwRcKxSdZWHok2q+IB2Mfb+0b0WWED0lbWIqkEpC9Y7K2kGoMg8OXBU 83gxKxBgZpNnnxiXESAsosj46a15Jh77iVw0nPsbx5kHfzLS1AJflbT2gSqIWpBc7A yoQviLjzyzVwA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 15DAB6A061; Mon, 16 Mar 2026 09:48:52 -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 pdX4fp9syYTq; Mon, 16 Mar 2026 09:48:52 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1773676125; bh=a1wlyTdhwurNv8CS5DClhMT7gnc6TDo3B8NW2Joxizs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dflsR3HRCxjQs9t0F6T4w/kpaoT7X7k4lWU+FdVk4jcSGYXshwuC/vgema/cyuacg dSdyooT+doZgBnIFIOpwQZQ+BC4WhGF1ea+V0prGAr0a6/M9stJAidP9fisk6xMfLh xqigGtB1feP3+uE3Rglcog6cGvH/WshB/IjQPqbE/aV6lEnKuw6GOYyqzteUJutNDA J9/dry+14e6CMB+lXFkM1GXfg8vYqWPv4Nxfft2zfOdlDgUktnJs03heN17vXASVHQ nTylnGYkYDDvg+/SSsQls8VMOWtk4sonb2kJQ+/Io15EcO7QQJ5WVGAW7tNTYq4b1w Yea/KRDGBkgfg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 14E7F6A07F; Mon, 16 Mar 2026 09:48:45 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 16 Mar 2026 09:47:15 -0600 Message-ID: <20260316154733.1587261-11-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260316154733.1587261-1-sjg@u-boot.org> References: <20260316154733.1587261-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 2VY4DNSY2HTTQNVGA4KHQG22N6KNVM44 X-Message-ID-Hash: 2VY4DNSY2HTTQNVGA4KHQG22N6KNVM44 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 10/20] buildman: Split build_boards() into two methods 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 distributed-build worker queues boards one at a time as they arrive from the boss, so it needs to separate job creation from the blocking wait-for-completion. Split build_boards() into two methods: - init_build(): sets up working space, output dirs and queues jobs - run_build(): blocks until all jobs finish and prints the summary Keep build_boards() as a thin wrapper that calls both, so existing callers are unchanged. Extract print_summary() so that callers which use init_build() / run_build() directly can print the summary later. Signed-off-by: Simon Glass --- tools/buildman/builder.py | 67 +++++++++++++++++++++++++++++++-------- 1 file changed, 54 insertions(+), 13 deletions(-) diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py index 8c83203cf8e..716bf43a66f 100644 --- a/tools/buildman/builder.py +++ b/tools/buildman/builder.py @@ -1199,9 +1199,13 @@ class Builder: shutil.rmtree(dirname) terminal.print_clear() - def build_boards(self, commits, board_selected, keep_outputs, verbose, - fragments): - """Build all commits for a list of boards + def init_build(self, commits, board_selected, keep_outputs, verbose, + fragments): + """Initialise a build: prepare working space and create jobs + + This sets up the working directory, output space and job queue + but does not start the build threads. Call run_build() after + this to start the build. Args: commits (list): List of commits to be build, each a Commit object @@ -1210,12 +1214,6 @@ class Builder: keep_outputs (bool): True to save build output files verbose (bool): Display build results as they are completed fragments (str): config fragments added to defconfig - - Returns: - tuple: Tuple containing: - - number of boards that failed to build - - number of boards that issued warnings - - list of thread exceptions raised """ self.commit_count = len(commits) if commits else 1 self.commits = commits @@ -1224,7 +1222,7 @@ class Builder: self._result_handler.reset_result_summary(board_selected) builderthread.mkdir(self.base_dir, parents = True) self._prepare_working_space(min(self._num_threads, len(board_selected)), - commits is not None) + board_selected and commits is not None) self._prepare_output_space() if not self._opts.ide: tprint('\rStarting build...', newline=False) @@ -1247,6 +1245,18 @@ class Builder: else: self._single_builder.run_job(job) + def run_build(self): + """Run the build to completion + + Waits for all jobs to finish and prints a summary. + Call init_build() first to set up the jobs. + + Returns: + tuple: Tuple containing: + - number of boards that failed to build + - number of boards that issued warnings + - list of thread exceptions raised + """ if self._num_threads: term = threading.Thread(target=self.queue.join) term.daemon = True @@ -1257,8 +1267,39 @@ class Builder: # Wait until we have processed all output self.out_queue.join() if not self._opts.ide: - self._result_handler.print_build_summary( - self.count, self._already_done, self.kconfig_reconfig, - self._start_time, self.thread_exceptions) + self.print_summary() return (self.fail, self._warned, self.thread_exceptions) + + def build_boards(self, commits, board_selected, keep_outputs, verbose, + fragments): + """Build all commits for a list of boards + + Convenience method that calls init_build() then run_build(). + + Args: + commits (list): List of commits to be build, each a Commit object + board_selected (dict): Dict of selected boards, key is target name, + value is Board object + keep_outputs (bool): True to save build output files + verbose (bool): Display build results as they are completed + fragments (str): config fragments added to defconfig + + Returns: + tuple: Tuple containing: + - number of boards that failed to build + - number of boards that issued warnings + - list of thread exceptions raised + """ + self.init_build(commits, board_selected, keep_outputs, verbose, + fragments) + return self.run_build() + + def print_summary(self): + """Print the build summary line + + Shows total built, time taken, and any thread exceptions. + """ + self._result_handler.print_build_summary( + self.count, self._already_done, self.kconfig_reconfig, + self._start_time, self.thread_exceptions)