From patchwork Sat Jan 10 20:08:04 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1429 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=1768075732; bh=xi9/ltSC6loIHG5CIjTnsh0kle7Pf3c8F9OdfSaOhiY=; 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=cnNjaSIawHv3GL8PfzNSwQKQUd6Rnm8ZyV0KgIvlbkXyCCL97mU5xm5JF0bwIfyHP BzfwfkRdzmNFmFGGjRaF6yb4rX64MY14qI9nU/tY+nmbQU/oxoiuYtBbLKM09t8Ngs Dyogt8eDvnkrRCS543awlc94x+8Onh/bKjSow27c3kIHmAtMD2ZC5Y6CWjfV2RBiy+ PsOrK0AK+IxZ5F/175yNh7FnJgxEwXOOkO2tQvijwD52yRs2KQOUwQawOz7gDHGGOL H0WZ0yMbMq6xOG+FAZLpl0ZySRTbPDjFF5VeCTSUUaEGOZrndI76tkqyywQFLf4dWb drFGrEv+U1kbQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id F0F9769221 for ; Sat, 10 Jan 2026 13:08:52 -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 P2wwa2v4uTWs for ; Sat, 10 Jan 2026 13:08:52 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768075732; bh=xi9/ltSC6loIHG5CIjTnsh0kle7Pf3c8F9OdfSaOhiY=; 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=cnNjaSIawHv3GL8PfzNSwQKQUd6Rnm8ZyV0KgIvlbkXyCCL97mU5xm5JF0bwIfyHP BzfwfkRdzmNFmFGGjRaF6yb4rX64MY14qI9nU/tY+nmbQU/oxoiuYtBbLKM09t8Ngs Dyogt8eDvnkrRCS543awlc94x+8Onh/bKjSow27c3kIHmAtMD2ZC5Y6CWjfV2RBiy+ PsOrK0AK+IxZ5F/175yNh7FnJgxEwXOOkO2tQvijwD52yRs2KQOUwQawOz7gDHGGOL H0WZ0yMbMq6xOG+FAZLpl0ZySRTbPDjFF5VeCTSUUaEGOZrndI76tkqyywQFLf4dWb drFGrEv+U1kbQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E088A69275 for ; Sat, 10 Jan 2026 13:08:52 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768075730; bh=E0iVs8arttDQattDxdofnUA51twyg9hgvhHjJXKhHJY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EehBSns0N6rifesZJB1opk7418R7l5pioiqWcyd2MAIz3ROknPsX7qBifWSnJoK8n nN2i5W2pPWg21/sznt/Gu7zcdbkOqzVSp/Kai2ziieiYa6TzC0ygO2pdgBHKVUS+5s sPfE7xd6jy81pIjoCsjAXy2SQWBpNtGMWNJm8qHBD0vZhXkMYCDHDMUpz/wgiDWwqQ 4h+eThWHDjO6lyEO1a96am+wYXfePso2u/dhLjmaADU4ezXeXuuWfX4RyXwjKMDaMm IUc3RPqd1Itxs+t1lc7T2i6XsAcfMA4lJLx9cNLa9G954qaCwF8WnxrfQ5eKsimrMF zeJeLina2I1hg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CBA7A69221; Sat, 10 Jan 2026 13:08:50 -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 bhLYdF5Cd6Sb; Sat, 10 Jan 2026 13:08:50 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768075726; bh=wRUIQhoJ8UH4d62RwhFRhH6IhGihF4jT2hBz0jyJRlc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pN/acKGQUxcSHluNR9B3hYfEQOvhyx4/ZIaF6ndV1D+oueuXONAJDE4w5fNeqx1Tk U7t54LsQTzfbynCnxQMSPh9h7pD8v4JFWi006+xMgqq6PKysBTbI+aiDP2vpqMXmxV DVNZ58XTPxG4iMwfN7uVp59PlEdbUbNKeBBD1REVeOcJBZ3N7f1Z9xYOdOZInXvx0h aP68CUQ3rWyn4b4tG2dWzqSkalE9NKl7aJ1G18Xxs9vEBodxZ5/3tWmNVLsYpRxptl dHZHHMLI9Io+ix5r8gsZ3OM5nQ3apjUDXiffRAJzegTdhVR0Y8bPTs8ZQUNqowRNZY UgQDtu/HpblYg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 5C9C4690E7; Sat, 10 Jan 2026 13:08:46 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sat, 10 Jan 2026 13:08:04 -0700 Message-ID: <20260110200828.168672-2-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: ZYVVRVQ3RKHUH2CZIMQGZEUHBHRMDF3S X-Message-ID-Hash: ZYVVRVQ3RKHUH2CZIMQGZEUHBHRMDF3S 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 01/18] buildman: Move Config class to cfgutil 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 Config class from builder.py to cfgutil.py as part of an effort to split up the large builder.py file. This class holds parsed configuration data for boards. It fits naturally in cfgutil.py alongside the other Kconfig utilities. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- tools/buildman/builder.py | 27 +-------------------------- tools/buildman/cfgutil.py | 30 +++++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 27 deletions(-) diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py index 3c0af07d624..5531e496271 100644 --- a/tools/buildman/builder.py +++ b/tools/buildman/builder.py @@ -20,6 +20,7 @@ import sys import threading from buildman import builderthread +from buildman.cfgutil import Config from u_boot_pylib import command from u_boot_pylib import gitutil from u_boot_pylib import terminal @@ -149,32 +150,6 @@ EXTRA_CONFIG_FILENAMES = [ 'autoconf.h', 'autoconf-spl.h','autoconf-tpl.h', ] -class Config: - """Holds information about configuration settings for a board.""" - def __init__(self, config_filename, target): - self.target = target - self.config = {} - for fname in config_filename: - self.config[fname] = {} - - def add(self, fname, key, value): - """Add a configuration value - - Args: - fname (str): Filename to add to (e.g. '.config') - key (str): Config key (e.g. 'CONFIG_DM') - value (str): Config value (e.g. 'y') - """ - self.config[fname][key] = value - - def __hash__(self): - val = 0 - for _, config in self.config.items(): - for key, value in config.items(): - print(key, value) - val = val ^ hash(key) & hash(value) - return val - class Environment: """Holds information about environment variables for a board.""" def __init__(self, target): diff --git a/tools/buildman/cfgutil.py b/tools/buildman/cfgutil.py index 5bc97d33595..ad6dee17829 100644 --- a/tools/buildman/cfgutil.py +++ b/tools/buildman/cfgutil.py @@ -3,12 +3,40 @@ # Written by Simon Glass # -"""Utility functions for dealing with Kconfig .confing files""" +"""Utility functions for dealing with Kconfig .config files""" import re from u_boot_pylib import tools + +class Config: + """Holds information about configuration settings for a board.""" + def __init__(self, config_filename, target): + self.target = target + self.config = {} + for fname in config_filename: + self.config[fname] = {} + + def add(self, fname, key, value): + """Add a configuration value + + Args: + fname (str): Filename to add to (e.g. '.config') + key (str): Config key (e.g. 'CONFIG_DM') + value (str): Config value (e.g. 'y') + """ + self.config[fname][key] = value + + def __hash__(self): + val = 0 + for _, config in self.config.items(): + for key, value in config.items(): + print(key, value) + val = val ^ hash(key) & hash(value) + return val + + RE_LINE = re.compile(r'(# )?CONFIG_([A-Z0-9_]+)(=(.*)| is not set)') RE_CFG = re.compile(r'(~?)(CONFIG_)?([A-Z0-9_]+)(=.*)?')