All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: U-Boot Mailing List <u-boot@lists.denx.de>
Cc: Tom Rini <trini@konsulko.com>, Simon Glass <sjg@chromium.org>,
	Alper Nebi Yasak <alpernebiyasak@gmail.com>
Subject: [PATCH v5 14/44] moveconfig: Various minor improvements
Date: Wed, 22 Feb 2023 09:33:55 -0700	[thread overview]
Message-ID: <20230222163425.2043934-15-sjg@chromium.org> (raw)
In-Reply-To: <20230222163425.2043934-1-sjg@chromium.org>

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 <sjg@chromium.org>
---

(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


  parent reply	other threads:[~2023-02-22 16:40 UTC|newest]

Thread overview: 94+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-22 16:33 [PATCH v5 00/44] More tidy-ups of Kconfig options Simon Glass
2023-02-22 16:33 ` [PATCH v5 01/44] mtd: Drop unused kb9202_nand driver Simon Glass
2023-03-03 23:41   ` Tom Rini
2023-02-22 16:33 ` [PATCH v5 02/44] mtd: Drop unused CONFIG_ONENAND_U_BOOT Simon Glass
2023-03-03 23:41   ` Tom Rini
2023-02-22 16:33 ` [PATCH v5 03/44] sh4: Drop unused twl6030 driver Simon Glass
2023-03-03 23:41   ` Tom Rini
2023-02-22 16:33 ` [PATCH v5 04/44] moveconfig: Update to detect / correct missing SPL Kconfigs Simon Glass
2023-02-22 16:33 ` [PATCH v5 05/44] bootstd: Disable QFW bootmeth in SPL Simon Glass
2023-03-03 23:41   ` Tom Rini
2023-02-22 16:33 ` [PATCH v5 06/44] Correct SPL uses of ARCH_MVEBU Simon Glass
2023-02-22 16:33 ` [PATCH v5 07/44] Correct SPL uses of DISPLAY_AER_FULL Simon Glass
2023-03-03 23:41   ` Tom Rini
2023-02-22 16:33 ` [PATCH v5 08/44] Correct SPL uses of MULTIPLEXER Simon Glass
2023-03-03 23:41   ` Tom Rini
2023-02-22 16:33 ` [PATCH v5 09/44] Correct SPL use of PG_WCOM_UBOOT_UPDATE_SUPPORTED Simon Glass
2023-03-03 23:41   ` Tom Rini
2023-02-22 16:33 ` [PATCH v5 10/44] Correct SPL uses of PHY_FIXED Simon Glass
2023-03-03 23:41   ` Tom Rini
2023-02-22 16:33 ` [PATCH v5 11/44] boot: Add Kconfigs for BOOTMETH_VBE_REQUEST Simon Glass
2023-03-03 23:41   ` Tom Rini
2023-02-22 16:33 ` [PATCH v5 12/44] Correct SPL use of DM_RNG Simon Glass
2023-03-03 23:41   ` Tom Rini
2023-02-22 16:33 ` [PATCH v5 13/44] lib: Add a Kconfig for SPL_BZIP2 Simon Glass
2023-03-03 23:41   ` Tom Rini
2023-02-22 16:33 ` Simon Glass [this message]
2023-02-22 16:33 ` [PATCH v5 15/44] sandbox: Expand size for VPL image Simon Glass
2023-03-03 23:42   ` Tom Rini
2023-02-22 16:33 ` [PATCH v5 16/44] event: Add Kconfig options for SPL Simon Glass
2023-03-03 23:42   ` Tom Rini
2023-02-22 16:33 ` [PATCH v5 17/44] bootstd: Correct 'VPL' typo Simon Glass
2023-03-03 23:42   ` Tom Rini
2023-02-22 16:33 ` [PATCH v5 18/44] env: Avoid checking ENV_IS_IN when env disabled Simon Glass
2023-03-02 17:25   ` Tom Rini
2023-02-22 16:34 ` [PATCH v5 19/44] env: Allow VPL environment to be nowhere Simon Glass
2023-03-03 23:42   ` Tom Rini
2023-02-22 16:34 ` [PATCH v5 20/44] lib: Add VPL options for SHA1 and SHA256 Simon Glass
2023-03-03 23:42   ` Tom Rini
2023-02-22 16:34 ` [PATCH v5 21/44] x86: Use string functions for all 32-bit builds Simon Glass
2023-03-02 20:37   ` Tom Rini
2023-03-15 14:05     ` Simon Glass
2023-02-22 16:34 ` [PATCH v5 22/44] lib: Fix build condition for tiny-printf Simon Glass
2023-03-03 23:42   ` Tom Rini
2023-02-22 16:34 ` [PATCH v5 23/44] sandbox: Tidy up RTC options Simon Glass
2023-03-03 23:42   ` Tom Rini
2023-02-22 16:34 ` [PATCH v5 24/44] sandbox: Use the generic VPL option to enable VPL Simon Glass
2023-03-03 23:42   ` Tom Rini
2023-02-22 16:34 ` [PATCH v5 25/44] sandbox: Tidy up I2C options Simon Glass
2023-02-23  5:43   ` Heiko Schocher
2023-03-03 23:42   ` Tom Rini
2023-02-22 16:34 ` [PATCH v5 26/44] fixdep: Add support for VPL Simon Glass
2023-02-22 16:34 ` [PATCH v5 27/44] fixdep: Refactor to make testing easier Simon Glass
2023-02-22 16:34 ` [PATCH v5 28/44] fixdep: Add some tests for parse_config_line() Simon Glass
2023-02-22 16:34 ` [PATCH v5 29/44] test: Add SPL versions of the TEST_KCONFIG options Simon Glass
2023-02-22 16:34 ` [PATCH v5 30/44] lib: Add an SPL config for LIB_UUID Simon Glass
2023-02-23  6:14   ` Heinrich Schuchardt
2023-02-23 23:07     ` Simon Glass
2023-03-03 23:42   ` Tom Rini
2023-02-22 16:34 ` [PATCH v5 31/44] test: Tidy up sandbox handling in test-main Simon Glass
2023-03-03 23:42   ` Tom Rini
2023-02-22 16:34 ` [PATCH v5 32/44] x86: Fix up use of X86_32BIT_INIT and X86_64 options Simon Glass
2023-03-03 14:50   ` Tom Rini
2023-03-06 17:53     ` Simon Glass
2023-02-22 16:34 ` [PATCH v5 33/44] Add VPL options for BLOBLIST Simon Glass
2023-03-03 23:42   ` Tom Rini
2023-02-22 16:34 ` [PATCH v5 34/44] rockchip: Avoid checking environment without ENV_SUPPORT Simon Glass
2023-02-23 16:16   ` Quentin Schulz
2023-02-22 16:34 ` [PATCH v5 35/44] freescale: Drop old pre-DM_ETH code Simon Glass
2023-03-03 23:42   ` Tom Rini
2023-02-22 16:34 ` [PATCH v5 36/44] imx: Use SATA instead of CMD_SATA Simon Glass
2023-02-22 16:43   ` Baruch Siach
2023-02-22 19:16     ` Simon Glass
2023-03-03 23:42   ` Tom Rini
2023-02-22 16:34 ` [PATCH v5 37/44] net: Add an SPL config for atheros Simon Glass
2023-03-03 23:42   ` Tom Rini
2023-02-22 16:34 ` [PATCH v5 38/44] freescale: Fix odd use of ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE Simon Glass
2023-03-02 20:42   ` Tom Rini
2023-02-22 16:34 ` [PATCH v5 39/44] serial: Support ns16550 driver in TPL Simon Glass
2023-03-03 23:42   ` Tom Rini
2023-02-22 16:34 ` [PATCH v5 40/44] dm: Add a TPL symbol for simple-bus Simon Glass
2023-03-03 23:43   ` Tom Rini
2023-02-22 16:34 ` [PATCH v5 41/44] x86: coral: Add missing TPL options Simon Glass
2023-03-03 23:43   ` Tom Rini
2023-02-22 16:34 ` [PATCH v5 42/44] power: wandboard: Add a missing CONFIG Simon Glass
2023-03-03 23:43   ` Tom Rini
2023-02-22 16:34 ` [PATCH v5 43/44] venice: Simplify conditions for network init Simon Glass
2023-03-03 23:43   ` Tom Rini
2023-02-22 16:34 ` [PATCH v5 44/44] command: Don't allow commands in SPL Simon Glass
2023-03-02 20:30   ` Tom Rini
2023-03-03 23:43   ` Tom Rini
2023-03-03 23:43 ` [PATCH v5 00/44] More tidy-ups of Kconfig options Tom Rini
2023-03-06 18:20   ` Simon Glass
2023-03-11 15:28     ` Tom Rini
2023-03-11 19:34       ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230222163425.2043934-15-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=alpernebiyasak@gmail.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.