From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E5EB5C636D6 for ; Wed, 22 Feb 2023 16:40:15 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8C5A385B17; Wed, 22 Feb 2023 17:36:41 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="LMYO3kis"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6BBB085B08; Wed, 22 Feb 2023 17:35:48 +0100 (CET) Received: from mail-io1-xd2d.google.com (mail-io1-xd2d.google.com [IPv6:2607:f8b0:4864:20::d2d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 52E1A85B0C for ; Wed, 22 Feb 2023 17:34:57 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd2d.google.com with SMTP id y140so4014885iof.6 for ; Wed, 22 Feb 2023 08:34:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zWefdgj70JuuHiXg5T+KJSHnWB7uiHiqmxmyH/kltPk=; b=LMYO3kisemDsoeQv/EVJvPwiO6pFn6iwRzRBWXvB0DuhMLfm+v5N5SEoEAuGYaLgXd B+hxFi4AVuVS4yGPjgegAjkADlEmAr0DKERXs6PeK9E1WuygPpZ6JiRKYx3yEnex+K5W QlegqrZBO/RaKpt80fcBs8EnAWJlvNv5wupiw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zWefdgj70JuuHiXg5T+KJSHnWB7uiHiqmxmyH/kltPk=; b=ej8mRCSqIOfWEX96+Ijq8O5xoIU//5ALUZkgPojMz4cV9u8Ra6T5Dhp9b+UaqEMEEs zwrorNAwX+2mtP2ZAaOkGFovddzR/28rbXPcappqCpjOLktRJ2QkUeOc4wX/jfA6qs8C IWbutBsMC/4AvGqXygIiDkem9Mtb8RcaC/Bq2GTH9XjiLuA7bltMPyMMMcQ6h7mXbNG6 mZzG279cQKaNQgBz+LNED+sFIWcR8rWu6qGk+zRKPmtLSY+Ec+9RgwAstNZCnR/TZC1z Q5VN0wuCsLEm6ryk9u7IJkkJRr1iN76JNFNtukSuYp6zYHrhQY+s5mLqq7KnQVN3Z+J5 LAzg== X-Gm-Message-State: AO0yUKUF7PG7NxkgOw7jr7rbyZyFSyNBeZKzrcZQywnoCgT+efbRJLjO Jaa7AJnd3EzJkpBBxlMCyc/LhDP7mzBdV0la X-Google-Smtp-Source: AK7set9xIF9xUtQmHxBVmlvmW4ZnnH1ctcE7W+6VZxl45oA0F2wACacEPbbf72qnvyKzPFdrpze9SA== X-Received: by 2002:a5d:91c8:0:b0:740:72dd:1617 with SMTP id k8-20020a5d91c8000000b0074072dd1617mr1446483ior.14.1677083692933; Wed, 22 Feb 2023 08:34:52 -0800 (PST) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id z26-20020a056602005a00b00716eb44b97esm2164541ioz.27.2023.02.22.08.34.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Feb 2023 08:34:52 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Alper Nebi Yasak Subject: [PATCH v5 14/44] moveconfig: Various minor improvements Date: Wed, 22 Feb 2023 09:33:55 -0700 Message-Id: <20230222163425.2043934-15-sjg@chromium.org> X-Mailer: git-send-email 2.39.2.637.g21b0678d19-goog In-Reply-To: <20230222163425.2043934-1-sjg@chromium.org> References: <20230222163425.2043934-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean It turns out that the conf_noproper file is not neeed, since if an option does not appear in U-Boot proper we can just omit it from the autoconf for that build. Drop it. Also add more control over what is output from the tool. Add this in here. It should be added to the previous series (splb). Signed-off-by: Simon Glass --- (no changes since v1) tools/moveconfig.py | 91 +++++++++++++++++++++------------------------ 1 file changed, 43 insertions(+), 48 deletions(-) diff --git a/tools/moveconfig.py b/tools/moveconfig.py index b3ac2672737..ec2afa92e46 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -1833,13 +1833,20 @@ def scan_src_files(fname_dict, all_uses, fname_uses): MODE_NORMAL, MODE_SPL, MODE_PROPER = range(3) -def do_scan_source(path, do_update, show_conflicts, do_commit): +def do_scan_source(path, do_update, do_update_source, show_conflicts, + do_commit): """Scan the source tree for Kconfig inconsistencies Args: path (str): Path to source tree - do_update (bool): True to write to scripts/kconf_... files - show_conflicts (bool): True to show conflicts + do_update (bool): True to write to scripts/conf_nospl file + do_update_source (bool): True to update source to remove invalid use of + CONFIG_IS_ENABLED() + show_conflicts (bool): True to show conflicts between the source code + and the Kconfig (such as missing options, or options which imply an + SPL option that does not exist) + do_commit (bool): Create commits to remove use of SPL_TPL_ and + CONFIG_IS_ENABLED macros when there is no SPL symbol. """ def is_not_proper(name): for prefix in SPL_PREFIXES: @@ -1977,9 +1984,7 @@ def do_scan_source(path, do_update, show_conflicts, do_commit): dirname, leaf = os.path.split(fname) root, ext = os.path.splitext(leaf) - #if dirname != '' or root != 'Makefile': - #continue - if (dirname.startswith('test') or + if (dirname.startswith('test/') or dirname.startswith('lib/efi_selftest')): # Ignore test code since it is mostly only for sandbox pass @@ -2011,38 +2016,25 @@ def do_scan_source(path, do_update, show_conflicts, do_commit): finish_file(last_fname, rest_list) return mk_dict, src_dict - def check_mk_missing(all_uses, spl_not_found, proper_not_found): + def check_missing(all_uses, spl_not_found, proper_not_found, + show_conflicts): # Make sure we know about all the options in Makefiles - print('\nCONFIG options present in Makefiles but not Kconfig:') not_found = check_not_found(all_uses, MODE_NORMAL) - show_uses(not_found) + if show_conflicts: + print('\nCONFIG options present in source but not Kconfig:') + show_uses(not_found) - print('\nCONFIG options present in Makefiles but not Kconfig (SPL):') not_found = check_not_found(all_uses, MODE_SPL) - show_uses(not_found) spl_not_found |= set(is_not_proper(key) or key for key in not_found.keys()) + if show_conflicts: + print('\nCONFIG options present in source but not Kconfig (SPL):') + show_uses(not_found) - print('\nCONFIG options used as Proper in Makefiles but without a non-SPL_ variant:') not_found = check_not_found(all_uses, MODE_PROPER) - show_uses(not_found) - proper_not_found |= set(key for key in not_found.keys()) - - def check_src_missing(all_uses, spl_not_found, proper_not_found): - # Make sure we know about all the options in source files - print('\nCONFIG options present in source but not Kconfig:') - not_found = check_not_found(all_uses, MODE_NORMAL) - show_uses(not_found) - - print('\nCONFIG options present in source but not Kconfig (SPL):') - not_found = check_not_found(all_uses, MODE_SPL) - show_uses(not_found) - spl_not_found |= set(is_not_proper(key) or key - for key in not_found.keys()) - - print('\nCONFIG options used as Proper in source but without a non-SPL_ variant:') - not_found = check_not_found(all_uses, MODE_PROPER) - show_uses(not_found) proper_not_found |= set(key for key in not_found.keys()) + if show_conflicts: + print('\nCONFIG options used as Proper in source but without a non-SPL_ variant:') + show_uses(not_found) def show_summary(spl_not_found, proper_not_found): print('\nCONFIG options used as SPL but without an SPL_ variant:') @@ -2053,19 +2045,24 @@ def do_scan_source(path, do_update, show_conflicts, do_commit): for item in sorted(proper_not_found): print(f' {item}') - def write_update(spl_not_found, proper_not_found): - with open(os.path.join(path, 'scripts', 'conf_nospl'), + def write_update(spl_not_found): + with open(os.path.join(path, 'scripts', 'conf_nospl'), 'w', encoding='utf-8') as out: - print('# These options should not be enabled in SPL builds\n', + print('''# Options which are never enabled in SPL. + +Generally, options which have no SPL_ prefix (e.g. CONFIG_FOO) apply to all +SPL build phases. This allows things like ARCH_ARM to propagate to all builds +without the hassle of generating a separate SPL version fo each phase. But in +some cases this is not wanted. + +This file lists options which don't have an SPL equivalent, but still should not +be enabled in SPL builds. It is necessary since kconfig cannot tell (just by +looking at the Kconfig description) whether it applies to Proper builds only, +or to all builds. +''', file=out) for item in sorted(spl_not_found): print(item, file=out) - with open(os.path.join(path, 'scripts', 'conf_noproper'), 'w', - encoding='utf-8') as out: - print('# These options should not be enabled in Proper builds\n', - file=out) - for item in sorted(proper_not_found): - print(item, file=out) def check_conflict(kconf, all_uses, show): """Check conflicts between uses of CONFIG options in source @@ -2210,7 +2207,7 @@ def do_scan_source(path, do_update, show_conflicts, do_commit): conflicts, cfg_dict = check_conflict(kconf, all_uses, show_conflicts) - if do_update: + if do_update_source: update_source(conflicts) if do_commit: create_commits(cfg_dict) @@ -2218,17 +2215,13 @@ def do_scan_source(path, do_update, show_conflicts, do_commit): # Look for CONFIG options that are not found spl_not_found = set() proper_not_found = set() - check_mk_missing(all_uses, spl_not_found, proper_not_found) - - # Scan the source code - scan_src_files(src_dict, all_uses, fname_uses) - check_src_missing(all_uses, spl_not_found, proper_not_found) + check_missing(all_uses, spl_not_found, proper_not_found, show_conflicts) show_summary(spl_not_found, proper_not_found) # Write out the updated information if do_update: - write_update(spl_not_found, proper_not_found) + write_update(spl_not_found) def main(): try: @@ -2289,6 +2282,8 @@ doc/develop/moveconfig.rst for documentation.''' help="respond 'yes' to any prompts") parser.add_argument('-u', '--update', action='store_true', default=False, help="update scripts/ files (use with --scan-source)") + parser.add_argument('-U', '--update-source', action='store_true', + help="update source code (use with --scan-source)") parser.add_argument('-v', '--verbose', action='store_true', default=False, help='show any build errors as boards are built') parser.add_argument('configs', nargs='*') @@ -2304,8 +2299,8 @@ doc/develop/moveconfig.rst for documentation.''' unittest.main() if args.scan_source: - do_scan_source(os.getcwd(), args.update, args.list_problems, - args.commit) + do_scan_source(os.getcwd(), args.update, args.update_source, + args.list_problems, args.commit) return if not any((len(configs), args.force_sync, args.build_db, args.imply, -- 2.39.2.637.g21b0678d19-goog