[U-Boot] [PATCH v4 08/10] moveconfig: Print a message for missing compiler

Joe Hershberger joe.hershberger at ni.com
Fri May 15 23:40:50 CEST 2015


A common case for failed builds is a missing compiler. Print a message
for that case to tell the user concisely which compiler was expected
that was not found.

This patch also has the effect of not printing build errors any longer.
The next patch will add a switch to optionally bring that back.

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

Changes in v4: None
Changes in v3: None
Changes in v2: None

 tools/moveconfig.py | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/tools/moveconfig.py b/tools/moveconfig.py
index 9e923da..f986f55 100755
--- a/tools/moveconfig.py
+++ b/tools/moveconfig.py
@@ -166,6 +166,7 @@ import os
 import re
 import shutil
 import subprocess
+from subprocess import PIPE
 import sys
 import tempfile
 import time
@@ -606,11 +607,14 @@ class Slot:
             return False
 
         if self.ps.poll() != 0:
-
+            errmsg = 'Failed to process.'
+            errout = self.ps.stderr.read()
+            if errout.find('gcc: command not found') != -1:
+                errmsg = 'Compiler not found (%s)' % self.cross_compile
             print >> sys.stderr, log_msg(self.options.color,
                                          COLOR_LIGHT_RED,
                                          self.defconfig,
-                                         "failed to process.")
+                                         errmsg),
             if self.options.exit_on_error:
                 sys.exit("Exit on error.")
             else:
@@ -644,13 +648,13 @@ class Slot:
             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('KCONFIG_IGNORE_DUPLICATES=1')
         cmd.append('include/config/auto.conf')
-        self.ps = subprocess.Popen(cmd, stdout=self.devnull)
+        self.ps = subprocess.Popen(cmd, stdout=self.devnull, stderr=PIPE)
         self.state = STATE_AUTOCONF
         return False
 
-- 
1.7.11.5



More information about the U-Boot mailing list