From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joe Hershberger Date: Wed, 13 May 2015 17:28:51 -0500 Subject: [U-Boot] [PATCH v3 05/10] moveconfig: Add a parameter to accept a list to build In-Reply-To: <1431556137-8426-1-git-send-email-joe.hershberger@ni.com> References: <1431364998-2905-1-git-send-email-joe.hershberger@ni.com> <1431556137-8426-1-git-send-email-joe.hershberger@ni.com> Message-ID: <1431556137-8426-5-git-send-email-joe.hershberger@ni.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de This is helpful to re-attempt to move failed boards from a previous run without starting over. Signed-off-by: Joe Hershberger --- Changes in v3: -Fixed command line options order (alphabetize) Changes in v2: -New for version 2 tools/moveconfig.py | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/tools/moveconfig.py b/tools/moveconfig.py index f2651a9..2688ad1 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -396,7 +396,7 @@ class Slots: ret = False return ret -def move_config(config_attr, jobs=1): +def move_config(config_attr, options): check_top_directory() print 'Moving %s (type: %s, default: %s, no_spl: %s) ... (jobs: %d)' % ( @@ -404,22 +404,25 @@ def move_config(config_attr, jobs=1): config_attr['type'], config_attr['default'], config_attr['no_spl_support'], - jobs) - - # 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)) + 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_attr, jobs) + slots = Slots(config_attr, options.jobs) # Main loop to process defconfig files: # Add a new subprocess into a vacant slot. @@ -450,6 +453,8 @@ def main(): parser = optparse.OptionParser() # Add options here + parser.add_option('-d', '--defconfigs', type='string', + help='a file containing a list of defconfigs to move') parser.add_option('-j', '--jobs', type='int', default=cpu_count, help='the number of jobs to run simultaneously') parser.usage += ' config type default no_spl_support' @@ -480,7 +485,7 @@ def main(): if not config_attr['config'].startswith('CONFIG_'): config_attr['config'] = 'CONFIG_' + config_attr['config'] - move_config(config_attr, options.jobs) + move_config(config_attr, options) if __name__ == '__main__': main() -- 1.7.11.5