gcc-wrapper: print friendlier errors.

Print something friendlier than a stack trace for OSErrors,
and something helpful for 'file not found' errors.  This prevents
flummoxing people who build the kernel without the compiler in their path,
which is far and away the most common error.

Change-Id: If1a3dfdd0868abc8531a06a61f2f374b54c64cd0
Signed-off-by: Gregory Bean <gbean@codeaurora.org>
(cherry picked from commit e1f91f8e6b38594caa30bf82c586674b83e9c0b4)
This commit is contained in:
Gregory Bean
2011-06-07 20:29:10 -07:00
committed by Stephen Boyd
parent b5b907b61f
commit 74b9ffc4bc

View File

@@ -30,6 +30,7 @@
# Invoke gcc, looking for warnings, and causing a failure if there are
# non-whitelisted warnings.
import errno
import re
import os
import sys
@@ -93,12 +94,20 @@ def run_gcc():
compiler = sys.argv[0]
proc = subprocess.Popen(args, stderr=subprocess.PIPE)
for line in proc.stderr:
print line,
interpret_warning(line)
try:
proc = subprocess.Popen(args, stderr=subprocess.PIPE)
for line in proc.stderr:
print line,
interpret_warning(line)
result = proc.wait()
result = proc.wait()
except OSError as e:
result = e.errno
if result == errno.ENOENT:
print args[0] + ':',e.strerror
print 'Is your PATH set correctly?'
else:
print ' '.join(args), str(e)
return result