Args:
commit_upto: Commit number to use (0..self.count-1)
target: Target name
+
+ Return:
+ str: Output directory to use, or '' if None
"""
output_dir = self.get_output_dir(commit_upto)
if self.work_in_output:
- return output_dir
+ return output_dir or ''
return os.path.join(output_dir, target)
def get_done_file(self, commit_upto, target):
"""
thread_dir = self.get_thread_dir(thread_num)
builderthread.mkdir(thread_dir)
- git_dir = os.path.join(thread_dir, '.git')
+ git_dir = os.path.join(thread_dir, '.git') if thread_dir else None
# Create a worktree or a git repo clone for this thread if it
# doesn't already exist
"""Make a directory if it doesn't already exist.
Args:
- dirname (str): Directory to create
+ dirname (str): Directory to create, or None to do nothing
parents (bool): True to also make parent directories
Raises:
OSError: File already exists
"""
- if os.path.exists(dirname):
+ if not dirname or os.path.exists(dirname):
return
try:
if parents:
"""Remove any old output-target files
Args:
- out_dir (str): Output directory for the build
+ out_dir (str): Output directory for the build, or None for current dir
Since we use a build directory that was previously used by another
board, it may have produced an SPL image. If we don't remove it (i.e.
output of this build, even if it does not produce SPL images.
"""
for elf in BASE_ELF_FILENAMES:
- fname = os.path.join(out_dir, elf)
+ fname = os.path.join(out_dir or '', elf)
if os.path.exists(fname):
os.remove(fname)
Args:
brd (Board): Board to create arguments for
- out_dir (str): Path to output directory containing the files
+ out_dir (str): Path to output directory containing the files, or
+ or None to not use a separate output directory
out_rel_dir (str): Output directory relative to the current dir
- work_dir (str): Directory to which the source will be checked out
+ work_dir (str): Directory to which the source will be checked out,
+ or None to use current directory
commit_upto (int): Commit number to build (0...n-1)
Returns:
"""
args = []
cwd = work_dir
- src_dir = os.path.realpath(work_dir)
+ src_dir = os.path.realpath(work_dir) if work_dir else os.getcwd()
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
#
# 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}')
+ if out_dir:
+ real_dir = os.path.realpath(out_dir)
+ args.append(f'O={real_dir}')
cwd = None
src_dir = os.getcwd()
elif out_rel_dir:
config_only (bool): Only configure the source, do not build it
adjust_cfg (list of str): See the cfgutil module and run_commit()
commit (Commit): Commit only being built
- out_dir (str): Output directory for the build
+ out_dir (str): Output directory for the build, or None to use
+ current
out_rel_dir (str): Output directory relatie to the current dir
result (CommandResult): Previous result
"""
# Set up the environment and command line
env = self.builder.make_environment(self.toolchain)
- if not os.path.exists(out_dir):
+ if out_dir and not os.path.exists(out_dir):
mkdir(out_dir)
args, cwd, src_dir = self._build_args(brd, out_dir, out_rel_dir,
_remove_old_outputs(out_dir)
# If we need to reconfigure, do that now
- cfg_file = os.path.join(out_dir, '.config')
+ cfg_file = os.path.join(out_dir or '', '.config')
cmd_list = []
if do_config or adjust_cfg:
result = self._reconfigure(
read it in.
Args:
- output_dir (str): Output directory to use
+ output_dir (str): Output directory to use, or None to use current dir
regen_board_list (bool): True to just regenerate the board list
maintainer_check (bool): True to just run a maintainer check
full_check (bool): True to just run a full check of Kconfig and
return 2
return 0
- if not os.path.exists(output_dir):
+ if output_dir and not os.path.exists(output_dir):
os.makedirs(output_dir)
- board_file = os.path.join(output_dir, 'boards.cfg')
+ board_file = os.path.join(output_dir or '', 'boards.cfg')
if regen_board_list and regen_board_list != '-':
board_file = regen_board_list
def setup_output_dir(output_dir, work_in_output, branch, no_subdirs, col,
- clean_dir):
+ in_tree, clean_dir):
"""Set up the output directory
Args:
work_in_output (bool): True to work in the output directory
branch (str): Name of branch to build, or None if none
no_subdirs (bool): True to put the output in the top-level output dir
+ in_tree (bool): True if doing an in-tree build
clean_dir: Used for tests only, indicates that the existing output_dir
should be removed before starting the build
str: Updated output directory pathname
"""
if not output_dir:
- if work_in_output:
- sys.exit(col.build(col.RED, '-w requires that you specify -o'))
output_dir = '..'
+ if work_in_output:
+ if not in_tree:
+ sys.exit(col.build(col.RED, '-w requires that you specify -o'))
+ output_dir = None
if branch and not no_subdirs:
# As a special case allow the board directory to be placed in the
# output directory itself rather than any subdirectory.
output_dir = setup_output_dir(
args.output_dir, args.work_in_output, args.branch,
- args.no_subdirs, col, clean_dir)
+ args.no_subdirs, col, args.in_tree, clean_dir)
# Work out what subset of the boards we are building
if not brds: