diff options
author | Jürg Billeter <j@bitron.ch> | 2020-09-29 15:20:14 +0200 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2020-09-29 17:35:12 +0200 |
commit | d1885eafaf002f6f8c30cefa89d9c75fd352e444 (patch) | |
tree | 3c78fe5ce8ec75f02cac529ae0ea630ce97ca3ed | |
parent | c7a2ea2dcf737f01498e55a28dd438b8eb8a845e (diff) | |
download | buildstream-d1885eafaf002f6f8c30cefa89d9c75fd352e444.tar.gz |
element.py: Handle uncached state in _push()
This allows proper error handling when pushing an uncached element
should result in a failure (bst artifact push), not a skipped job
(bst build).
-rw-r--r-- | src/buildstream/element.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/buildstream/element.py b/src/buildstream/element.py index 5118f0193..ff7dcbbbb 100644 --- a/src/buildstream/element.py +++ b/src/buildstream/element.py @@ -1999,7 +1999,13 @@ class Element(Plugin): # and no updated was required # def _push(self): - self.__assert_cached() + if not self._cached(): + raise ElementError("Push failed: {} is not cached".format(self.name)) + + # Do not push elements that are cached with a dangling buildtree ref + # unless element type is expected to have an an empty buildtree directory + if not self._cached_buildtree() and self._buildtree_exists(): + raise ElementError("Push failed: buildtree of {} is not cached".format(self.name)) if self.__get_tainted(): self.warn("Not pushing tainted artifact.") |