Skip to content

Commit

Permalink
[cli/commands/build] Allow explicit passthrough for config.plist patches
Browse files Browse the repository at this point in the history
Prevents unnecessary invocations of the patch command by allowing patches to be specified during build.
  • Loading branch information
Qonfused committed Feb 8, 2024
1 parent 2981659 commit f9b78b8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions ocebuild_cli/commands/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@ def update_config_entries(build_dir: Union[str, Path],
@click.option("-o", "--out",
type=click.Path(path_type=Path),
help="Use the specified directory as the output directory.")
@click.option("-p", "--patches",
type=click.Path(path_type=Path),
multiple=True,
help="A list of paths to configuration patches.")
@click.option("--clean",
is_flag=True,
help="Clean the output directory before building.")
Expand All @@ -211,7 +215,7 @@ def update_config_entries(build_dir: Union[str, Path],
@click.option("--force",
is_flag=True,
help="Force the build even if the lockfile is up to date.")
def cli(env, cwd, out, clean, update, force):
def cli(env, cwd, out, patches, clean, update, force):
"""Builds the project's OpenCore EFI directory."""

if not cwd: cwd = getcwd()
Expand Down Expand Up @@ -282,7 +286,7 @@ def cli(env, cwd, out, clean, update, force):

# Apply patches to config.plist
from .patch import apply_patches #pylint: disable=import-outside-toplevel
config = apply_patches(out=BUILD_DIR,
config = apply_patches(PROJECT_DIR, BUILD_DIR, *patches,
config_plist=config_plist,
project_root=PROJECT_DIR,
flags=flags)
Expand Down
4 changes: 3 additions & 1 deletion ocebuild_cli/commands/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,13 @@ def apply_patches(cwd: Union[str, Path]='.',
if not patches:
patches = set(glob(project_root, '**/config*.yml', include='**/config*.yaml'))
patches |= set(glob(project_root, '**/patch*.yml', include='**/patch*.yaml'))
patches |= set(glob(project_root, '**/.serialdata'))
debug(f"Found {len(patches)} patch files")
elif cwd:
patches = set(Path(cwd, patch).resolve(strict=True) for patch in patches)

# Append serial data patches to the list of applicable patches
patches |= set(glob(project_root, '**/.serialdata'))

# Apply patches and schema fallbacks to the config.plist
try:
with Progress() as progress:
Expand Down

0 comments on commit f9b78b8

Please sign in to comment.