diff mbox

[U-Boot,v3,05/10] moveconfig: Add a parameter to accept a list to build

Message ID 1431556137-8426-5-git-send-email-joe.hershberger@ni.com
State Superseded
Delegated to: Masahiro Yamada
Headers show

Commit Message

Joe Hershberger May 13, 2015, 10:28 p.m. UTC
This is helpful to re-attempt to move failed boards from a previous run
without starting over.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

---

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(-)

Comments

Masahiro Yamada May 14, 2015, 1:06 p.m. UTC | #1
2015-05-14 7:28 GMT+09:00 Joe Hershberger <joe.hershberger@ni.com>:
> This is helpful to re-attempt to move failed boards from a previous run
> without starting over.
>
> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

I like this idea, but I have just submitted a new version.

Would you mind rebasing this patch onto mine, or shall I do it?
diff mbox

Patch

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()