osbuild: auto-detect best available runner

Use the new `Index.detect_runner` method that will give us the best
available runner for a requested one. To do so a new `pipeline.Runner`
class is introduced that stores the `meta.RunnerInfo` class for the
specific runner and the original name that was requested.
In the manifest loading and describing functions of the formats, use
`Index.detect_runner` to get the `RunnerInfo` for a requested runner
and then wrap it in a `pipeline.Runner` object, which is then passed
to the `Manifest.add_pipeline` method.
See also commit "meta: ability to auto-detect runner".
Adjust all test.
This commit is contained in:
Christian Kellner 2022-10-01 11:11:07 +02:00
parent 0554ac652b
commit 5bdc8d030c
8 changed files with 71 additions and 43 deletions

View file

@ -145,7 +145,7 @@ class Stage:
def run(self, tree, runner, build_tree, store, monitor, libdir, timeout=None):
with contextlib.ExitStack() as cm:
build_root = buildroot.BuildRoot(build_tree, runner, libdir, store.tmp)
build_root = buildroot.BuildRoot(build_tree, runner.path, libdir, store.tmp)
cm.enter_context(build_root)
# if we have a build root, then also bind-mount the boot
@ -239,8 +239,22 @@ class Stage:
return BuildResult(self, r.returncode, r.output, api.metadata, api.error)
class Runner:
def __init__(self, info, name: Optional[str] = None) -> None:
self.info = info # `meta.RunnerInfo`
self.name = name or os.path.basename(info.path)
@property
def path(self):
return self.info.path
@property
def exec(self):
return os.path.basename(self.info.path)
class Pipeline:
def __init__(self, name: str, runner=None, build=None, source_epoch=None):
def __init__(self, name: str, runner: Runner, build=None, source_epoch=None):
self.name = name
self.build = build
self.runner = runner