summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Maat <tristan.maat@codethink.com>2017-07-14 16:00:55 +0100
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-07-17 23:03:00 +0900
commit1d23595871cd7e1a0322e7674525c4911ffb5617 (patch)
tree6a0f5e541d811d1b88d6c06d379f47143bb30378
parent24b26e741578ce33fe60ffd57797c546e49fe2e0 (diff)
downloadbuildstream-1d23595871cd7e1a0322e7674525c4911ffb5617.tar.gz
element.py: Make element dependencies affect taint status
-rw-r--r--buildstream/element.py27
1 files changed, 19 insertions, 8 deletions
diff --git a/buildstream/element.py b/buildstream/element.py
index 80ff85e28..bfe301545 100644
--- a/buildstream/element.py
+++ b/buildstream/element.py
@@ -143,6 +143,7 @@ class Element(Plugin):
self.__config = self.__extract_config(meta)
self.configure(self.__config)
+ self.__tainted = None
self.__workspaced_artifact = None
def __lt__(self, other):
@@ -720,14 +721,26 @@ class Element(Plugin):
# _tainted():
#
+ # Args:
+ # recalculate (bool) - Whether to force recalculation
+ #
# Returns:
- # (bool) Whether this element should be excluded from pushing.
+ # (bool) False if this artifact should be excluded from pushing.
#
- def _tainted(self):
- workspaced = self._workspaced_artifact()
+ def _tainted(self, recalculate=False):
+ if recalculate or self.__tainted is None:
+
+ # Whether this artifact has a workspace
+ workspaced = self._workspaced_artifact()
+
+ # Whether this artifact's dependencies are tainted
+ dependencies = any(d._tainted() for d in self.dependencies(Scope.BUILD)
+ if d != self)
+
+ # Other conditions should be or-ed
+ self.__tainted = workspaced or dependencies
- # Other conditions should be or-ed
- return workspaced
+ return self.__tainted
# _set_built():
#
@@ -1086,9 +1099,7 @@ class Element(Plugin):
self._assert_cached()
if self._tainted():
- self.warn("Not pushing tainted artifact.",
- detail=("The artifact was built with a workspaced source"
- if self._workspaced_artifact() else ""))
+ self.warn("Not pushing tainted artifact.")
return False
with self.timed_activity("Pushing Artifact"):