From patchwork Tue Jan 6 22:03:46 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1331 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=1767737187; bh=f6a+WGTOryXYQ/I09K5e+d+ohs7ZUYEqM9ZWjP7S1Ms=; 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=i4jy7JMAHC5P5TWen4oDjETAcvl9iy4cFeJXnW5l+ei4wvLG49um/Q8KBwzNNQbni NA283irfOGpXpfb5XuicqQheSL8Bi2rUWtTXPuEJA/RXKLj2ba/THmAZ4ryBgKvGd9 hS/VbioofH82lvG81I09CbnjSz5zfoWGFK3z9l0S/PYn8Tk2AIwMmCy5s5yhz8wLp1 gNHWHlTF0jBRaQVCycUtuHHwFOF0HbyYr6RRjsaXBWcLEJlbwM9+NbUF/yLhvzI8yd UDmfmCG5tdcG/DQd6HXcRDUH0cnkBbSTOHbWZ9OxGgwVtEmR8q88+1MBUmBtV+XVR9 EwOaJvqR5aIXg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0CBEB6916D for ; Tue, 6 Jan 2026 15:06:27 -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 t3S08v1ZiVfa for ; Tue, 6 Jan 2026 15:06:26 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767737186; bh=f6a+WGTOryXYQ/I09K5e+d+ohs7ZUYEqM9ZWjP7S1Ms=; 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=mJoJs1+iVN0Fx6soFAvAvVofolkH+JkduB1OTs6aNoxL+wkvLhysVkTNkDdhtH4NS s9wWOKG3mpPBP9Yb8gNOS2AkhTQqv0/M/QqZQjEhr++lcgRyIh3+uxeXruwoPOnBbM /gxan+DgANiQ1BPJa71OmeGYefAbIC9bBLYKjW0XlSs1t5ryIeQta1fLzVFWhAP7r1 fhuxrxMdDkjEb3qB0tBD9OEQsDl2Vxo+jWprAiWCwNV8HSmwFHJNQQS+kc8OvHKpLA FXmctcKBbxpcShhwDkXKqPBPrhEBfaJXUImpYGFN8FhLW7/ruzV7HkSah4fo87xSvD +7fE/fcwOnXUg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id EFCA369146 for ; Tue, 6 Jan 2026 15:06:26 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767737185; bh=lacShWqLEEpA2HLJa7M27sRhpTOosD9mQ2HsCmDs7zU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MoK4ua1JQX62RhsoQruDHJ5kwg9W849STEGLkmk17oSBWBhHPb2aqxTsjWBk7WD0g PHmlBLMFdohXnCYvLCKA/Et7E30dkPap9ynAKmPdjHTPYLkJ+JTRyBrciRObO1ozGB D8vQ3BTdbI094VRz7WE0xI/dsvl3boTaW8PHu+6bVD8PNNe9/DzZWK49spzc/tvqiU 4Nu919R/Wzs4O5d6dDAQJ3xuPkKM4liapSbszrY7CmE8PnEyMSjMhwxxNfMHT25aUP GLo0na3zSLpU0hHLKXQYWvAQfpA2dWGZvrCPRJZTu6gLK1atTJMeOYuV9x1f+/2ZR0 tP637ZThOws2Q== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3E06A690CB; Tue, 6 Jan 2026 15:06:25 -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 tpwLaUS3kE5z; Tue, 6 Jan 2026 15:06:25 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767737181; bh=K3bHojwFenKHJjckWSRTotfrNBfm/EMwREOKZWEKh7Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LAbi0AhzraSjg4yBAP7CuBxxu0SdAwQORdtWhd6+FOI6Ea8hFwX6hnNyK5tDBJ/kV DFQnQxh57eOQcgOH3bjQ0pFsjqVCvPYD/PEJj9lmizqHfk9UKTou0nxRGwZZ9PjwsJ HB1WVylZ0lL8kbGpKTn5MH796FTfISzblGADlDzFlgjqtY/JC8cMbZMhF3fiCCe7Ti c7WxGw+e84LF+CNpMvUPVgi3UP3t4wIXA7s7vJTKIhYrHLW6+sShHyWS3YaTxUEhYd 7Rd4Sk7VCoUp4Zp3yZtlLb/cHyTZhEdU5dOYa+AX/I+CG5AwkRoFHNE2wnJTtynxlg 3cL7YK/VEwBlg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id C33805FF82; Tue, 6 Jan 2026 15:06:20 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 6 Jan 2026 15:03:46 -0700 Message-ID: <20260106220403.2915630-29-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260106220403.2915630-1-sjg@u-boot.org> References: <20260106220403.2915630-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: M23H5NYLVMDMIRDDRA2IK3SR3PQOZPLG X-Message-ID-Hash: M23H5NYLVMDMIRDDRA2IK3SR3PQOZPLG 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 X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 28/29] buildman: Move regex patterns to module-level constants 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 compiler output regex patterns from instance attributes to module-level constants for better efficiency and clarity. Co-developed-by: Claude Signed-off-by: Simon Glass --- tools/buildman/builder.py | 41 ++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py index 067034aa52b..0d6e7d1732c 100644 --- a/tools/buildman/builder.py +++ b/tools/buildman/builder.py @@ -37,6 +37,17 @@ from u_boot_pylib.terminal import tprint # which indicates that BREAK_ME has an empty default RE_NO_DEFAULT = re.compile(br'\((\w+)\) \[] \(NEW\)') +# Regex patterns for matching compiler output +RE_FUNCTION = re.compile('(.*): In function.*') +RE_FILES = re.compile('In file included from.*') +RE_WARNING = re.compile(r'(.*):(\d*):(\d*): warning: .*') +RE_DTB_WARNING = re.compile('(.*): Warning .*') +RE_NOTE = re.compile( + r'(.*):(\d*):(\d*): note: this is the location of the previous.*') +RE_MIGRATION_WARNING = re.compile(r'^={21} WARNING ={22}\n.*\n=+\n', + re.MULTILINE | re.DOTALL) +RE_MAKE_ERR = re.compile('(make.*Waiting for unfinished)|(Segmentation fault)') + # Symbol types which appear in the bloat feature (-B). Others are silently # dropped when reading in the 'nm' output NM_SYMBOL_TYPES = 'tTdDbBr' @@ -203,7 +214,6 @@ class Builder: num_jobs: Number of jobs to run at once (passed to make as -j) num_threads: Number of builder threads to run out_queue: Queue of results to process - re_make_err: Compiled regular expression for ignore_lines queue: Queue of jobs to run threads: List of active threads toolchains: Toolchains object to use for building @@ -400,15 +410,6 @@ class Builder: self.warnings_as_errors = warnings_as_errors self.col = terminal.Color() - self._re_function = re.compile('(.*): In function.*') - self._re_files = re.compile('In file included from.*') - self._re_warning = re.compile(r'(.*):(\d*):(\d*): warning: .*') - self._re_dtb_warning = re.compile('(.*): Warning .*') - self._re_note = re.compile( - r'(.*):(\d*):(\d*): note: this is the location of the previous.*') - self._re_migration_warning = re.compile( - r'^={21} WARNING ={22}\n.*\n=+\n', re.MULTILINE | re.DOTALL) - self.thread_exceptions = [] self.test_thread_exceptions = test_thread_exceptions @@ -464,10 +465,6 @@ class Builder: self._single_builder = builderthread.BuilderThread( self, -1, mrproper, per_board_out_dir) - ignore_lines = ['(make.*Waiting for unfinished)', - '(Segmentation fault)'] - self.re_make_err = re.compile('|'.join(ignore_lines)) - # Handle existing graceful with SIGINT / Ctrl-C signal.signal(signal.SIGINT, self.signal_handler) @@ -773,12 +770,12 @@ class Builder: out_lines = [] if self._filter_migration_warnings: text = '\n'.join(lines) - text = self._re_migration_warning.sub('', text) + text = RE_MIGRATION_WARNING.sub('', text) lines = text.splitlines() for line in lines: - if self.re_make_err.search(line): + if RE_MAKE_ERR.search(line): continue - if self._filter_dtb_warnings and self._re_dtb_warning.search(line): + if self._filter_dtb_warnings and RE_DTB_WARNING.search(line): continue out_lines.append(line) return out_lines @@ -1005,13 +1002,13 @@ class Builder: last_was_warning = False for line in err_lines: if line: - if (self._re_function.match(line) or - self._re_files.match(line)): + if (RE_FUNCTION.match(line) or + RE_FILES.match(line)): last_func = line else: - is_warning = (self._re_warning.match(line) or - self._re_dtb_warning.match(line)) - is_note = self._re_note.match(line) + is_warning = (RE_WARNING.match(line) or + RE_DTB_WARNING.match(line)) + is_note = RE_NOTE.match(line) if is_warning or (last_was_warning and is_note): if last_func: self._add_line(warn_lines_summary,