From patchwork Tue Apr 7 12:26:50 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2154 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=1775564846; bh=h+EhUV8M3/gsFBtMD/zAudzvDGcgOpx8vVikaVBj5KI=; 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=D/AYD0rIjpWZuCoRz7DJldvGFvyNGh6sD7ZlRXny1Xx7NQ7HfCaieyWp9gAXAhfrW X1NsVbsr9wk1H9ytYJ4NU+dFUR0FKdkz5RVlCz3yPIfyX+Ng/SD3P2gyooDO31d81a 7aCplAqDd9dpJeqPqaHIpsT8mU1fberUdcdjq1bi/Cs3XHR1HXk4yhnbeODAK6mGvF yH0Mxu/nIxMtVl3jzFy1Fds3f7nJsl4LpytS+NnU2Gq160VhGBxMFTTpsYD1pOyGlE yaU/P3xoFSz1H0rfxy9odcu5nO0E79UhwMga9w1ZilXu3hSB43VqjaszQEe//jG0Iw 6Na2iLIKob33w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E27686A3A1 for ; Tue, 7 Apr 2026 06:27:26 -0600 (MDT) 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 wVlWzoAwN9Nn for ; Tue, 7 Apr 2026 06:27:26 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1775564846; bh=h+EhUV8M3/gsFBtMD/zAudzvDGcgOpx8vVikaVBj5KI=; 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=D/AYD0rIjpWZuCoRz7DJldvGFvyNGh6sD7ZlRXny1Xx7NQ7HfCaieyWp9gAXAhfrW X1NsVbsr9wk1H9ytYJ4NU+dFUR0FKdkz5RVlCz3yPIfyX+Ng/SD3P2gyooDO31d81a 7aCplAqDd9dpJeqPqaHIpsT8mU1fberUdcdjq1bi/Cs3XHR1HXk4yhnbeODAK6mGvF yH0Mxu/nIxMtVl3jzFy1Fds3f7nJsl4LpytS+NnU2Gq160VhGBxMFTTpsYD1pOyGlE yaU/P3xoFSz1H0rfxy9odcu5nO0E79UhwMga9w1ZilXu3hSB43VqjaszQEe//jG0Iw 6Na2iLIKob33w== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CBB756A39E for ; Tue, 7 Apr 2026 06:27:26 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1775564843; bh=37As97Jv5OMlmoPoL86CO2MxGcJ0gF634DLaXt+kREg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O4Nt92s5Xrf3H87P66OEjd9OELdcTpbNmbC/dDtjF/AD71+eths27AbiTvRamffoV 0jqtuS3kgYQcHIXoUG5xkeBx9sxZnblCjbAP7CRaE5Tq/MJ1pS99NUguznLWjSDlx6 zW0kHHJYtM2OfTNxG2d0Z7Ub5euL+kvZYPPhjRY2EZ///jYq717x8auiILU8+D9alK GWI0Yfk3KDYWPXZLNPxSKXe2m89xwT+Cr8dUygYugVY29SeY1TSdMnZ2f2qUGyu6/Z tzekp5DwFMzC2gv9XqpfiFJNdiJdOfhrhWpU3luPUqtWJ3BUMAYdJ5xAPQ175k6MGl nSnLfts8aVDTA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D51CA6A3A4; Tue, 7 Apr 2026 06:27:23 -0600 (MDT) 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 aLCRqyDKcEF0; Tue, 7 Apr 2026 06:27:23 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1775564840; bh=9GdrA22BooWg0VLoDW6du1ZttNK752Tw/6W+dqQI4Ks=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S8dUABmiOQs1LElPIgQB7O+/SU0nFsroLEQFqP72wuNr/0qoxmXrNzFRW274iXyiJ XKezBUddAcBGLPYiPCH1K4OTp47NPz5bNtu+XTVlDW39NjyojozkYPi/3WywHGVOjk CJc1zzFKYgFp4mb3QrjjQZt9abWWVy5o1PE2kTfUYWxuHQ21x1XO43C5j7VAPeGT0M RxZKTzTb6AdXu5EJpPkBJYM4H0tCjJCwoWG2GDMGvwZp/fPvm3LRJsXxOQZZqJSZdr W55DHogYtG3LV1SZkrSzua+v7u6M0hHDenDkFiG9FEBwDMnmsyIkzHBV19PLO/kEN6 37EFnTAqew0uA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 8A45D6A3AA; Tue, 7 Apr 2026 06:27:20 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Tue, 7 Apr 2026 06:26:50 -0600 Message-ID: <20260407122656.3462730-4-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260407122656.3462730-1-sjg@u-boot.org> References: <20260407122656.3462730-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: DFIBBIMBNYEEGUMJLMUXXLL353N6UZHN X-Message-ID-Hash: DFIBBIMBNYEEGUMJLMUXXLL353N6UZHN 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 X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 3/4] qconfig: Skip cosmetic-only #include defconfig changes 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 The #include defconfig sync currently rewrites the file whenever any overlay entries are redundant (already provided by the include). This is cosmetic and creates unnecessary churn in resync commits. Only write changes when the effective config (what kconfiglib resolves after loading) actually differs from the target. Redundant overlay entries are harmless and preserving them keeps the resync commit minimal. Update the test to match: syncing a defconfig with a redundant CONFIG should leave the file unchanged. Also add a test that verifies syncing an #include defconfig does not change the effective config. Signed-off-by: Simon Glass --- tools/qconfig.py | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/tools/qconfig.py b/tools/qconfig.py index 490f68e4ecc..864b42e2808 100755 --- a/tools/qconfig.py +++ b/tools/qconfig.py @@ -683,7 +683,19 @@ def _sync_include_defconfig(kconf, srcdir, orig, dry_run): new_content = _verify_defconfig(kconf, srcdir, os.path.dirname(orig), target, needed, new_content) - updated = new_content != tools.read_file(orig) + # Only update the file if the effective config actually changes. + # Removing redundant overlay entries is cosmetic and would create + # unnecessary churn in the commit. + if new_content == tools.read_file(orig): + return False + + verify_pp = _cpp_preprocess(srcdir, orig) + kconf.load_config(verify_pp) + os.unlink(verify_pp) + orig_effective = {sym.name: sym.str_value + for sym in kconf.unique_defined_syms} + updated = orig_effective != target + if updated and not dry_run: tools.write_file(orig, new_content) return updated @@ -1858,8 +1870,8 @@ class SyncTests(unittest.TestCase): # The output should still start with #include self.assertIn(b'#include', content_after) - def test_sync_include_removes_redundant(self): - """Syncing a #include defconfig removes CONFIGs from the base""" + def test_sync_include_skips_redundant(self): + """Syncing a #include defconfig skips cosmetic-only changes""" # Create a temp defconfig that includes sandbox and redundantly # sets a CONFIG that sandbox already sets with tempfile.NamedTemporaryFile( @@ -1871,12 +1883,13 @@ class SyncTests(unittest.TestCase): try: updated = _sync_include_defconfig(self.kconf, self.srcdir, tmp_name, dry_run=False) - self.assertTrue(updated) + # Redundant CONFIG doesn't change the effective config, + # so the file should not be updated + self.assertFalse(updated) with open(tmp_name) as inf: result = inf.read() - # CONFIG_CMDLINE=y should be gone (it's in the base) - self.assertNotIn('CONFIG_CMDLINE=y', result) - # #include should still be there + # File should be unchanged + self.assertIn('CONFIG_CMDLINE=y', result) self.assertIn('#include "sandbox_defconfig"', result) finally: os.unlink(tmp_name)