summaryrefslogtreecommitdiff
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
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.
-rw-r--r--src/buildstream/element.py36
-rw-r--r--src/buildstream/plugins/sources/workspace.py13
2 files changed, 13 insertions, 36 deletions
diff --git a/src/buildstream/element.py b/src/buildstream/element.py
index 8eea54c81..5927c8533 100644
--- a/src/buildstream/element.py
+++ b/src/buildstream/element.py
@@ -1218,14 +1218,6 @@ class Element(Plugin):
# (bool): True if cache can be queried
#
def _can_query_cache(self):
- # If build has already been scheduled, we know that the element is
- # not cached and thus can allow cache query even if the strict cache key
- # is not available yet.
- # This special case is required for workspaced elements to prevent
- # them from getting blocked in the pull queue.
- if self.__assemble_scheduled:
- return True
-
# cache cannot be queried until strict cache key is available
return self.__strict_cache_key is not None
@@ -1589,15 +1581,7 @@ class Element(Plugin):
for dep in self.dependencies(Scope.BUILD, recurse=False):
dep._set_required()
- self._set_required()
-
- # Invalidate workspace key as the build modifies the workspace directory
- workspace = self._get_workspace()
- if workspace:
- workspace.invalidate_key()
-
self._update_state()
-
return True
# _assemble_done():
@@ -2418,23 +2402,11 @@ class Element(Plugin):
return
self.__consistency = Consistency.CACHED
- workspace = self._get_workspace()
- # Special case for workspaces
- if workspace:
-
- # A workspace is considered inconsistent in the case
- # that its directory went missing
- #
- fullpath = workspace.get_absolute_path()
- if not os.path.exists(fullpath):
- self.__consistency = Consistency.INCONSISTENT
- else:
-
- # Determine overall consistency of the element
- for source in self.__sources:
- source._update_state()
- self.__consistency = min(self.__consistency, source._get_consistency())
+ # Determine overall consistency of the element
+ for source in self.__sources:
+ source._update_state()
+ self.__consistency = min(self.__consistency, source._get_consistency())
# __can_build_incrementally()
#
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