Skip to content

Commit

Permalink
Set PATH of buildbox-casd to include bundled buildbox-fuse
Browse files Browse the repository at this point in the history
Otherwise, buildbox-casd falls back to its HardLinkStager backend
which does not provide sufficient capabilities to build
gnome-build-meta.

See: #1733
  • Loading branch information
ssssam committed Aug 22, 2022
1 parent 6bb5952 commit c529c61
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/buildstream/_cas/casdprocessmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
from .._protos.build.buildgrid import local_cas_pb2_grpc
from .._protos.google.bytestream import bytestream_pb2_grpc

from .. import _site
from .. import utils
from .._exceptions import CASCacheError

Expand Down Expand Up @@ -103,12 +104,29 @@ def __init__(self, path, log_dir, log_level, cache_quota, remote_cache_spec, pro
# The frontend will take care of terminating buildbox-casd.
# Create a new process group for it such that SIGINT won't reach it.
self.process = subprocess.Popen( # pylint: disable=consider-using-with, subprocess-popen-preexec-fn
casd_args, cwd=path, stdout=logfile_fp, stderr=subprocess.STDOUT, preexec_fn=os.setpgrp
casd_args,
cwd=path,
stdout=logfile_fp,
stderr=subprocess.STDOUT,
preexec_fn=os.setpgrp,
env=self.__buildbox_casd_env(),
)

def __buildbox_casd(self):
return utils._get_host_tool_internal("buildbox-casd", search_subprojects_dir="buildbox")

def __buildbox_casd_env(self):
env = os.environ.copy()

# buildbox-casd needs to have buildbox-fuse in its PATH at runtime,
# otherwise it will fallback to the HardLinkStager backend.
bundled_buildbox_dir = os.path.join(_site.subprojects, "buildbox")
if os.path.exists(bundled_buildbox_dir):
path = env.get("PATH", "").split(os.pathsep)
path = [bundled_buildbox_dir] + path
env["PATH"] = os.pathsep.join(path)
return env

# _check_casd_version()
#
# Check for minimal acceptable version of buildbox-casd.
Expand Down

0 comments on commit c529c61

Please sign in to comment.