summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbst-marge-bot <marge-bot@buildstream.build>2019-10-08 16:33:51 +0000
committerbst-marge-bot <marge-bot@buildstream.build>2019-10-08 16:33:51 +0000
commit31b23110443365e1608fd45c3c7242ce4e8b1060 (patch)
tree55394906f333e61e286fc20e207bd20f19c927dc
parent97cd51d6d018c43d32ca433f0bcad7cf0dd77ca0 (diff)
parent3d9458605ca87a87c9170d80cee4fecac19a0a67 (diff)
downloadbuildstream-31b23110443365e1608fd45c3c7242ce4e8b1060.tar.gz
Merge branch 'traveltissues/1159' into 'master'
Defer workspace source commits Closes #1159 See merge request BuildStream/buildstream!1628
-rw-r--r--src/buildstream/plugins/sources/workspace.py13
-rw-r--r--src/buildstream/source.py6
-rw-r--r--tests/integration/shell.py1
3 files changed, 10 insertions, 10 deletions
diff --git a/src/buildstream/plugins/sources/workspace.py b/src/buildstream/plugins/sources/workspace.py
index ee145babb..0e7797fe8 100644
--- a/src/buildstream/plugins/sources/workspace.py
+++ b/src/buildstream/plugins/sources/workspace.py
@@ -89,10 +89,10 @@ class WorkspaceSource(Source):
pass # pragma: nocover
def get_unique_key(self) -> (str, SourceRef):
- sourcecache = self._get_context().sourcecache
+ cas = self._get_context().get_cascache()
if self.__cas_dir is None:
- self.__cas_dir = CasBasedDirectory(sourcecache.cas)
+ self.__cas_dir = CasBasedDirectory(cas)
if self.__digest is None:
@@ -103,14 +103,9 @@ class WorkspaceSource(Source):
"Failed to stage source: files clash with existing directory",
reason='ensure-stage-dir-fail')
self.__digest = self.__cas_dir._get_digest().hash
-
- # commit to cache if not cached
- if not sourcecache.contains(self):
- sourcecache.commit(self, [])
-
# now close down grpc channels
- sourcecache.cas.close_channel()
- assert not sourcecache.cas.has_open_grpc_channels()
+ cas.close_channel()
+ assert not cas.has_open_grpc_channels()
return (self.path, self.__digest)
def init_workspace(self, directory: Directory) -> None:
diff --git a/src/buildstream/source.py b/src/buildstream/source.py
index cea68d57e..f4b682616 100644
--- a/src/buildstream/source.py
+++ b/src/buildstream/source.py
@@ -1082,6 +1082,12 @@ class Source(Plugin):
self.__key = generate_key(keys)
+ sourcecache = self._get_context().sourcecache
+ if self.get_kind() == 'workspace' and not sourcecache.contains(self):
+ sourcecache.commit(self, [])
+ sourcecache.cas.close_channel()
+ assert not sourcecache.cas.has_open_grpc_channels()
+
@property
def _key(self):
return self.__key
diff --git a/tests/integration/shell.py b/tests/integration/shell.py
index 50d7f0858..b0de76ef5 100644
--- a/tests/integration/shell.py
+++ b/tests/integration/shell.py
@@ -295,7 +295,6 @@ def test_cli_mount(cli, datafiles, path):
# Test that we can see the workspace files in a shell
@pytest.mark.datafiles(DATA_DIR)
@pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox')
-@pytest.mark.xfail(strict=True)
def test_workspace_visible(cli, datafiles):
project = str(datafiles)
workspace = os.path.join(cli.directory, 'workspace')