U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Leonard Anderweit <l.anderweit@phytec.de>
To: <u-boot@lists.denx.de>
Cc: Simon Glass <sjg@chromium.org>,
	Alper Nebi Yasak <alpernebiyasak@gmail.com>,
	Tom Rini <trini@konsulko.com>,
	Leonard Anderweit <l.anderweit@phytec.de>,
	Marek Vasut <marex@denx.de>, Tim Harvey <tharvey@gateworks.com>,
	<upstream@lists.phytec.de>
Subject: [PATCH v2 1/3] binman: build_from_git: Add argument specifying branch
Date: Wed, 26 Feb 2025 22:04:59 +0100	[thread overview]
Message-ID: <20250226210501.72794-1-l.anderweit@phytec.de> (raw)

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>
---
 tools/binman/bintool.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tools/binman/bintool.py b/tools/binman/bintool.py
index 3c4ad1adbb9e..7280ee4f8cd9 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()}',
-- 
2.34.1


             reply	other threads:[~2025-02-26 21:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-26 21:04 Leonard Anderweit [this message]
2025-02-26 21:05 ` [PATCH v2 2/3] binman: build_from_git: Add optional make path inside git repo Leonard Anderweit
2025-03-05 14:15   ` Simon Glass
2025-02-26 21:05 ` [PATCH v2 3/3] binman: cst: Build from source Leonard Anderweit
2025-03-05 14:15   ` Simon Glass
2025-03-05 14:15 ` [PATCH v2 1/3] binman: build_from_git: Add argument specifying branch Simon Glass
2025-03-12 19:43 ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250226210501.72794-1-l.anderweit@phytec.de \
    --to=l.anderweit@phytec.de \
    --cc=alpernebiyasak@gmail.com \
    --cc=marex@denx.de \
    --cc=sjg@chromium.org \
    --cc=tharvey@gateworks.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=upstream@lists.phytec.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox