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

Joe Hershberger joe.hershberger at ni.com
Mon May 11 19:23:14 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>

---

Changes in v2:
-Print which compiler is missing

 tools/moveconfig.py | 35 ++++++++++++++++++++++++++++++-----
 1 file changed, 30 insertions(+), 5 deletions(-)

diff --git a/tools/moveconfig.py b/tools/moveconfig.py
index c81f32c..315f4be 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,19 +299,25 @@ 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 (%s)' % self.cross_compile
+            self.defconfig_error(errmsg)
+            self.state = STATE_IDLE
+            return True
 
         if self.state == STATE_SILENTOLDCONFIG:
             self.parser.update_defconfig(self.defconfig)
             self.state = STATE_IDLE
             return True
 
-        cross_compile = self.parser.get_cross_compile()
+        self.cross_compile = self.parser.get_cross_compile()
         cmd = list(self.make_cmd)
-        if cross_compile:
-            cmd.append('CROSS_COMPILE=%s' % cross_compile)
+        if self.cross_compile:
+            cmd.append('CROSS_COMPILE=%s' % self.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,7 @@ class Slots:
 
 def move_config(config_attr, jobs=1):
     check_top_directory()
+
     print 'Moving %s (type: %s, default: %s, no_spl: %s) ...  (jobs: %d)' % (
         config_attr['config'],
         config_attr['type'],
@@ -379,6 +394,10 @@ def move_config(config_attr, jobs=1):
                 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)
 
     # Main loop to process defconfig files:
@@ -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