import command
import gitutil
+RETURN_CODE_RETRY = -1
+
def Mkdir(dirname, parents = False):
"""Make a directory if it doesn't already exist.
# Get the return code from that build and use it
with open(done_file, 'r') as fd:
result.return_code = int(fd.readline())
- if will_build:
+
+ # Check the signal that the build needs to be retried
+ if result.return_code == RETURN_CODE_RETRY:
+ will_build = True
+ elif will_build:
err_file = self.builder.GetErrFile(commit_upto, brd.target)
if os.path.exists(err_file) and os.stat(err_file).st_size:
result.stderr = 'bad'
commit = 'current'
# Set up the environment and command line
- env = self.toolchain.MakeEnvironment()
+ env = self.toolchain.MakeEnvironment(self.builder.full_path)
Mkdir(out_dir)
args = []
cwd = work_dir
src_dir = os.getcwd()
else:
args.append('O=build')
- args.append('-s')
+ if not self.builder.verbose_build:
+ args.append('-s')
if self.builder.num_jobs is not None:
args.extend(['-j', str(self.builder.num_jobs)])
config_args = ['%s_defconfig' % brd.target]
if do_config:
result = self.Make(commit, brd, 'mrproper', cwd,
'mrproper', *args, env=env)
+ config_out = result.combined
result = self.Make(commit, brd, 'config', cwd,
*(args + config_args), env=env)
- config_out = result.combined
+ config_out += result.combined
do_config = False # No need to configure next time
if result.return_code == 0:
result = self.Make(commit, brd, 'build', cwd, *args,
env=env)
result.stderr = result.stderr.replace(src_dir + '/', '')
+ if self.builder.verbose_build:
+ result.stdout = config_out + result.stdout
else:
result.return_code = 1
result.stderr = 'No tool chain for %s\n' % brd.arch
if result.return_code < 0:
return
- # Aborted?
- if result.stderr and 'No child processes' in result.stderr:
- return
+ # If we think this might have been aborted with Ctrl-C, record the
+ # failure but not that we are 'done' with this board. A retry may fix
+ # it.
+ maybe_aborted = result.stderr and 'No child processes' in result.stderr
if result.already_done:
return
done_file = self.builder.GetDoneFile(result.commit_upto,
result.brd.target)
with open(done_file, 'w') as fd:
- fd.write('%s' % result.return_code)
+ if maybe_aborted:
+ # Special code to indicate we need to retry
+ fd.write('%s' % RETURN_CODE_RETRY)
+ else:
+ fd.write('%s' % result.return_code)
with open(os.path.join(build_dir, 'toolchain'), 'w') as fd:
print >>fd, 'gcc', result.toolchain.gcc
print >>fd, 'path', result.toolchain.path
print >>fd, 'path', result.toolchain.path
# Write out the image and function size information and an objdump
- env = result.toolchain.MakeEnvironment()
+ env = result.toolchain.MakeEnvironment(self.builder.full_path)
lines = []
for fname in ['u-boot', 'spl/u-boot-spl']:
cmd = ['%snm' % self.toolchain.cross, '--size-sort', fname]