From patchwork Sat Jan 3 20:32:37 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1258 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=1767472428; bh=yrI7cacio1UjebiqKhAQR3wf5bS0Y2asIqHk4qaHfEo=; 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=a60MAag4MYygC2GsmGkRmth6Ok0F4H7S3DopReIHvz1WgQLYEuT4mEDJbN5uyDXQp BGGume5BCNuZwtaGhXrttVaApERiLf4L308/+0yGzjDNYm8sGyu0DzWTICbP5n2Hgt deM94InHqa/c5iTHcF+dC+kqlYAnWLuqmCMCJkjBtaixhbygKKlurJ2ShhFu505Kwf XsVGT8UXCW/dUEE4bensUE/2BTjWYYiSugbMgkH4eG53pzXWXc38juwxOqWufDKFvI jUPHj/QlItoOpSLOTuYqyYTxAPVJfA+FIvIlsiL2ne3DMLkeFqQecnt+hf0vucX4uH 4tzNKx2tuHDFw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9A82E690C1 for ; Sat, 3 Jan 2026 13:33:48 -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 iwr7uyv3J2Vp for ; Sat, 3 Jan 2026 13:33:48 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767472428; bh=yrI7cacio1UjebiqKhAQR3wf5bS0Y2asIqHk4qaHfEo=; 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=a60MAag4MYygC2GsmGkRmth6Ok0F4H7S3DopReIHvz1WgQLYEuT4mEDJbN5uyDXQp BGGume5BCNuZwtaGhXrttVaApERiLf4L308/+0yGzjDNYm8sGyu0DzWTICbP5n2Hgt deM94InHqa/c5iTHcF+dC+kqlYAnWLuqmCMCJkjBtaixhbygKKlurJ2ShhFu505Kwf XsVGT8UXCW/dUEE4bensUE/2BTjWYYiSugbMgkH4eG53pzXWXc38juwxOqWufDKFvI jUPHj/QlItoOpSLOTuYqyYTxAPVJfA+FIvIlsiL2ne3DMLkeFqQecnt+hf0vucX4uH 4tzNKx2tuHDFw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 86D72690B2 for ; Sat, 3 Jan 2026 13:33:48 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767472427; bh=WfeuK6UJhN0Y1Igu/5Sx9dTGuXHKhTGAybcHszhL0Qo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a2ivZGTDL2LKJ1sUommgHYrJ+YiqsJydfnQwP6lHe5OHCeB+yRzV+ACNm65ErMLEM nboHr1r/0NKxX+VOy4rSBGDBMytDNSNSEoKsBFPWZkMlVELGspCnTab819dcOmBa8E moX6mwuH9EOpV3QUjoF0PNMLaiP0DEsmvBwnhdANKySG90LB1DoIgNJxaxIYXKCftz od+B/7XsO3MXe+L9ne+GA1YGuu3WHz2DFkHls3eMdGm1vUhHmTUk8M0i8gRxoZ5kEr +rk3DcEM2CLWYNjqNa1nJ5SlXr4jMmnKVclk35AnxGeMYXqScAIefbuGkki8Pm/GBg a1vH0k9asfxqg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 12C9568F35; Sat, 3 Jan 2026 13:33:47 -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 jYGUb97UsKui; Sat, 3 Jan 2026 13:33:47 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767472422; bh=ngWVMViFptHAof3yqJb0YkczvR1Y155Rghn7NNRCJQI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tg1Cu1W2CFqd9hWS1S3By5xhXD+ftrqbpEHjHVfj+K78rL4Ar1pVjIMcy+OubrjlT DRrX3ZYX14EwpijUwO5O1SdRMqK8+ypBGgPk5LlaGQ8OmFUTMdzhskAwjHNuNxHh3d ibs3M0fW2ktKfhuvfxmApx/HM/ptdRKuwxSiTjCHh041a5Qpqula/V0tNLaJXchsOs gtgoX6Oo61j4GACjVmEn37CRoAtlcfuN+3GAvDKuAlS/Yx1xOjiSza3WQrVtSNRf8F i1h9M9yApVLgvVFTpdfTZqgcE0/G/y3VOwLHXlQKRQoIklRA3eZAWimS1VuRnT50gv L4NZsQqG7CuAw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 9AF7968FC8; Sat, 3 Jan 2026 13:33:42 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sat, 3 Jan 2026 13:32:37 -0700 Message-ID: <20260103203243.3727493-12-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260103203243.3727493-1-sjg@u-boot.org> References: <20260103203243.3727493-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: ORR4DVGGB3A2WLEP7XLJOSLELXKUU6L3 X-Message-ID-Hash: ORR4DVGGB3A2WLEP7XLJOSLELXKUU6L3 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 11/12] buildman: Extract _check_board() from select_boards() 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 board checking logic into a separate static method to reduce complexity of select_boards() Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- tools/buildman/boards.py | 91 +++++++++++++++++++++------------------- 1 file changed, 48 insertions(+), 43 deletions(-) diff --git a/tools/buildman/boards.py b/tools/buildman/boards.py index 0aea4bc826c..550c0feffa1 100644 --- a/tools/buildman/boards.py +++ b/tools/buildman/boards.py @@ -687,6 +687,53 @@ class Boards: terms.append(term) return terms + @staticmethod + def _check_board(brd, terms, brds, found, exclude_list, result): + """Check whether to include or exclude a board + + Checks the various terms and decides whether to build it or not. + + If it is built, add the board to the result[term] list so we know + which term caused it to be built. Add it to result['all'] also. + + Keep a list of boards we found in 'found', so we can report boards + which appear in self._boards but not in brds. + + Args: + brd (Board): Board to check + terms (list of Term): Terms to match against + brds (list of str): List of board names to build, or None + found (list of str): List to append found board names to + exclude_list (list of Expr): Expressions for boards to exclude + result (OrderedDict): Dict to store results in + """ + matching_term = None + build_it = False + if terms: + for term in terms: + if term.matches(brd.props): + matching_term = str(term) + build_it = True + break + elif brds: + if brd.target in brds: + build_it = True + found.append(brd.target) + else: + build_it = True + + # Check that it is not specifically excluded + for expr in exclude_list: + if expr.matches(brd.props): + build_it = False + break + + if build_it: + brd.build_it = True + if matching_term: + result[matching_term].append(brd.target) + result['all'].append(brd.target) + def select_boards(self, args, exclude=None, brds=None): """Mark boards selected based on args @@ -710,48 +757,6 @@ class Boards: argument list of str: Errors/warnings found """ - def _check_board(brd): - """Check whether to include or exclude a board - - Checks the various terms and decide whether to build it or not (the - 'build_it' variable). - - If it is built, add the board to the result[term] list so we know - which term caused it to be built. Add it to result['all'] also. - - Keep a list of boards we found in 'found', so we can report boards - which appear in self._boards but not in brds. - - Args: - brd (Board): Board to check - """ - matching_term = None - build_it = False - if terms: - for term in terms: - if term.matches(brd.props): - matching_term = str(term) - build_it = True - break - elif brds: - if brd.target in brds: - build_it = True - found.append(brd.target) - else: - build_it = True - - # Check that it is not specifically excluded - for expr in exclude_list: - if expr.matches(brd.props): - build_it = False - break - - if build_it: - brd.build_it = True - if matching_term: - result[matching_term].append(brd.target) - result['all'].append(brd.target) - result = OrderedDict() warnings = [] terms = self._build_terms(args) @@ -767,7 +772,7 @@ class Boards: found = [] for brd in self._boards: - _check_board(brd) + self._check_board(brd, terms, brds, found, exclude_list, result) if brds: remaining = set(brds) - set(found)