bind osbuild module from dynamically discovered path
This commit is contained in:
parent
831459e9e9
commit
27cf84edd5
2 changed files with 14 additions and 5 deletions
4
Makefile
4
Makefile
|
|
@ -10,13 +10,13 @@ sdist:
|
||||||
tarball:
|
tarball:
|
||||||
git archive --prefix=osbuild-$(VERSION)/ --format=tar.gz HEAD > $(VERSION).tar.gz
|
git archive --prefix=osbuild-$(VERSION)/ --format=tar.gz HEAD > $(VERSION).tar.gz
|
||||||
|
|
||||||
srpm: $(PACKAGE_NAME).spec tarball
|
srpm: $(PACKAGE_NAME).spec check-working-directory tarball
|
||||||
/usr/bin/rpmbuild -bs \
|
/usr/bin/rpmbuild -bs \
|
||||||
--define "_sourcedir $(CURDIR)" \
|
--define "_sourcedir $(CURDIR)" \
|
||||||
--define "_srcrpmdir $(CURDIR)" \
|
--define "_srcrpmdir $(CURDIR)" \
|
||||||
$(PACKAGE_NAME).spec
|
$(PACKAGE_NAME).spec
|
||||||
|
|
||||||
rpm: $(PACKAGE_NAME).spec tarball
|
rpm: $(PACKAGE_NAME).spec check-working-directory tarball
|
||||||
- rm -r "`pwd`/output"
|
- rm -r "`pwd`/output"
|
||||||
mkdir -p "`pwd`/output"
|
mkdir -p "`pwd`/output"
|
||||||
mkdir -p "`pwd`/rpmbuild"
|
mkdir -p "`pwd`/rpmbuild"
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
|
|
||||||
import contextlib
|
import contextlib
|
||||||
import hashlib
|
import hashlib
|
||||||
|
import importlib
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
from . import buildroot
|
from . import buildroot
|
||||||
from . import objectstore
|
from . import objectstore
|
||||||
from . import remoteloop
|
from . import remoteloop
|
||||||
|
|
@ -125,14 +127,21 @@ class Assembler:
|
||||||
args["output_dir"] = "/run/osbuild/output"
|
args["output_dir"] = "/run/osbuild/output"
|
||||||
|
|
||||||
path = "/run/osbuild/lib"
|
path = "/run/osbuild/lib"
|
||||||
|
osbuild_module_path = os.path.dirname(importlib.util.find_spec('osbuild').origin)
|
||||||
|
ro_binds = [f"{tree}:/run/osbuild/tree"]
|
||||||
|
if libdir:
|
||||||
|
ro_binds += [f"{libdir}:{path}"]
|
||||||
|
else:
|
||||||
|
# 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 += [f"/usr/lib/osbuild:{path}", f"{osbuild_module_path}:{path}/assemblers/osbuild"]
|
||||||
with build_root.bound_socket("remoteloop") as sock, \
|
with build_root.bound_socket("remoteloop") as sock, \
|
||||||
remoteloop.LoopServer(sock):
|
remoteloop.LoopServer(sock):
|
||||||
r = build_root.run(
|
r = build_root.run(
|
||||||
[f"{path}/osbuild-run", f"{path}/assemblers/{self.name}"],
|
[f"{path}/osbuild-run", f"{path}/assemblers/{self.name}"],
|
||||||
binds=binds,
|
binds=binds,
|
||||||
readonly_binds=[f"{tree}:/run/osbuild/tree"] +
|
readonly_binds=ro_binds,
|
||||||
([f"{libdir}:{path}"] if libdir else [f"/usr/lib/osbuild:{path}",
|
|
||||||
f"/usr/lib/python3.7/site-packages/osbuild:{path}/assemblers/osbuild"]),
|
|
||||||
encoding="utf-8",
|
encoding="utf-8",
|
||||||
input=json.dumps(args),
|
input=json.dumps(args),
|
||||||
stdout=None if interactive else subprocess.PIPE,
|
stdout=None if interactive else subprocess.PIPE,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue