summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-07-20 02:49:20 +0300
committerSimon Glass <sjg@chromium.org>2023-07-24 18:34:11 +0300
commite5490b7f469183d5fbbc893073c5a0a3ca58d242 (patch)
tree5b29525ec93691736f5764ce84264ca1fbdd415e
parent4981bd3ddaf15149fee36170338e76e0090dd06b (diff)
downloadu-boot-e5490b7f469183d5fbbc893073c5a0a3ca58d242.tar.xz
buildman: Move code to remove old outputs
Put this in its own function to reduce the size of the run_commit() function. Signed-off-by: Simon Glass <sjg@chromium.org>
-rw-r--r--tools/buildman/builderthread.py28
1 files changed, 19 insertions, 9 deletions
diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py
index b4891059b6..4abad86ebc 100644
--- a/tools/buildman/builderthread.py
+++ b/tools/buildman/builderthread.py
@@ -42,6 +42,24 @@ def mkdir(dirname, parents = False):
else:
raise
+
+def _remove_old_outputs(out_dir):
+ """Remove any old output-target files
+
+ Args:
+ out_dir (str): Output directory for the build
+
+ Since we use a build directory that was previously used by another
+ board, it may have produced an SPL image. If we don't remove it (i.e.
+ see do_config and self.mrproper below) then it will appear to be the
+ output of this build, even if it does not produce SPL images.
+ """
+ for elf in BASE_ELF_FILENAMES:
+ fname = os.path.join(out_dir, elf)
+ if os.path.exists(fname):
+ os.remove(fname)
+
+
# pylint: disable=R0903
class BuilderJob:
"""Holds information about a job to be performed by a thread
@@ -366,15 +384,7 @@ class BuilderThread(threading.Thread):
config_args = [f'{brd.target}_defconfig']
config_out = io.StringIO()
- # Remove any output targets. Since we use a build directory that
- # was previously used by another board, it may have produced an
- # SPL image. If we don't remove it (i.e. see do_config and
- # self.mrproper below) then it will appear to be the output of
- # this build, even if it does not produce SPL images.
- for elf in BASE_ELF_FILENAMES:
- fname = os.path.join(out_dir, elf)
- if os.path.exists(fname):
- os.remove(fname)
+ _remove_old_outputs(out_dir)
# If we need to reconfigure, do that now
cfg_file = os.path.join(out_dir, '.config')