diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2016-12-31 17:25:12 -0500 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2016-12-31 17:39:09 -0500 |
commit | f72b92b54066902051a067b6b2a6591804c547bf (patch) | |
tree | 5ce7d8c6a182a92ff2cb70217ca110afb2fd5ded /buildstream | |
parent | 99455e36c87d6fa090a65ddd1127160aaaa057ca (diff) | |
download | buildstream-f72b92b54066902051a067b6b2a6591804c547bf.tar.gz |
_pipeline.py: Implement refresh() method
Diffstat (limited to 'buildstream')
-rw-r--r-- | buildstream/_pipeline.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/buildstream/_pipeline.py b/buildstream/_pipeline.py index 08a8a56f1..d75ce7264 100644 --- a/buildstream/_pipeline.py +++ b/buildstream/_pipeline.py @@ -19,12 +19,15 @@ # Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> # Jürg Billeter <juerg.billeter@codethink.co.uk> +import os from pluginbase import PluginBase from ._artifactcache import ArtifactCache from ._elementfactory import ElementFactory from ._loader import Loader from ._sourcefactory import SourceFactory +from . import Scope +from . import _yaml # The Resolver class instantiates plugin-provided Element and Source classes @@ -87,3 +90,22 @@ class Pipeline(): resolver = Resolver(self.context, self.project, self.element_factory, self.source_factory) self.target = resolver.resolve_element(meta_element) + + # refresh() + # + # Refreshes all the sources of all the elements in the pipeline, + # i.e. all of the elements which the target somehow depends on. + # + # If no error is encountered while refreshing, then the project files + # are rewritten inline. + # + def refresh(self): + + files = {} + for elt in self.target.dependencies(Scope.ALL): + elt_files = elt._refresh() + files.update(elt_files) + + for filename, toplevel in files.items(): + fullname = os.path.join(self.project.directory, filename) + _yaml.dump(toplevel, fullname) |