summaryrefslogtreecommitdiff
path: root/tools/buildman/builderthread.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2025-05-27 05:19:20 -0600
committerTom Rini <trini@konsulko.com>2025-07-01 10:49:32 -0600
commit9002ab0986fa51ed2dffcfb655b062ce026b194d (patch)
treead982ab48e33b8690ae947356a85008900a02b02 /tools/buildman/builderthread.py
parent506ceddffdc40acf709822b678b986e2e22c5056 (diff)
buildman: Correct behaviour of --in-tree
This option doesn't work as expected since it sets the cwd to the work directory, which does not necessarily hold the source code. It should be left unset, so that the current directory is the source directory. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/buildman/builderthread.py')
-rw-r--r--tools/buildman/builderthread.py38
1 files changed, 20 insertions, 18 deletions
diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py
index b4cb66397bb..4617f516f40 100644
--- a/tools/buildman/builderthread.py
+++ b/tools/buildman/builderthread.py
@@ -37,6 +37,8 @@ def mkdir(dirname, parents=False):
Raises:
OSError: File already exists
"""
+ if os.path.exists(dirname):
+ return
try:
if parents:
os.makedirs(dirname)
@@ -45,8 +47,8 @@ def mkdir(dirname, parents=False):
except OSError as err:
if err.errno == errno.EEXIST:
if os.path.realpath('.') == os.path.realpath(dirname):
- print(f"Cannot create the current working directory '{dirname}'!")
- sys.exit(1)
+ raise ValueError(
+ f"Cannot create the current working directory '{dirname}'!")
else:
raise
@@ -205,21 +207,20 @@ class BuilderThread(threading.Thread):
args = []
cwd = work_dir
src_dir = os.path.realpath(work_dir)
- if not self.builder.in_tree:
- if commit_upto is None:
- # In this case we are building in the original source directory
- # (i.e. the current directory where buildman is invoked. The
- # output directory is set to this thread's selected work
- # directory.
- #
- # Symlinks can confuse U-Boot's Makefile since we may use '..'
- # in our path, so remove them.
- real_dir = os.path.realpath(out_dir)
- args.append(f'O={real_dir}')
- cwd = None
- src_dir = os.getcwd()
- else:
- args.append(f'O={out_rel_dir}')
+ if commit_upto is None:
+ # In this case we are building in the original source directory
+ # (i.e. the current directory where buildman is invoked. The
+ # output directory is set to this thread's selected work
+ # directory.
+ #
+ # Symlinks can confuse U-Boot's Makefile since we may use '..'
+ # in our path, so remove them.
+ real_dir = os.path.realpath(out_dir)
+ args.append(f'O={real_dir}')
+ cwd = None
+ src_dir = os.getcwd()
+ elif out_rel_dir:
+ args.append(f'O={out_rel_dir}')
if self.builder.verbose_build:
args.append('V=1')
else:
@@ -409,7 +410,8 @@ class BuilderThread(threading.Thread):
"""
# Set up the environment and command line
env = self.builder.make_environment(self.toolchain)
- mkdir(out_dir)
+ if not os.path.exists(out_dir):
+ mkdir(out_dir)
args, cwd, src_dir = self._build_args(brd, out_dir, out_rel_dir,
work_dir, commit_upto)