
2015-05-14 7:28 GMT+09:00 Joe Hershberger joe.hershberger@ni.com:
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@ni.com
Changes in v3: None 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 30dc4f6..d9ae859 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 @@ -276,6 +277,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.
@@ -290,19 +298,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
@@ -362,6 +376,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'],
@@ -378,6 +393,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:
@@ -395,6 +414,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 open('moveconfig.failed', 'r').read()
def main(): try: cpu_count = multiprocessing.cpu_count()
I could successfully convert all the defconfigs with my toolchains, but I thought this feature would be helpful.
I merged this feature in my new version with your signed-off-by although the implementation is a bit different.