From systemd-nspawn v250 onwards, it's possible to run build scripts
on non-native architectures (as long as binfmt.d is configured correctly)
so update the native check to consider that.
nspawn_executable,
nspawn_params_for_blockdev_access,
nspawn_rlimit_params,
+ nspawn_version,
patch_file,
path_relative_to_cwd,
run,
def check_native(args: MkosiArgs) -> None:
- if args.architecture is not None and args.architecture != platform.machine() and args.build_script:
+ if args.architecture is not None and args.architecture != platform.machine() and args.build_script and nspawn_version() < 250:
die("Cannot (currently) override the architecture and run build commands")
return os.getenv("MKOSI_NSPAWN_EXECUTABLE", "systemd-nspawn")
+def nspawn_version() -> int:
+ return int(run([nspawn_executable(), "--version"], stdout=subprocess.PIPE).stdout.strip().split()[1])
+
+
def run_workspace_command(
args: MkosiArgs,
root: Path,