def cache_params(state: MkosiState, root: Path) -> list[PathString]:
- return flatten(("--bind", state.config.cache_path, root / p) for p in state.installer.cache_path())
+ return flatten(("--bind", state.cache, root / p) for p in state.installer.cache_path())
def run_prepare_script(state: MkosiState, cached: bool) -> None:
MkosiPrinter.print_step(f"Resulting image size is {size}, consumes {space}.")
-def setup_package_cache(config: MkosiConfig, workspace: Path) -> Path:
- if not config.cache_path:
- cache = workspace / "cache"
- else:
- cache = config.cache_path
-
- return cache
-
-
def remove_duplicates(items: list[T]) -> list[T]:
"Return list with any repetitions removed"
# We use a dictionary to simulate an ordered set
def make_cache_dir(state: MkosiState) -> None:
"""Create the cache directory if set and not existing yet"""
- run(["mkdir", "-p", state.config.cache_path], user=state.uid, group=state.gid)
+ run(["mkdir", "-p", state.cache], user=state.uid, group=state.gid)
def make_install_dir(state: MkosiState) -> None:
def build_stuff(uid: int, gid: int, config: MkosiConfig) -> None:
workspace = setup_workspace(config)
workspace_dir = Path(workspace.name)
- cache = setup_package_cache(config, workspace_dir)
+ cache = config.cache_path or workspace_dir / "cache"
state = MkosiState(
uid=uid,