diff options
Diffstat (limited to 'tools/buildman/builderthread.py')
-rw-r--r-- | tools/buildman/builderthread.py | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py index 8214662..a9cf68a 100644 --- a/tools/buildman/builderthread.py +++ b/tools/buildman/builderthread.py @@ -12,14 +12,17 @@ import threading 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 @@ -138,16 +141,17 @@ class BuilderThread(threading.Thread): 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 @@ -177,6 +181,7 @@ class BuilderThread(threading.Thread): 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 @@ -189,6 +194,7 @@ class BuilderThread(threading.Thread): 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') @@ -209,7 +215,7 @@ class BuilderThread(threading.Thread): 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 |