diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2018-10-29 13:39:55 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2018-12-11 17:55:24 +0000 |
commit | 5e5792642ec043aacea3169402b7e10881a35c74 (patch) | |
tree | 71a2e125e272210e990e4cbd8bac109344ef5f41 | |
parent | 173adb7da050d580c2020f88eeea84bb3799b85e (diff) | |
download | buildstream-5e5792642ec043aacea3169402b7e10881a35c74.tar.gz |
elements: Port build and script kinds to BST_STAGE_INTEGRATES
This is mostly just marking which elements work as expected
from changes to their base class.
Junction and Filter elements expect overriding stage to be sufficient
to prevent it doing anything in those contexts,
and since we're not intending to deprecate BST_STAGE_INTEGRATES elements
there's no harm in them continuing to do so
when they aren't expected to work in contexts we require
BST_STAGE_INTEGRATES to be False.
-rw-r--r-- | buildstream/buildelement.py | 15 | ||||
-rw-r--r-- | buildstream/plugins/elements/autotools.py | 2 | ||||
-rw-r--r-- | buildstream/plugins/elements/cmake.py | 2 | ||||
-rw-r--r-- | buildstream/plugins/elements/compose.py | 12 | ||||
-rw-r--r-- | buildstream/plugins/elements/distutils.py | 3 | ||||
-rw-r--r-- | buildstream/plugins/elements/filter.py | 2 | ||||
-rw-r--r-- | buildstream/plugins/elements/import.py | 7 | ||||
-rw-r--r-- | buildstream/plugins/elements/junction.py | 2 | ||||
-rw-r--r-- | buildstream/plugins/elements/make.py | 2 | ||||
-rw-r--r-- | buildstream/plugins/elements/makemaker.py | 3 | ||||
-rw-r--r-- | buildstream/plugins/elements/manual.py | 2 | ||||
-rw-r--r-- | buildstream/plugins/elements/meson.py | 2 | ||||
-rw-r--r-- | buildstream/plugins/elements/modulebuild.py | 3 | ||||
-rw-r--r-- | buildstream/plugins/elements/pip.py | 3 | ||||
-rw-r--r-- | buildstream/plugins/elements/qmake.py | 2 | ||||
-rw-r--r-- | buildstream/plugins/elements/script.py | 3 | ||||
-rw-r--r-- | buildstream/plugins/elements/stack.py | 8 |
17 files changed, 54 insertions, 19 deletions
diff --git a/buildstream/buildelement.py b/buildstream/buildelement.py index f1b13e796..67d959407 100644 --- a/buildstream/buildelement.py +++ b/buildstream/buildelement.py @@ -211,17 +211,18 @@ class BuildElement(Element): self.batch_prepare_assemble(SandboxFlags.ROOT_READ_ONLY, collect=self.get_variable('install-root')) - def stage(self, sandbox): + def stage(self, sandbox, *, visited=None): + assert not self.BST_STAGE_INTEGRATES or visited is None # Stage deps in the sandbox root with self.timed_activity("Staging dependencies", silent_nested=True): - self.stage_dependency_artifacts(sandbox, Scope.BUILD) + self.stage_dependency_artifacts(sandbox, Scope.BUILD, visited=visited) - # Run any integration commands provided by the dependencies - # once they are all staged and ready - with sandbox.batch(SandboxFlags.NONE, label="Integrating sandbox"): - for dep in self.dependencies(Scope.BUILD): - dep.integrate(sandbox) + if self.BST_STAGE_INTEGRATES: + # Run any integration commands provided by the dependencies + # once they are all staged and ready + with self.timed_activity("Integrating sandbox"): + self.integrate_dependency_artifacts(sandbox, Scope.BUILD) # Stage sources in the build root self.stage_sources(sandbox, self.get_variable('build-root')) diff --git a/buildstream/plugins/elements/autotools.py b/buildstream/plugins/elements/autotools.py index 43fe7add4..8ea24c1e7 100644 --- a/buildstream/plugins/elements/autotools.py +++ b/buildstream/plugins/elements/autotools.py @@ -62,6 +62,8 @@ from buildstream import BuildElement class AutotoolsElement(BuildElement): # Supports virtual directories (required for remote execution) BST_VIRTUAL_DIRECTORY = True + # This plugin has been modified to permit calling integration after staging + BST_STAGE_INTEGRATES = False # Plugin entry point diff --git a/buildstream/plugins/elements/cmake.py b/buildstream/plugins/elements/cmake.py index de9aa9616..3ce2d42c1 100644 --- a/buildstream/plugins/elements/cmake.py +++ b/buildstream/plugins/elements/cmake.py @@ -61,6 +61,8 @@ from buildstream import BuildElement class CMakeElement(BuildElement): # Supports virtual directories (required for remote execution) BST_VIRTUAL_DIRECTORY = True + # This plugin has been modified to permit calling integration after staging + BST_STAGE_INTEGRATES = False # Plugin entry point diff --git a/buildstream/plugins/elements/compose.py b/buildstream/plugins/elements/compose.py index d61a324cc..1c344809a 100644 --- a/buildstream/plugins/elements/compose.py +++ b/buildstream/plugins/elements/compose.py @@ -58,6 +58,9 @@ class ComposeElement(Element): # This plugin has been modified to avoid the use of Sandbox.get_directory BST_VIRTUAL_DIRECTORY = True + # This plugin has been modified to permit calling integration after staging + BST_STAGE_INTEGRATES = False + def configure(self, node): self.node_validate(node, [ 'integrate', 'include', 'exclude', 'include-orphans' @@ -86,7 +89,10 @@ class ComposeElement(Element): def configure_sandbox(self, sandbox): pass - def stage(self, sandbox): + def stage(self, sandbox, *, visited=None): + pass + + def integrate_dependency_artifacts(self, sandbox, scope, *, visited=None): pass def assemble(self, sandbox): @@ -122,9 +128,7 @@ class ComposeElement(Element): snapshot = set(vbasedir.list_relative_paths()) vbasedir.mark_unmodified() - with sandbox.batch(0): - for dep in self.dependencies(Scope.BUILD): - dep.integrate(sandbox) + super().integrate_dependency_artifacts(sandbox, Scope.BUILD) if require_split: # Calculate added, modified and removed files diff --git a/buildstream/plugins/elements/distutils.py b/buildstream/plugins/elements/distutils.py index 20a2d67ef..efef4934a 100644 --- a/buildstream/plugins/elements/distutils.py +++ b/buildstream/plugins/elements/distutils.py @@ -36,7 +36,8 @@ from buildstream import BuildElement # Element implementation for the python 'distutils' kind. class DistutilsElement(BuildElement): - pass + # This plugin has been modified to permit calling integration after staging + BST_STAGE_INTEGRATES = False # Plugin entry point diff --git a/buildstream/plugins/elements/filter.py b/buildstream/plugins/elements/filter.py index 672325304..3d882c75c 100644 --- a/buildstream/plugins/elements/filter.py +++ b/buildstream/plugins/elements/filter.py @@ -97,7 +97,7 @@ class FilterElement(Element): def configure_sandbox(self, sandbox): pass - def stage(self, sandbox): + def stage(self, sandbox, *, visited=None): pass def assemble(self, sandbox): diff --git a/buildstream/plugins/elements/import.py b/buildstream/plugins/elements/import.py index ec491a0a5..a65994aa2 100644 --- a/buildstream/plugins/elements/import.py +++ b/buildstream/plugins/elements/import.py @@ -43,6 +43,8 @@ class ImportElement(BuildElement): # This plugin has been modified to avoid the use of Sandbox.get_directory BST_VIRTUAL_DIRECTORY = True + # This plugin has been modified to permit calling integration after staging + BST_STAGE_INTEGRATES = False def configure(self, node): self.source = self.node_subst_member(node, 'source') @@ -64,7 +66,10 @@ class ImportElement(BuildElement): def configure_sandbox(self, sandbox): pass - def stage(self, sandbox): + def stage(self, sandbox, *, visited=None): + pass + + def integrate_dependency_artifacts(self, sandbox, scope, *, visited=None): pass def assemble(self, sandbox): diff --git a/buildstream/plugins/elements/junction.py b/buildstream/plugins/elements/junction.py index 7f9817359..05d5bff9e 100644 --- a/buildstream/plugins/elements/junction.py +++ b/buildstream/plugins/elements/junction.py @@ -152,7 +152,7 @@ class JunctionElement(Element): def configure_sandbox(self, sandbox): raise PipelineError("Cannot build junction elements") - def stage(self, sandbox): + def stage(self, sandbox, *, visited=None): raise PipelineError("Cannot stage junction elements") def generate_script(self): diff --git a/buildstream/plugins/elements/make.py b/buildstream/plugins/elements/make.py index a22de168a..5a3387e41 100644 --- a/buildstream/plugins/elements/make.py +++ b/buildstream/plugins/elements/make.py @@ -43,6 +43,8 @@ from buildstream import BuildElement class MakeElement(BuildElement): # Supports virtual directories (required for remote execution) BST_VIRTUAL_DIRECTORY = True + # This plugin has been modified to permit calling integration after staging + BST_STAGE_INTEGRATES = False # Plugin entry point diff --git a/buildstream/plugins/elements/makemaker.py b/buildstream/plugins/elements/makemaker.py index 8ad979984..f2cd7a769 100644 --- a/buildstream/plugins/elements/makemaker.py +++ b/buildstream/plugins/elements/makemaker.py @@ -36,7 +36,8 @@ from buildstream import BuildElement # Element implementation for the 'makemaker' kind. class MakeMakerElement(BuildElement): - pass + # This plugin has been modified to permit calling integration after staging + BST_STAGE_INTEGRATES = False # Plugin entry point diff --git a/buildstream/plugins/elements/manual.py b/buildstream/plugins/elements/manual.py index 8f951ab38..393a009d9 100644 --- a/buildstream/plugins/elements/manual.py +++ b/buildstream/plugins/elements/manual.py @@ -38,6 +38,8 @@ from buildstream import BuildElement class ManualElement(BuildElement): # Supports virtual directories (required for remote execution) BST_VIRTUAL_DIRECTORY = True + # This plugin has been modified to permit calling integration after staging + BST_STAGE_INTEGRATES = False # Plugin entry point diff --git a/buildstream/plugins/elements/meson.py b/buildstream/plugins/elements/meson.py index 0d5ca0087..312ae40ec 100644 --- a/buildstream/plugins/elements/meson.py +++ b/buildstream/plugins/elements/meson.py @@ -58,6 +58,8 @@ from buildstream import BuildElement class MesonElement(BuildElement): # Supports virtual directories (required for remote execution) BST_VIRTUAL_DIRECTORY = True + # This plugin has been modified to permit calling integration after staging + BST_STAGE_INTEGRATES = False # Plugin entry point diff --git a/buildstream/plugins/elements/modulebuild.py b/buildstream/plugins/elements/modulebuild.py index d619a1d01..89ec90887 100644 --- a/buildstream/plugins/elements/modulebuild.py +++ b/buildstream/plugins/elements/modulebuild.py @@ -36,7 +36,8 @@ from buildstream import BuildElement # Element implementation for the 'modulebuild' kind. class ModuleBuildElement(BuildElement): - pass + # This plugin has been modified to permit calling integration after staging + BST_STAGE_INTEGRATES = False # Plugin entry point diff --git a/buildstream/plugins/elements/pip.py b/buildstream/plugins/elements/pip.py index 02b593af3..f2cf377dc 100644 --- a/buildstream/plugins/elements/pip.py +++ b/buildstream/plugins/elements/pip.py @@ -36,7 +36,8 @@ from buildstream import BuildElement # Element implementation for the 'pip' kind. class PipElement(BuildElement): - pass + # This plugin has been modified to permit calling integration after staging + BST_STAGE_INTEGRATES = False # Plugin entry point diff --git a/buildstream/plugins/elements/qmake.py b/buildstream/plugins/elements/qmake.py index d6776b0b2..314219d2f 100644 --- a/buildstream/plugins/elements/qmake.py +++ b/buildstream/plugins/elements/qmake.py @@ -38,6 +38,8 @@ from buildstream import BuildElement class QMakeElement(BuildElement): # Supports virtual directories (required for remote execution) BST_VIRTUAL_DIRECTORY = True + # This plugin has been modified to permit calling integration after staging + BST_STAGE_INTEGRATES = False # Plugin entry point diff --git a/buildstream/plugins/elements/script.py b/buildstream/plugins/elements/script.py index 4e422c5db..5ad93dd4e 100644 --- a/buildstream/plugins/elements/script.py +++ b/buildstream/plugins/elements/script.py @@ -42,6 +42,9 @@ import buildstream class ScriptElement(buildstream.ScriptElement): # pylint: disable=attribute-defined-outside-init + # This plugin has been modified to permit calling integration after staging + BST_STAGE_INTEGRATES = False + def configure(self, node): for n in self.node_get_member(node, list, 'layout', []): dst = self.node_subst_member(n, 'destination') diff --git a/buildstream/plugins/elements/stack.py b/buildstream/plugins/elements/stack.py index 138afedf7..54e540cf8 100644 --- a/buildstream/plugins/elements/stack.py +++ b/buildstream/plugins/elements/stack.py @@ -33,6 +33,9 @@ class StackElement(Element): # This plugin has been modified to avoid the use of Sandbox.get_directory BST_VIRTUAL_DIRECTORY = True + # This plugin has been modified to permit calling integration after staging + BST_STAGE_INTEGRATES = False + def configure(self, node): pass @@ -47,7 +50,10 @@ class StackElement(Element): def configure_sandbox(self, sandbox): pass - def stage(self, sandbox): + def stage(self, sandbox, *, visited=None): + pass + + def integrate_dependency_artifacts(self, sandbox, scope, *, visited=None): pass def assemble(self, sandbox): |