craft_parts.overlays.chroot module

Execute a callable in a chroot environment.

craft_parts.overlays.chroot.chroot(path, target, *args, use_host_sources=False, **kwargs)

Execute a callable in a chroot environment.

Parameters:
  • path (Path) – The new filesystem root.

  • target (Callable[..., TypeVar(_T)]) – The callable to run in the chroot environment.

  • args (Any) – Arguments for target.

  • kwargs (Any) – Keyword arguments for target.

  • use_host_sources (bool) – Whether overlay steps should also include the repository sources defined on the host.

Return type:

TypeVar(_T)

Returns:

The target function return value.