stage: use path meta info to run the stage

Now that the `Stage` contains the `ModuleInfo`, which contains the
path the to executable, this can directly be used to execute the
stage. To do so, the path to the executable is bind-mounted to a
well known path inside the sandbox (`/run/osbuild/bin/$id`) and
this is then supplied to the build root as executable to run.
This commit is contained in:
Christian Kellner 2021-01-05 19:43:47 +01:00 committed by Tom Gundersen
parent 7a6c2df910
commit de021b468a

View file

@ -74,7 +74,10 @@ class Stage:
}
}
ro_binds = [f"{sources_output}:/run/osbuild/sources"]
ro_binds = [
f"{self.info.path}:/run/osbuild/bin/{self.name}",
f"{sources_output}:/run/osbuild/sources"
]
api = API(args, monitor)
build_root.register_api(api)
@ -85,7 +88,7 @@ class Stage:
sources_output)
build_root.register_api(src)
r = build_root.run([f"/run/osbuild/lib/stages/{self.name}"],
r = build_root.run([f"/run/osbuild/bin/{self.name}"],
monitor,
binds=[os.fspath(tree) + ":/run/osbuild/tree"],
readonly_binds=ro_binds)