From patchwork Mon Nov 24 13:49:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 761 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=1763992208; bh=rAaNOBlHvST7IKizeMytsdHscqLGmOEjgctZMXkmznw=; 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=Rc/hdjNx976tPYXEGDUzjBsmjUOwXD1K+/GpNBxSssW3O+xSiFrnt++5l/iHTnVWn 8j8QvtSTQ2A55iqMMJKBbYFrHwHbw7bJbov6FC4oDerpNa1D9SKmrPjK3DRHEmJpEt DDn/6CL5HiFKwfLnnlBSefc94ZrFsyd2EA2vzgj4PAJm78VLKYkIV/3vOOzZkf21s7 2eqPJB0jc14UlummEKhiJI+bH2jvaflQ4AOH/Vi2hblnVitytKFIWBwak3Pst6Ldxk 9yBeIExLZlxV+Qhq/fxX5R+Ux9BC7Gc0EBWNJmXFjkLF7JQtoiuWzVs19S5mGtTV81 H0nwNArkUOT/w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4F54868765 for ; Mon, 24 Nov 2025 06:50:08 -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 iw5GpA5OfbM7 for ; Mon, 24 Nov 2025 06:50:08 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1763992208; bh=rAaNOBlHvST7IKizeMytsdHscqLGmOEjgctZMXkmznw=; 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=Rc/hdjNx976tPYXEGDUzjBsmjUOwXD1K+/GpNBxSssW3O+xSiFrnt++5l/iHTnVWn 8j8QvtSTQ2A55iqMMJKBbYFrHwHbw7bJbov6FC4oDerpNa1D9SKmrPjK3DRHEmJpEt DDn/6CL5HiFKwfLnnlBSefc94ZrFsyd2EA2vzgj4PAJm78VLKYkIV/3vOOzZkf21s7 2eqPJB0jc14UlummEKhiJI+bH2jvaflQ4AOH/Vi2hblnVitytKFIWBwak3Pst6Ldxk 9yBeIExLZlxV+Qhq/fxX5R+Ux9BC7Gc0EBWNJmXFjkLF7JQtoiuWzVs19S5mGtTV81 H0nwNArkUOT/w== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3C91468669 for ; Mon, 24 Nov 2025 06:50:08 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1763992207; bh=FQnka1A5HXssjmAQoi+FT1XkUAaxex4kBSFFBfuGFz8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GyVPZDdoLYioCAjse2wcx1AFEIAhgNj8ggwis/JaJI0qR2yRLKYvtCfaj9hpd55Vl uF1F19vnPKnEl9rdo2wKqhC8zB0zS7ZNgSvyAbsBUR0kTX0YxjACBcDoVORH41Ky+S pJsu+VhCkRB1TRINyKh9O2DzSKrUOHkm7qCd8pKfY0steV0SBzqPpDNbGJoVEQ3nwK 3HibXwnU6taLCEf0kZAnsafBeLhwd77FqBXUmMAvb672oi4TnZvhF43IyBBaXLQ5/I wD3LH5C0/P47/58WBrjnCk3ytILWi0WdBdeXZojzOILRXoXrHPHBNgRtgT+JB5VnCO SPjtsuINavSRA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 199F86873C; Mon, 24 Nov 2025 06:50:07 -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 0MkYBbngI0hS; Mon, 24 Nov 2025 06:50:07 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1763992202; bh=YnN8wK4HSu2zVUpu6Du/23ltzvEBd2JOvyob2tML0JQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bJ0p34nHdPZGD7YUkwXfBP6r43EKY27+p9A2iHjSOoiJBGZ8exwQUAolePDJwzHoW pLf6Xkaha3bwAD0CtAXzgxQPqnDEQ7o0kUicmRBpHUQsj9iFnRTLdnOwLrYxBWGCHk ezXIhT0Zll7+HmPy6e0G4e9Wc9YDmgUwc3DD5Tn5YBTBk4DycwOvbXoIGnwlkY0uCl uw1miN2koBR9J86kozwB3fciJED3IifTsHc8Pn+kOyUmQr8Pi1qVrdoMTf53+k0c5e 4URG+YFfQWtLbr16VhaWVBYuWI8FWj8MwnvwmX8iCA9DvvVmp63+PPezrhfiAwGOul kYh1zaVXbhP4g== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 58FEC6873F; Mon, 24 Nov 2025 06:50:02 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Mon, 24 Nov 2025 06:49:14 -0700 Message-ID: <20251124134932.1991031-4-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251124134932.1991031-1-sjg@u-boot.org> References: <20251124134932.1991031-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: SLLV4YNOSLPVUODOLSV53ZCYETQX2MCC X-Message-ID-Hash: SLLV4YNOSLPVUODOLSV53ZCYETQX2MCC 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 3/9] buildman: Support comma-separated values in -a flag 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 Allow users to specify multiple config adjustments in a single -a argument using commas. This is more convenient than repeating -a multiple times. Examples: buildman -a FOO,~BAR buildman -a FOO,~BAR -a BAZ=123 Add tests to verify comma-separated values work correctly. Co-developed-by: Claude Signed-off-by: Simon Glass --- tools/buildman/buildman.rst | 13 +++++++++++++ tools/buildman/cfgutil.py | 19 ++++++++++++------- tools/buildman/cmdline.py | 3 ++- tools/buildman/test.py | 12 ++++++++++++ 4 files changed, 39 insertions(+), 8 deletions(-) diff --git a/tools/buildman/buildman.rst b/tools/buildman/buildman.rst index 487e9d67a4b..c0599757b0b 100644 --- a/tools/buildman/buildman.rst +++ b/tools/buildman/buildman.rst @@ -1307,6 +1307,19 @@ You can disable options by preceding them with tilde (~). You can specify the buildman -a CMD_SETEXPR_FMT -a ~CMDLINE +You can also use comma-separated values to specify multiple options in a single +argument: + +.. code-block:: bash + + buildman -a CMD_SETEXPR_FMT,~CMDLINE + +or mix both styles: + +.. code-block:: bash + + buildman -a CMD_SETEXPR_FMT,~CMDLINE -a BOOTSTD_FULL + Some options have values, in which case you can change them: .. code-block:: bash diff --git a/tools/buildman/cfgutil.py b/tools/buildman/cfgutil.py index a340e01cb6b..5bc97d33595 100644 --- a/tools/buildman/cfgutil.py +++ b/tools/buildman/cfgutil.py @@ -134,7 +134,7 @@ def convert_list_to_dict(adjust_cfg_list): Args: adjust_cfg_list (list of str): List of changes to make to .config file before building. Each is one of (where C is the config option with - or without the CONFIG_ prefix) + or without the CONFIG_ prefix). Items can be comma-separated. C to enable C ~C to disable C @@ -154,12 +154,17 @@ def convert_list_to_dict(adjust_cfg_list): ValueError: if an item in adjust_cfg_list has invalid syntax """ result = {} - for cfg in adjust_cfg_list or []: - m_cfg = RE_CFG.match(cfg) - if not m_cfg: - raise ValueError(f"Invalid CONFIG adjustment '{cfg}'") - negate, _, opt, val = m_cfg.groups() - result[opt] = f'%s{opt}%s' % (negate or '', val or '') + for item in adjust_cfg_list or []: + # Split by comma to support comma-separated values + for cfg in item.split(','): + cfg = cfg.strip() + if not cfg: + continue + m_cfg = RE_CFG.match(cfg) + if not m_cfg: + raise ValueError(f"Invalid CONFIG adjustment '{cfg}'") + negate, _, opt, val = m_cfg.groups() + result[opt] = f'%s{opt}%s' % (negate or '', val or '') return result diff --git a/tools/buildman/cmdline.py b/tools/buildman/cmdline.py index ad07e6cac39..b3c70daeca3 100644 --- a/tools/buildman/cmdline.py +++ b/tools/buildman/cmdline.py @@ -24,7 +24,8 @@ def add_upto_m(parser): """ # Available JqzZ parser.add_argument('-a', '--adjust-cfg', type=str, action='append', - help='Adjust the Kconfig settings in .config before building') + help='Adjust the Kconfig settings in .config before building. ' + + 'Supports comma-separated values') parser.add_argument('-A', '--print-prefix', action='store_true', help='Print the tool-chain prefix for a board (CROSS_COMPILE=)') parser.add_argument('-b', '--branch', type=str, diff --git a/tools/buildman/test.py b/tools/buildman/test.py index a134ac4f917..81e708d9bd6 100644 --- a/tools/buildman/test.py +++ b/tools/buildman/test.py @@ -780,6 +780,18 @@ class TestBuild(unittest.TestCase): 'CONFIG_ANNA="anna"']) self.assertEqual(expect, actual) + # Test comma-separated values + actual = cfgutil.convert_list_to_dict( + ['FRED,~MARY,JOHN=0x123', 'ALICE="alice"', + 'CONFIG_AMY,~CONFIG_ABE', 'CONFIG_MARK=0x456,CONFIG_ANNA="anna"']) + self.assertEqual(expect, actual) + + # Test mixed comma-separated and individual values + actual = cfgutil.convert_list_to_dict( + ['FRED,~MARY', 'JOHN=0x123', 'ALICE="alice",CONFIG_AMY', + '~CONFIG_ABE,CONFIG_MARK=0x456', 'CONFIG_ANNA="anna"']) + self.assertEqual(expect, actual) + def test_check_cfg_file(self): """Test check_cfg_file detects conflicts as expected""" # Check failure to disable CONFIG