From: Simon Glass Date: Wed, 17 Jul 2024 15:57:04 +0000 (+0100) Subject: qconfig: Add a return value to do_find_config() X-Git-Url: http://git.dujemihanovic.xyz/%22/img/sics.gif/%22/static/git-favicon.png?a=commitdiff_plain;h=630a9c9a4736fac39c858eb9bd220dd24b5e9bda;p=u-boot.git qconfig: Add a return value to do_find_config() Return an exit code so we can use this function like do_tests(). Refactor the caller to handle this. Reduce the size of main() by putting this code into its own function. Signed-off-by: Simon Glass --- diff --git a/tools/qconfig.py b/tools/qconfig.py index 8cba689666..b148792861 100755 --- a/tools/qconfig.py +++ b/tools/qconfig.py @@ -1072,11 +1072,14 @@ def defconfig_matches(configs, re_match): def do_find_config(config_list): """Find boards with a given combination of CONFIGs - Params: - config_list: List of CONFIG options to check (each a regex consisting - of a config option, with or without a CONFIG_ prefix. If an option - is preceded by a tilde (~) then it must be false, otherwise it must - be true) + Args: + config_list (list of str): List of CONFIG options to check (each a regex + consisting of a config option, with or without a CONFIG_ prefix. If + an option is preceded by a tilde (~) then it must be false, + otherwise it must be true) + + Returns: + int: exit code (0 for success) """ _, all_defconfigs, config_db, _ = read_database() @@ -1104,6 +1107,7 @@ def do_find_config(config_list): out.add(defc) print(f'{len(out)} matches') print(' '.join(item.split('_defconfig')[0] for item in out)) + return 0 def prefix_config(cfg): @@ -1584,8 +1588,7 @@ def main(): sys.exit(1) return 0 if args.find: - do_find_config(args.configs) - return 0 + return do_find_config(args.configs) # We are either building the database or forcing a sync of defconfigs config_db = {}