diff options
author | Tristan Maat <tristan.maat@codethink.com> | 2017-07-14 16:00:55 +0100 |
---|---|---|
committer | Tristan Maat <tristan.maat@codethink.com> | 2017-07-14 16:01:24 +0100 |
commit | 7227cd41b8f593357df2c4c10d16c5b48c421de1 (patch) | |
tree | 1bf2b3b468d96dc88c9f5645dc4a9caa5e39ae63 | |
parent | b20232f7b243f56ea9e96fe2d036d07d9dd57207 (diff) | |
download | buildstream-7227cd41b8f593357df2c4c10d16c5b48c421de1.tar.gz |
element.py: Make element dependencies affect taint status
-rw-r--r-- | buildstream/element.py | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/buildstream/element.py b/buildstream/element.py index 9b9c83eb2..08d2b9458 100644 --- a/buildstream/element.py +++ b/buildstream/element.py @@ -135,6 +135,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): @@ -712,14 +713,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(): # @@ -1078,9 +1091,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"): |