diff options
author | Jürg Billeter <j@bitron.ch> | 2020-09-23 11:24:43 +0200 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2020-09-24 14:41:10 +0200 |
commit | d3e07d90e61cfa3d7cf91012218ed5d45abfc982 (patch) | |
tree | 6d72980487592f6f3887460dd52d3007e63c9c34 /src | |
parent | 9fba7a1fb27da5fac968fc3eeedc2017b282f344 (diff) | |
download | buildstream-d3e07d90e61cfa3d7cf91012218ed5d45abfc982.tar.gz |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/buildstream/plugins/elements/filter.py | 23 |
1 files 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 |