buildroot: run everything with osbuild-run
`osbuild-run` sets up the build root so that programs can be run correctly in it. It should be run for all programs, not just stages and assemblers (even though they're the only consumers right now). Also, conceptually, `osbuild-run` belongs to the build root. We'll change its implementation based on the build root in a future commit. The buildroot already sets up `/run/osbuild/api`. It makes sense to have it manage libdir as well. A nice side benefit of this is a simplification of the Stage and Assembler classes, which grew quite complex and contained duplicate code.
This commit is contained in:
parent
8c02636bae
commit
616e1ecbba
2 changed files with 10 additions and 12 deletions
|
|
@ -13,11 +13,12 @@ __all__ = [
|
|||
|
||||
|
||||
class BuildRoot:
|
||||
def __init__(self, root, path="/run/osbuild"):
|
||||
def __init__(self, root, path="/run/osbuild", libdir=None):
|
||||
self.root = tempfile.mkdtemp(prefix="osbuild-buildroot-", dir=path)
|
||||
self.api = tempfile.mkdtemp(prefix="osbuild-api-", dir=path)
|
||||
self.var = tempfile.mkdtemp(prefix="osbuild-var-", dir="/var/tmp")
|
||||
self.mounts = []
|
||||
self.libdir = libdir or "/usr/lib/osbuild"
|
||||
|
||||
self.mount_root(root)
|
||||
self.mount_var()
|
||||
|
|
@ -78,8 +79,10 @@ class BuildRoot:
|
|||
"--link-journal=no",
|
||||
"--property=DeviceAllow=block-loop rw",
|
||||
f"--directory={self.root}",
|
||||
f"--bind-ro={self.libdir}:/run/osbuild/lib",
|
||||
*[f"--bind={b}" for b in (binds or [])],
|
||||
*[f"--bind-ro={b}" for b in [f"{self.api}:/run/osbuild/api"] + (readonly_binds or [])],
|
||||
f"/run/osbuild/lib/osbuild-run"
|
||||
] + argv, check=check, **kwargs)
|
||||
|
||||
@contextlib.contextmanager
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue