aboutsummaryrefslogtreecommitdiff
path: root/tools/buildman/builderthread.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-07-19 17:49:24 -0600
committerSimon Glass <sjg@chromium.org>2023-07-24 09:34:11 -0600
commit5e5044b04c88c7889303ac1e8e9b48d17af903e2 (patch)
tree7d922a1503107ffbc1939e6a954f2f0c45a5adce /tools/buildman/builderthread.py
parent335c1b9f8193daae8ba5af2ccefbb0a6057fa5ec (diff)
downloadu-boot-5e5044b04c88c7889303ac1e8e9b48d17af903e2.zip
u-boot-5e5044b04c88c7889303ac1e8e9b48d17af903e2.tar.gz
u-boot-5e5044b04c88c7889303ac1e8e9b48d17af903e2.tar.bz2
buildman: Avoid passing result into _read_done_file()
Move the creating of the result object into the function which sets it up, to simplify the code. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/buildman/builderthread.py')
-rw-r--r--tools/buildman/builderthread.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py
index aa4a9d9..d391239 100644
--- a/tools/buildman/builderthread.py
+++ b/tools/buildman/builderthread.py
@@ -262,21 +262,26 @@ class BuilderThread(threading.Thread):
result.return_code = 0
return result
- def _read_done_file(self, commit_upto, brd, result, force_build,
+ def _read_done_file(self, commit_upto, brd, force_build,
force_build_failures):
"""Check the 'done' file and see if this commit should be built
Args:
commit (Commit): Commit only being built
brd (Board): Board being built
- result (CommandResult): result object to update
force_build (bool): Force a build even if one was previously done
force_build_failures (bool): Force a bulid if the previous result
showed failure
Returns:
- bool: True if build should be built
+ tuple:
+ bool: True if build should be built
+ CommandResult: if there was a previous run:
+ - already_done set to True
+ - return_code set to return code
+ - result.stderr set to 'bad' if stderr output was recorded
"""
+ result = command.CommandResult()
done_file = self.builder.get_done_file(commit_upto, brd.target)
result.already_done = os.path.exists(done_file)
will_build = (force_build or force_build_failures or
@@ -300,7 +305,7 @@ class BuilderThread(threading.Thread):
elif not force_build:
# The build passed, so no need to build it again
will_build = False
- return will_build
+ return will_build, result
def _decide_dirs(self, brd, work_dir, work_in_output):
"""Decide the output directory to use
@@ -438,13 +443,11 @@ class BuilderThread(threading.Thread):
"""
# Create a default result - it will be overwritte by the call to
# self.make() below, in the event that we do a build.
- result = command.CommandResult()
- result.return_code = 0
out_dir, out_rel_dir = self._decide_dirs(brd, work_dir, work_in_output)
# Check if the job was already completed last time
- will_build = self._read_done_file(commit_upto, brd, result, force_build,
- force_build_failures)
+ will_build, result = self._read_done_file(commit_upto, brd, force_build,
+ force_build_failures)
if will_build:
# We are going to have to build it. First, get a toolchain