From d3e07d90e61cfa3d7cf91012218ed5d45abfc982 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Billeter?= Date: Wed, 23 Sep 2020 11:24:43 +0200 Subject: filter.py: Combine integration commands in assemble() Plugins must not access public data of build dependencies in `integrate()` as the build dependencies are not guaranteed to be cached at that stage. This combines integration commands of the sole build dependency and the filter element itself at time of assembly instead of integration. --- src/buildstream/plugins/elements/filter.py | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/buildstream/plugins/elements/filter.py b/src/buildstream/plugins/elements/filter.py index 783079c06..5560f7b7a 100644 --- a/src/buildstream/plugins/elements/filter.py +++ b/src/buildstream/plugins/elements/filter.py @@ -249,6 +249,23 @@ class FilterElement(Element): dep.stage_artifact(sandbox, include=self.include, exclude=self.exclude, orphans=self.include_orphans) def assemble(self, sandbox): + if self.pass_integration: + build_deps = list(self.dependencies(recurse=False)) + assert len(build_deps) == 1 + dep = build_deps[0] + + # Integration commands of the build dependency + pub_data = dep.get_public_data("bst") + integration_commands = pub_data.get_str_list("integration-commands", []) + + # Integration commands of the filter element itself + filter_pub_data = self.get_public_data("bst") + filter_integration_commands = filter_pub_data.get_str_list("integration-commands", []) + + # Concatenate the command lists + filter_pub_data["integration-commands"] = integration_commands + filter_integration_commands + self.set_public_data("bst", filter_pub_data) + return "" def _get_source_element(self): @@ -259,12 +276,6 @@ class FilterElement(Element): output_elm = build_deps[0]._get_source_element() return output_elm - def integrate(self, sandbox): - if self.pass_integration: - for dep in self.dependencies(recurse=False): - dep.integrate(sandbox) - super().integrate(sandbox) - def setup(): return FilterElement -- cgit v1.2.1