[U-Boot] [PATCH v3 10/10] moveconfig: Add a switch to only cleanup headers
Masahiro Yamada
yamada.masahiro at socionext.com
Thu May 14 16:51:39 CEST 2015
2015-05-14 7:28 GMT+09:00 Joe Hershberger <joe.hershberger at ni.com>:
> In some case you may want to only cleanup the headers. Make it possible
> without waiting for all boards to compile.
>
> Signed-off-by: Joe Hershberger <joe.hershberger at ni.com>
>
> ---
>
> Changes in v3:
> -New for version 3
>
> Changes in v2: None
>
> tools/moveconfig.py | 83 ++++++++++++++++++++++++++++-------------------------
> 1 file changed, 44 insertions(+), 39 deletions(-)
>
> diff --git a/tools/moveconfig.py b/tools/moveconfig.py
> index bb087d4..d63f47f 100755
> --- a/tools/moveconfig.py
> +++ b/tools/moveconfig.py
> @@ -412,48 +412,50 @@ class Slots:
> def move_config(config_attrs, options):
> check_top_directory()
>
> - for config_attr in config_attrs:
> - print 'Moving %s (type: %s, default: %s, no_spl: %s)' % (
> - config_attr['config'],
> - config_attr['type'],
> - config_attr['default'],
> - config_attr['no_spl_support'])
> - print '%d jobs...' % options.jobs
> -
> - if options.defconfigs:
> - defconfigs = [line.strip() for line in open(options.defconfigs, 'r')]
> - else:
> - # All the defconfig files to be processed
> - defconfigs = []
> - for (dirpath, dirnames, filenames) in os.walk('configs'):
> - dirpath = dirpath[len('configs') + 1:]
> - for filename in fnmatch.filter(filenames, '*_defconfig'):
> - if fnmatch.fnmatch(filename, '.*'):
> - continue
> - defconfigs.append(os.path.join(dirpath, filename))
> -
> - """Clean up any previous log of failed moves"""
> - if os.path.exists('moveconfig.failed'):
> - os.remove('moveconfig.failed')
> -
> - slots = Slots(config_attrs, options)
> -
> - # Main loop to process defconfig files:
> - # Add a new subprocess into a vacant slot.
> - # Sleep if there is no available slot.
> - for i, defconfig in enumerate(defconfigs):
> - while not slots.add(defconfig, i, len(defconfigs)):
> - while not slots.available():
> - # No available slot: sleep for a while
> - time.sleep(SLEEP_TIME)
> -
> - # wait until all the subprocesses finish
> - while not slots.empty():
> - time.sleep(SLEEP_TIME)
> + if not options.clean_only:
> + for config_attr in config_attrs:
> + print 'Moving %s (type: %s, default: %s, no_spl: %s)' % (
> + config_attr['config'],
> + config_attr['type'],
> + config_attr['default'],
> + config_attr['no_spl_support'])
> + print '%d jobs...' % options.jobs
> +
> + if options.defconfigs:
> + defconfigs = [line.strip() for line in
> + open(options.defconfigs, 'r')]
> + else:
> + # All the defconfig files to be processed
> + defconfigs = []
> + for (dirpath, dirnames, filenames) in os.walk('configs'):
> + dirpath = dirpath[len('configs') + 1:]
> + for filename in fnmatch.filter(filenames, '*_defconfig'):
> + if fnmatch.fnmatch(filename, '.*'):
> + continue
> + defconfigs.append(os.path.join(dirpath, filename))
> +
> + """Clean up any previous log of failed moves"""
> + if os.path.exists('moveconfig.failed'):
> + os.remove('moveconfig.failed')
> +
> + slots = Slots(config_attrs, options)
> +
> + # Main loop to process defconfig files:
> + # Add a new subprocess into a vacant slot.
> + # Sleep if there is no available slot.
> + for i, defconfig in enumerate(defconfigs):
> + while not slots.add(defconfig, i, len(defconfigs)):
> + while not slots.available():
> + # No available slot: sleep for a while
> + time.sleep(SLEEP_TIME)
> +
> + # wait until all the subprocesses finish
> + while not slots.empty():
> + time.sleep(SLEEP_TIME)
>
> cleanup_headers(config_attrs)
>
> - if os.path.exists('moveconfig.failed'):
> + if (not options.clean_only) & os.path.exists('moveconfig.failed'):
> print '!!! Some boards were not processed; move the config manually.'
> print '!!! The list of failed boards are saved in moveconfig.failed'
> print
I am OK with this feature, but this 'if' statement ranges over many code lines.
Perhaps, moving the cleanup_headers to the main function is simpler?
def main():
[snip]
if not options.clean_only:
move_config(config_attrs, options)
cleanup_headers(config_attrs)
--
Best Regards
Masahiro Yamada
More information about the U-Boot
mailing list