diff options
author | Thomas Coldrick <thomas.coldrick@codethink.co.uk> | 2019-09-10 11:14:45 +0100 |
---|---|---|
committer | Thomas Coldrick <othko97@gmail.com> | 2019-09-16 06:55:56 +0000 |
commit | b2af82add70ca6c582d08d916fb243493de397e2 (patch) | |
tree | 417f41ff5448489e3589bb5207838768761324a1 /src/buildstream/plugins | |
parent | 8ff9262d9843a8e858a594c787ddbd156b4b3d3b (diff) | |
download | buildstream-b2af82add70ca6c582d08d916fb243493de397e2.tar.gz |
filter.py: Fail if parent element is a stack
As stack elements do not provide any artifacts, it is misleading to
allow them as dependencies for filter elements. This commit makes a
dependency on a stack element a failure with a descriptive error
message.
Additionally adds a test to make sure this works.
Addresses #1104
Diffstat (limited to 'src/buildstream/plugins')
-rw-r--r-- | src/buildstream/plugins/elements/filter.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/buildstream/plugins/elements/filter.py b/src/buildstream/plugins/elements/filter.py index 795d8910b..2f9204215 100644 --- a/src/buildstream/plugins/elements/filter.py +++ b/src/buildstream/plugins/elements/filter.py @@ -200,6 +200,13 @@ class FilterElement(Element): .format(self, type(self).__name__), detail=detail, reason="filter-bdepend-also-rdepend") + # If a stack, fail and inform user that the dependency can't be a stack + if build_deps[0].get_kind() == 'stack': + detail = "{} is a stack element, which has no artifact".format(build_deps[0].name) + raise ElementError("{}: {} element's build dependency must not be a stack element" + .format(self, type(self).__name__), + detail=detail, reason="filter-bdepend-is-stack") + def get_unique_key(self): key = { 'include': sorted(self.include), |