summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2018-02-26 17:34:18 +0000
committerTristan Van Berkom <tristan.van.berkom@gmail.com>2018-04-23 13:37:06 +0000
commitd423732f7143a862ef54c18c63aac4ef68382e66 (patch)
treeff1c83df7cddad971c020f792a6655a4ffe82827
parent4759e2adc20be4847894e484dd9ca8b3ac490ca1 (diff)
downloadbuildstream-d423732f7143a862ef54c18c63aac4ef68382e66.tar.gz
plugins/elements/compose.py: Only calculate snapshot when needed
This is an optimisation for the case where the compose element doesn't do any splitting, and also brings 2 related code fragments closer to each other.
-rw-r--r--buildstream/plugins/elements/compose.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/buildstream/plugins/elements/compose.py b/buildstream/plugins/elements/compose.py
index e03ab6f49..88da3799b 100644
--- a/buildstream/plugins/elements/compose.py
+++ b/buildstream/plugins/elements/compose.py
@@ -104,12 +104,7 @@ class ComposeElement(Element):
orphans=self.include_orphans)
manifest.update(files)
- # Make a snapshot of all the files.
basedir = sandbox.get_directory()
- snapshot = {
- f: getmtime(os.path.join(basedir, f))
- for f in utils.list_relative_paths(basedir)
- }
modified_files = set()
removed_files = set()
added_files = set()
@@ -118,6 +113,14 @@ class ComposeElement(Element):
# once they are all staged and ready
if self.integration:
with self.timed_activity("Integrating sandbox"):
+ if require_split:
+
+ # Make a snapshot of all the files before integration-commands are run.
+ snapshot = {
+ f: getmtime(os.path.join(basedir, f))
+ for f in utils.list_relative_paths(basedir)
+ }
+
for dep in self.dependencies(Scope.BUILD):
dep.integrate(sandbox)