diff options
author | Leonard Anderweit <l.anderweit@phytec.de> | 2025-02-26 22:04:59 +0100 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2025-03-12 10:25:25 -0600 |
commit | 5f2096d2bc58ac265110777d08673a0e4b27cd84 (patch) | |
tree | 01024007cbf354767bf946328a6b48bfb0332c8d | |
parent | 57bbc4de75f6f6eb066462c777bf18cb8b8d4631 (diff) |
binman: build_from_git: Add argument specifying branch
Add optional argument git_branch to build_from_git. The new argument
allows specifying which branch of the repo to use.
Signed-off-by: Leonard Anderweit <l.anderweit@phytec.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r-- | tools/binman/bintool.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/binman/bintool.py b/tools/binman/bintool.py index 3c4ad1adbb9..7280ee4f8cd 100644 --- a/tools/binman/bintool.py +++ b/tools/binman/bintool.py @@ -328,7 +328,8 @@ class Bintool: return result.stdout @classmethod - def build_from_git(cls, git_repo, make_targets, bintool_path, flags=None): + def build_from_git(cls, git_repo, make_targets, bintool_path, + flags=None, git_branch=None): """Build a bintool from a git repo This clones the repo in a temporary directory, builds it with 'make', @@ -341,6 +342,7 @@ class Bintool: bintool_path (str): Relative path of the tool in the repo, after build is complete flags (list of str): Flags or variables to pass to make, or None + git_branch (str): Branch of git repo, or None to use the default Returns: tuple: @@ -350,7 +352,11 @@ class Bintool: """ tmpdir = tempfile.mkdtemp(prefix='binmanf.') print(f"- clone git repo '{git_repo}' to '{tmpdir}'") - tools.run('git', 'clone', '--depth', '1', git_repo, tmpdir) + if git_branch: + tools.run('git', 'clone', '--depth', '1', '--branch', git_branch, + git_repo, tmpdir) + else: + tools.run('git', 'clone', '--depth', '1', git_repo, tmpdir) for target in make_targets: print(f"- build target '{target}'") cmd = ['make', '-C', tmpdir, '-j', f'{multiprocessing.cpu_count()}', |