summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-07-20 02:49:22 +0300
committerSimon Glass <sjg@chromium.org>2023-07-24 18:34:11 +0300
commitad7181c797094e0ffb6ed2358d92e7c06f9e3e39 (patch)
tree4246ece5c52620a840856b7bbc4448f03caf2a01
parent9bdf02389c0de34de681cc0b002004887247d0cc (diff)
downloadu-boot-ad7181c797094e0ffb6ed2358d92e7c06f9e3e39.tar.xz
buildman: Move checkout code to a separate function
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.py30
1 files changed, 21 insertions, 9 deletions
diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py
index 78405956ef..0c73b8646b 100644
--- a/tools/buildman/builderthread.py
+++ b/tools/buildman/builderthread.py
@@ -326,6 +326,26 @@ class BuilderThread(threading.Thread):
out_dir = os.path.join(work_dir, out_rel_dir)
return out_dir, out_rel_dir
+ def _checkout(self, commit_upto, work_dir):
+ """Checkout the right commit
+
+ Args:
+ commit_upto (int): Commit number to build (0...n-1)
+ work_dir (str): Directory to which the source will be checked out
+
+ Returns:
+ Commit: Commit being built, or 'current' for current source
+ """
+ if self.builder.commits:
+ commit = self.builder.commits[commit_upto]
+ if self.builder.checkout:
+ git_dir = os.path.join(work_dir, '.git')
+ gitutil.checkout(commit.hash, git_dir, work_dir, force=True)
+ else:
+ commit = 'current'
+ return commit
+
+
def run_commit(self, commit_upto, brd, work_dir, do_config, config_only,
force_build, force_build_failures, work_in_output,
adjust_cfg):
@@ -381,15 +401,7 @@ class BuilderThread(threading.Thread):
# to be reported.
if self.toolchain:
- # Checkout the right commit
- if self.builder.commits:
- commit = self.builder.commits[commit_upto]
- if self.builder.checkout:
- git_dir = os.path.join(work_dir, '.git')
- gitutil.checkout(commit.hash, git_dir, work_dir,
- force=True)
- else:
- commit = 'current'
+ commit = self._checkout(commit_upto, work_dir)
# Set up the environment and command line
env = self.toolchain.MakeEnvironment(self.builder.full_path)