osuild.py/BuildRoot/getSystemResourceFromEtc: don't pass the whole assemble or stage object in
Only pass in the relevant array, making the type of the arguments
clearer and prepare to expoled the argumnets passed to run_{stage,assembler}.
Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
parent
5ca90dc052
commit
bfae7c3089
1 changed files with 5 additions and 4 deletions
|
|
@ -104,8 +104,7 @@ class BuildRoot:
|
||||||
"/run/osbuild/osbuild-run",
|
"/run/osbuild/osbuild-run",
|
||||||
] + argv, *args, **kwargs)
|
] + argv, *args, **kwargs)
|
||||||
|
|
||||||
def _get_system_resources_from_etc(self, stage_or_assembler):
|
def _get_system_resources_from_etc(self, resources):
|
||||||
resources = stage_or_assembler.get("systemResourcesFromEtc", [])
|
|
||||||
for r in resources:
|
for r in resources:
|
||||||
if not r.startswith("/etc"):
|
if not r.startswith("/etc"):
|
||||||
raise ValueError(f"{r} is not a resource in /etc/")
|
raise ValueError(f"{r} is not a resource in /etc/")
|
||||||
|
|
@ -115,13 +114,14 @@ class BuildRoot:
|
||||||
|
|
||||||
def run_stage(self, stage, tree, interactive=False):
|
def run_stage(self, stage, tree, interactive=False):
|
||||||
name = stage["name"]
|
name = stage["name"]
|
||||||
|
resources = stage.get("systemResourcesFromEtc", [])
|
||||||
args = {
|
args = {
|
||||||
"tree": "/run/osbuild/tree",
|
"tree": "/run/osbuild/tree",
|
||||||
"options": stage.get("options", {})
|
"options": stage.get("options", {})
|
||||||
}
|
}
|
||||||
|
|
||||||
robinds = [f"{libdir}/stages/{name}:/run/osbuild/{name}"]
|
robinds = [f"{libdir}/stages/{name}:/run/osbuild/{name}"]
|
||||||
robinds.extend(self._get_system_resources_from_etc(stage))
|
robinds.extend(self._get_system_resources_from_etc(resources))
|
||||||
|
|
||||||
binds = [f"{tree}:/run/osbuild/tree", "/dev:/dev"]
|
binds = [f"{tree}:/run/osbuild/tree", "/dev:/dev"]
|
||||||
|
|
||||||
|
|
@ -147,6 +147,7 @@ class BuildRoot:
|
||||||
os.makedirs(output_dir)
|
os.makedirs(output_dir)
|
||||||
|
|
||||||
name = assembler["name"]
|
name = assembler["name"]
|
||||||
|
resources = assembler.get("systemResourcesFromEtc", [])
|
||||||
args = {
|
args = {
|
||||||
"tree": "/run/osbuild/tree",
|
"tree": "/run/osbuild/tree",
|
||||||
"options": assembler.get("options", {}),
|
"options": assembler.get("options", {}),
|
||||||
|
|
@ -155,7 +156,7 @@ class BuildRoot:
|
||||||
f"{tree}:/run/osbuild/tree",
|
f"{tree}:/run/osbuild/tree",
|
||||||
f"{libdir}/assemblers/{name}:/run/osbuild/{name}"
|
f"{libdir}/assemblers/{name}:/run/osbuild/{name}"
|
||||||
]
|
]
|
||||||
robinds.extend(self._get_system_resources_from_etc(assembler))
|
robinds.extend(self._get_system_resources_from_etc(resource))
|
||||||
binds = ["/dev:/dev"]
|
binds = ["/dev:/dev"]
|
||||||
|
|
||||||
if output_dir:
|
if output_dir:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue