summaryrefslogtreecommitdiff
path: root/src/buildstream/plugins/sources
diff options
context:
space:
mode:
authorTristan Maat <tristan.maat@codethink.co.uk>2019-10-17 16:29:13 +0100
committerTristan Maat <tristan.maat@codethink.co.uk>2019-11-18 13:22:38 +0000
commit14146c2796fbf83afb8832bff67f4fa5be88c764 (patch)
treee73f7898201921e55b64b0533be840dc6f8d7240 /src/buildstream/plugins/sources
parent1514119c8287ab5583f26d4dc1b412f318f6adcf (diff)
downloadbuildstream-14146c2796fbf83afb8832bff67f4fa5be88c764.tar.gz
element.py: Remove workspace-specific code
This was previously used to handle unstable cache keys, but has been obsoleted by @traveltissues' recent improvements.
Diffstat (limited to 'src/buildstream/plugins/sources')
-rw-r--r--src/buildstream/plugins/sources/workspace.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/buildstream/plugins/sources/workspace.py b/src/buildstream/plugins/sources/workspace.py
index a845fd440..c7d16f685 100644
--- a/src/buildstream/plugins/sources/workspace.py
+++ b/src/buildstream/plugins/sources/workspace.py
@@ -35,6 +35,8 @@ workspace. The node constructed would be specified as follows:
path: /path/to/workspace
"""
+import os
+
from buildstream.storage.directory import Directory
from buildstream import Source, SourceError, Consistency
from buildstream.types import SourceRef
@@ -43,7 +45,6 @@ from buildstream.node import MappingNode
class WorkspaceSource(Source):
# pylint: disable=attribute-defined-outside-init
-
BST_STAGE_VIRTUAL_DIRECTORY = True
BST_KEY_REQUIRES_STAGE = True
@@ -81,9 +82,13 @@ class WorkspaceSource(Source):
def init_workspace(self, directory: Directory) -> None:
raise AssertionError("Attempting to re-open an existing workspace")
- def get_consistency(self):
- # always return cached state
- return Consistency.CACHED
+ def get_consistency(self) -> Consistency:
+ if not os.path.exists(self._get_local_path()):
+ # A workspace is considered inconsistent in the case that
+ # its directory went missing
+ return Consistency.INCONSISTENT
+ else:
+ return Consistency.CACHED
def fetch(self) -> None: # pylint: disable=arguments-differ
pass # pragma: nocover