nspawn_params = nspawn_params_for_build_sources(state.config, SourceFileTransfer.mount)
run_workspace_command(state, ["/root/prepare", verb],
- network=True, nspawn_params=nspawn_params, env=state.config.environment)
+ network=True, nspawn_params=nspawn_params, env=state.environment)
srcdir = root_home(state) / "src"
if srcdir.exists():
shutil.copy2(state.config.postinst_script, root_home(state) / "postinst")
run_workspace_command(state, ["/root/postinst", verb],
- network=(state.config.with_network is True), env=state.config.environment)
+ network=(state.config.with_network is True), env=state.environment)
root_home(state).joinpath("postinst").unlink()
with complete_step("Running finalize script…"):
run([state.config.finalize_script, verb],
- env={**state.config.environment, "BUILDROOT": str(state.root), "OUTPUTDIR": str(output_dir(state.config))})
-
+ env={**state.environment, "BUILDROOT": str(state.root), "OUTPUTDIR": str(output_dir(state.config))})
def install_boot_loader(
else:
args.environment = {}
+ if args.image_id is not None:
+ args.environment['IMAGE_ID'] = args.image_id
+ if args.image_version is not None:
+ args.environment['IMAGE_VERSION'] = args.image_version
+
if args.cache_path is not None:
args.cache_path = args.cache_path.absolute()
f"--setenv=MKOSI_DEFAULT={state.config.config_path}"
]
- if state.config.image_version is not None:
- cmdline += [f"--setenv=IMAGE_VERSION={state.config.image_version}"]
-
- if state.config.image_id is not None:
- cmdline += [f"--setenv=IMAGE_ID={state.config.image_id}"]
-
cmdline += nspawn_params_for_build_sources(state.config, state.config.source_file_transfer)
if state.config.build_dir is not None:
if state.config.nspawn_keep_unit:
cmdline += ["--keep-unit"]
- cmdline += [f"--setenv={env}={value}" for env, value in state.config.environment.items()]
+ cmdline += [f"--setenv={env}={value}" for env, value in state.environment.items()]
cmdline += [f"/root/{state.config.build_script.name}"]
workspace=Path(workspace.name),
cache=cache,
do_run_build_script=False,
+ environment=config.environment,
machine_id=config.machine_id or uuid.uuid4().hex,
for_cache=False,
)
skeleton_trees: List[Path]
clean_package_metadata: Union[bool, str]
remove_files: List[Path]
+ # Environment should not be used directly. Use MkosiState environment instead.
environment: Dict[str, str]
build_sources: Optional[Path]
build_dir: Optional[Path]
do_run_build_script: bool
machine_id: str
for_cache: bool
+ environment: Dict[str, str]
cache_pre_inst: Optional[Path] = None
cache_pre_dev: Optional[Path] = None