From patchwork Sat Jan 10 20:08:16 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1441 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=1768075794; bh=I7xnZiD4AmCQZwEMsesI1lW3Yd0wiUHLw+YeAJ04iE8=; 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=SQ1+BOFgPUEolEek5MrXKKYNeC/RaQPGTlsK1qHcLCHw3Ekh52QVohU8RYVqTGpXU Trgw1/LtcMBQY9EYmlmPzfO8gX/W5OH/H0Et1ozihaUzPBDhMiqvyzdpH/qwaUciUw HunYYs5fxqAPeyxECxMFoOVFCQd54CZceyiWorQwYYh2jiRkqkqJYyKrKGKJTe4erx SA19uyR2eP3gkwXkbdOdrWJzqX1SpUqVp+R3qcGgq28Apne8P/Tw3SO/DCzG/2MgNo pvXNDX3aELF5NmpfYUO2Jy+CfcrG2h7+6J8brvOvuCC9BMIcx3qk9GX9phzKcxF3VF zg0klPeLJBT+A== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1549369281 for ; Sat, 10 Jan 2026 13:09:54 -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 IcYoMUFX1xeD for ; Sat, 10 Jan 2026 13:09:54 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768075793; bh=I7xnZiD4AmCQZwEMsesI1lW3Yd0wiUHLw+YeAJ04iE8=; 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=f/1693x7oYkU79IwufHAJCdzU73aJh1rhtJ0yGmIlzn8UDMjprIVAxKCKSoT+n9n3 GJkfn2GoFwiP53pIRN0NdCqeXPj/pQ2AzDOPgLyhaUNjj1sgsb/BD9ck2hQPrzZGFP YiOUB1enNQJl39mt3/YwIiopFuBtiOFStKBRtjyYn9NLBjLEbD0fEX0O5w6qC6Yih7 l8aLhtACxmCAVRi5uf7Z3p61SSbVyM2pNAe6M3C9mavSir7+oPgCG9SFyJVY1RyL8y gu95MF60jkHTIMT+rQF0RLu4okA51YR8+8SZlSUKcju1BMj29mKAAu8tNqiH7WzlF1 KQWjCgChstADA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id ECD8B69275 for ; Sat, 10 Jan 2026 13:09:53 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768075791; bh=eGwgGOXUNUjxBy5hTr3sBvE2jd2+n7I9i7HtDmUcpII=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bod58y7zLImjW02bIDQTDLgG1io2gEbLD/KYYPid4JIVJxtIV2JBwdFOaVVpDbY9f 4z0C8+fN12GHHHjEj1YyI0F0sLgZEeH2mN1aG4By+LXmhipubABpOPcWMaC5/U6ni+ hS5R+M8ENfcTsaNUgY3z8kSq0m/Y2+exhiRy1EEVwGNUFaTMkD6YeyQSSSp5VVyZZj GNPvItjPXY37mtFLA9FlPijWNsa5SSm/9s682h7y6w+2xjFZVqbny2Rdx/tAJYN9ol teTTjtZAYz7+C26s5x0h96/A4nrdOCOZrDN5vtaEwONZHQ5+4KL+NxOs3XYunF7tkM ASBGYAhGIoUPQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id F03F469275; Sat, 10 Jan 2026 13:09:51 -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 OXsObR323p1G; Sat, 10 Jan 2026 13:09:51 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768075786; bh=tcj2PPRF4vh9zEnAOqJKcdTJ67FD1mHhMuz0zP/K7tQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eGTapiaAyG5aG+N1IB0TQvq4SgxKbav9yMSJalJZQQH+SJyVa6y7YcTOoFkFAmYSE 6qaC26L45WtWA4s1udWIgMf4nSWwGeR23eI5Bv9xuQeyZKy5+rGtbk7eV/zcmH+Ez9 3JfJibwk8xCmxOurVyb27BvmGtlDFmxSgu5yfGEfQrRes1Z9tAkHPDAE1vhjr9ao6C aByw2tO5YjkeAwskLJtViJHFkMZ8Rj8ESaOaYScw7C2VJBlIqxJWaGTlicFhp8rpTd P/QtgLhenL6bRw91EHmI89bWH9Lciw5hgzQ5He7+nJEOwmdRHVl/wC/rAeGj4igKnu DYjuXg6RbZ0tw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id CC690690E7; Sat, 10 Jan 2026 13:09:45 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sat, 10 Jan 2026 13:08:16 -0700 Message-ID: <20260110200828.168672-14-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260110200828.168672-1-sjg@u-boot.org> References: <20260110200828.168672-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: OG4S7NDEULDZIEVL2ZKQOXXGNC6RB22M X-Message-ID-Hash: OG4S7NDEULDZIEVL2ZKQOXXGNC6RB22M 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 13/18] buildman: Move error delta calculation to ResultHandler 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 _calc_error_delta() function and its helper _board_list() from the nested functions in print_result_summary() to ResultHandler. Also move the ErrLine namedtuple from builder.py to resulthandler.py since it is used by calc_error_delta(). This continues the extraction of display-related code from builder.py into the ResultHandler class. The list_error_boards parameter is now passed explicitly instead of being accessed via self._list_error_boards. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- tools/buildman/builder.py | 63 +++--------------------------- tools/buildman/resulthandler.py | 68 ++++++++++++++++++++++++++++++++- 2 files changed, 72 insertions(+), 59 deletions(-) diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py index 53f1c6bde98..a2d4470b70c 100644 --- a/tools/buildman/builder.py +++ b/tools/buildman/builder.py @@ -1071,67 +1071,16 @@ class Builder: show_config (bool): Show config changes show_environment (bool): Show environment changes """ - def _board_list(line, line_boards): - """Helper function to get a line of boards containing a line - - Args: - line: Error line to search for - line_boards: boards to search, each a Board - Return: - List of boards with that error line, or [] if the user has not - requested such a list - """ - brds = [] - board_set = set() - if self._opts.list_error_boards: - for brd in line_boards[line]: - if not brd in board_set: - brds.append(brd) - board_set.add(brd) - return brds - - def _calc_error_delta(base_lines, base_line_boards, lines, line_boards, - char): - """Calculate the required output based on changes in errors - - Args: - base_lines: List of errors/warnings for previous commit - base_line_boards: Dict keyed by error line, containing a list - of the Board objects with that error in the previous commit - lines: List of errors/warning for this commit, each a str - line_boards: Dict keyed by error line, containing a list - of the Board objects with that error in this commit - char: Character representing error ('') or warning ('w'). The - broken ('+') or fixed ('-') characters are added in this - function - - Returns: - Tuple - List of ErrLine objects for 'better' lines - List of ErrLine objects for 'worse' lines - """ - better_lines = [] - worse_lines = [] - for line in lines: - if line not in base_lines: - errline = ErrLine( - char + '+', _board_list(line, line_boards), line) - worse_lines.append(errline) - for line in base_lines: - if line not in lines: - errline = ErrLine(char + '-', - _board_list(line, base_line_boards), line) - better_lines.append(errline) - return better_lines, worse_lines - brd_status = ResultHandler.classify_boards( board_selected, board_dict, self._base_board_dict) # Get a list of errors and warnings that have appeared, and disappeared - better_err, worse_err = _calc_error_delta(self._base_err_lines, - self._base_err_line_boards, err_lines, err_line_boards, '') - better_warn, worse_warn = _calc_error_delta(self._base_warn_lines, - self._base_warn_line_boards, warn_lines, warn_line_boards, 'w') + better_err, worse_err = ResultHandler.calc_error_delta( + self._base_err_lines, self._base_err_line_boards, err_lines, + err_line_boards, '', self._opts.list_error_boards) + better_warn, worse_warn = ResultHandler.calc_error_delta( + self._base_warn_lines, self._base_warn_line_boards, warn_lines, + warn_line_boards, 'w', self._opts.list_error_boards) # For the IDE mode, print out all the output if self._opts.ide: diff --git a/tools/buildman/resulthandler.py b/tools/buildman/resulthandler.py index 197f4d87003..a2064986729 100644 --- a/tools/buildman/resulthandler.py +++ b/tools/buildman/resulthandler.py @@ -8,8 +8,8 @@ import sys -from buildman.outcome import (BoardStatus, OUTCOME_OK, OUTCOME_WARNING, - OUTCOME_ERROR, OUTCOME_UNKNOWN) +from buildman.outcome import (BoardStatus, ErrLine, OUTCOME_OK, + OUTCOME_WARNING, OUTCOME_ERROR, OUTCOME_UNKNOWN) from u_boot_pylib.terminal import tprint @@ -745,3 +745,67 @@ class ResultHandler: if not_built: tprint(f"Boards not built ({len(not_built)}): " f"{', '.join(not_built)}") + + @staticmethod + def _board_list(line, line_boards, list_error_boards): + """Get a list of boards containing a particular error/warning line + + Args: + line (str): Error line to search for + line_boards (dict): Dict keyed by line, containing list of Board + objects with that line + list_error_boards (bool): True to return the board list, False to + return empty list + + Returns: + list: List of Board objects with that error line, or [] if + list_error_boards is False + """ + brds = [] + board_set = set() + if list_error_boards: + for brd in line_boards[line]: + if brd not in board_set: + brds.append(brd) + board_set.add(brd) + return brds + + @classmethod + def calc_error_delta(cls, base_lines, base_line_boards, lines, line_boards, + char, list_error_boards): + """Calculate the required output based on changes in errors + + Args: + base_lines (list): List of errors/warnings for previous commit + base_line_boards (dict): Dict keyed by error line, containing a + list of the Board objects with that error in the previous + commit + lines (list): List of errors/warning for this commit, each a str + line_boards (dict): Dict keyed by error line, containing a list + of the Board objects with that error in this commit + char (str): Character representing error ('') or warning ('w'). The + broken ('+') or fixed ('-') characters are added in this + function + list_error_boards (bool): True to include board list in output + + Returns: + tuple: (better_lines, worse_lines) where each is a list of + ErrLine objects + """ + better_lines = [] + worse_lines = [] + for line in lines: + if line not in base_lines: + errline = ErrLine( + char + '+', + cls._board_list(line, line_boards, list_error_boards), + line) + worse_lines.append(errline) + for line in base_lines: + if line not in lines: + errline = ErrLine( + char + '-', + cls._board_list(line, base_line_boards, list_error_boards), + line) + better_lines.append(errline) + return better_lines, worse_lines