[U-Boot] [PATCH 3/5] moveconfig: Continue moving even if one board fails

Joe Hershberger joe.hershberger at ni.com
Thu May 7 23:22:58 CEST 2015


Some compilers are hard to come by or have so few boards they are not
worth messing with for this tool. Provide a list that need manual
intervention and continue moving the bulk of boards.

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

 tools/moveconfig.py | 29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/tools/moveconfig.py b/tools/moveconfig.py
index c81f32c..ab53476 100755
--- a/tools/moveconfig.py
+++ b/tools/moveconfig.py
@@ -17,6 +17,7 @@ import os
 import re
 import shutil
 import subprocess
+from subprocess import PIPE
 import sys
 import tempfile
 import time
@@ -277,6 +278,13 @@ class Slot:
         self.state = STATE_DEFCONFIG
         return True
 
+    def defconfig_error(self, errmsg):
+        output = self.defconfig[:-len('_defconfig')].ljust(37) + ': '
+        print output + errmsg
+
+        """Save a list of targets that have to be checked by hand"""
+        open('moveconfig.failed', 'a+').write("%s\n" % self.defconfig)
+
     def poll(self):
         """Check if the subprocess is running and invoke the .config
         parser if the subprocess is terminated.
@@ -291,7 +299,13 @@ class Slot:
             return False
 
         if self.ps.poll() != 0:
-            sys.exit("failed to process '%s'" % self.defconfig)
+            errmsg = 'ERROR - build error'
+            errout = self.ps.stderr.read()
+            if errout.find('gcc: command not found') != -1:
+                errmsg = 'ERROR - compiler not found'
+            self.defconfig_error(errmsg)
+            self.state = STATE_IDLE
+            return True
 
         if self.state == STATE_SILENTOLDCONFIG:
             self.parser.update_defconfig(self.defconfig)
@@ -303,7 +317,7 @@ class Slot:
         if cross_compile:
             cmd.append('CROSS_COMPILE=%s' % cross_compile)
         cmd.append('include/autoconf.mk')
-        self.ps = subprocess.Popen(cmd, stdout=self.devnull)
+        self.ps = subprocess.Popen(cmd, stdout=self.devnull, stderr=PIPE)
         self.state = STATE_SILENTOLDCONFIG
         return False
 
@@ -363,6 +377,11 @@ class Slots:
 
 def move_config(config_attr, jobs=1):
     check_top_directory()
+
+    """Clean up any previous log of failed moves"""
+    if os.path.exists('moveconfig.failed'):
+        os.remove('moveconfig.failed')
+
     print 'Moving %s (type: %s, default: %s, no_spl: %s) ...  (jobs: %d)' % (
         config_attr['config'],
         config_attr['type'],
@@ -396,6 +415,12 @@ def move_config(config_attr, jobs=1):
 
     cleanup_headers(config_attr['config'])
 
+    if 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
+        print open('moveconfig.failed', 'r').read()
+
 def main():
     try:
         cpu_count = multiprocessing.cpu_count()
-- 
1.7.11.5



More information about the U-Boot mailing list