summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-09-04 14:57:23 -0400
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-09-04 14:59:05 -0400
commitfe9a88a01347b729e0a928ea188f6cfc51f00d02 (patch)
tree86a52c0d51d34cfac5d827caad91a4d5c6b165a7
parent841339371c26da4b44fb6d0e3ee06e7a9fe9d254 (diff)
downloadbuildstream-fe9a88a01347b729e0a928ea188f6cfc51f00d02.tar.gz
source.py: Consider workspaced sources with missing content inconsistent
Avoid trying to calculate cache keys and then running into an error by just considering workspaces with missing content to be inconsistent. This fixes issue #80
-rw-r--r--buildstream/source.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/buildstream/source.py b/buildstream/source.py
index a4402963e..bb6121995 100644
--- a/buildstream/source.py
+++ b/buildstream/source.py
@@ -199,6 +199,17 @@ class Source(Plugin):
def _get_consistency(self, recalculate=False):
if recalculate or self.__consistency is None:
self.__consistency = self.get_consistency()
+
+ if self._has_workspace() and \
+ self.__consistency > Consistency.INCONSISTENT:
+
+ # A workspace is considered inconsistent in the case
+ # that it's directory went missing
+ #
+ fullpath = os.path.join(self.get_project().directory, self.__workspace)
+ if not os.path.exists(fullpath):
+ self.__consistency = Consistency.INCONSISTENT
+
return self.__consistency
# Bump local cached consistency state, this is done from
@@ -328,11 +339,11 @@ class Source(Plugin):
# Return a list of (relative filename, sha256 digest) tuples, a sorted list
# has already been returned by list_relative_paths()
- return [(relpath, sha256sum(fullpath)) for relpath, fullpath in filelist]
+ return [(relpath, _sha256sum(fullpath)) for relpath, fullpath in filelist]
# Get the sha256 sum for the content of a file
-def sha256sum(filename):
+def _sha256sum(filename):
# If it's a directory or symlink, just return 0 string
if os.path.isdir(filename) or os.path.islink(filename):