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 2/3] binman: build_from_git: Add optional make path inside git repo
Date: Wed, 26 Feb 2025 22:05:00 +0100 [thread overview]
Message-ID: <20250226210501.72794-2-l.anderweit@phytec.de> (raw)
In-Reply-To: <20250226210501.72794-1-l.anderweit@phytec.de>
Add optional argument make_path to build_from git. The new argument
allows specifying the path to a Makefile in case it is not in the root
of the git repo.
Also adjust the corresponding test.
Signed-off-by: Leonard Anderweit <l.anderweit@phytec.de>
---
v2: fix tests
---
tools/binman/bintool.py | 9 +++++++--
tools/binman/bintool_test.py | 1 +
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/tools/binman/bintool.py b/tools/binman/bintool.py
index 7280ee4f8cd9..81872db377f9 100644
--- a/tools/binman/bintool.py
+++ b/tools/binman/bintool.py
@@ -329,7 +329,7 @@ class Bintool:
@classmethod
def build_from_git(cls, git_repo, make_targets, bintool_path,
- flags=None, git_branch=None):
+ flags=None, git_branch=None, make_path=None):
"""Build a bintool from a git repo
This clones the repo in a temporary directory, builds it with 'make',
@@ -343,6 +343,8 @@ class Bintool:
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
+ make_path (str): Relative path inside git repo containing the
+ Makefile, or None
Returns:
tuple:
@@ -359,7 +361,10 @@ class Bintool:
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()}',
+ makedir = tmpdir
+ if make_path:
+ makedir = os.path.join(tmpdir, make_path)
+ cmd = ['make', '-C', makedir, '-j', f'{multiprocessing.cpu_count()}',
target]
if flags:
cmd += flags
diff --git a/tools/binman/bintool_test.py b/tools/binman/bintool_test.py
index f9b16d4c73b5..949d6f4c8a90 100644
--- a/tools/binman/bintool_test.py
+++ b/tools/binman/bintool_test.py
@@ -303,6 +303,7 @@ class TestBintool(unittest.TestCase):
# See Bintool.build_from_git()
tmpdir = cmd[2]
self.fname = os.path.join(tmpdir, 'pathname')
+ os.makedirs(os.path.dirname(tmpdir), exist_ok=True)
tools.write_file(self.fname, b'hello')
expected = b'this is a test'
--
2.34.1
next prev parent 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 [PATCH v2 1/3] binman: build_from_git: Add argument specifying branch Leonard Anderweit
2025-02-26 21:05 ` Leonard Anderweit [this message]
2025-03-05 14:15 ` [PATCH v2 2/3] binman: build_from_git: Add optional make path inside git repo 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-2-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