From cf9c9946e04d3b0100e72ed67eb2380ce42e5ff1 Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Wed, 22 Jan 2020 14:17:00 +0100 Subject: [PATCH] pipeline: bind mount the osbuild module for the stages The dnf stage wants to import `osbuild.sources` but currently the osbuild module is not available in the stages. Apply the same hack done in the Assembler also in for the stages, i.e. bind mount the osbuild module to the stages/osbuild. --- osbuild/pipeline.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/osbuild/pipeline.py b/osbuild/pipeline.py index e92de270..ea53210f 100644 --- a/osbuild/pipeline.py +++ b/osbuild/pipeline.py @@ -80,11 +80,20 @@ class Stage: sources_dir = f"{libdir}/sources" if libdir else "/usr/lib/osbuild/sources" + ro_binds = [] + if not libdir: + osbuild_module_path = os.path.dirname(importlib.util.find_spec('osbuild').origin) + # This is a temporary workaround, once we have a common way to include osbuild in the + # buildroot we should remove this because it includes code from the host in the buildroot thus + # violating our effort of reproducibility. + ro_binds.append(f"{osbuild_module_path}:/run/osbuild/lib/stages/osbuild") + with API(f"{build_root.api}/osbuild", args, interactive) as api, \ sources.SourcesServer(f"{build_root.api}/sources", sources_dir, source_options, secrets): r = build_root.run( [f"/run/osbuild/lib/stages/{self.name}"], binds=[f"{tree}:/run/osbuild/tree"], + readonly_binds=ro_binds, stdin=subprocess.DEVNULL, ) res = BuildResult(self, r.returncode, api.output)