import command
import gitutil
-def Mkdir(dirname):
+def Mkdir(dirname, parents = False):
"""Make a directory if it doesn't already exist.
Args:
dirname: Directory to create
"""
try:
- os.mkdir(dirname)
+ if parents:
+ os.makedirs(dirname)
+ else:
+ os.mkdir(dirname)
except OSError as err:
if err.errno == errno.EEXIST:
pass
result.already_done = os.path.exists(done_file)
will_build = (force_build or force_build_failures or
not result.already_done)
- if result.already_done and will_build:
+ if result.already_done:
# Get the return code from that build and use it
with open(done_file, 'r') as fd:
result.return_code = int(fd.readline())
- 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'
- elif not force_build:
- # The build passed, so no need to build it again
- will_build = False
+ if 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'
+ elif not force_build:
+ # The build passed, so no need to build it again
+ will_build = False
if will_build:
# We are going to have to build it. First, get a toolchain
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.path.realpath(work_dir)
if not self.builder.in_tree:
if commit_upto is None:
# In this case we are building in the original source
work_dir = os.path.realpath(work_dir)
args.append('O=%s/build' % work_dir)
cwd = None
+ 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 result.return_code == 0:
result = self.Make(commit, brd, 'build', cwd, *args,
env=env)
- result.stdout = config_out + result.stdout
+ result.stderr = result.stderr.replace(src_dir + '/', '')
else:
result.return_code = 1
result.stderr = 'No tool chain for %s\n' % brd.arch
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]
# Now write the actual build output
if keep_outputs:
- patterns = ['u-boot', '*.bin', 'u-boot.dtb', '*.map',
+ patterns = ['u-boot', '*.bin', 'u-boot.dtb', '*.map', '*.img',
'include/autoconf.mk', 'spl/u-boot-spl',
'spl/u-boot-spl.bin']
for pattern in patterns: