diff options
author | Raoul Hidalgo Charman <raoul.hidalgocharman@codethink.co.uk> | 2019-04-29 17:36:52 +0100 |
---|---|---|
committer | Raoul Hidalgo Charman <raoul.hidalgocharman@codethink.co.uk> | 2019-04-29 17:36:52 +0100 |
commit | 14c292112975bd0e890886f4b3466feaf3fc7823 (patch) | |
tree | 371d0bfd6461965a58a73cbe3c415dedb840fdd8 /buildstream/source.py | |
parent | 73ef730ed9096c6ec418176f3d903d2483262b6b (diff) | |
download | buildstream-raoul/892-individual-source-caching.tar.gz |
Add BST_REQUIRES_PREVIOUS_SOURCE_STAGE optionraoul/892-individual-source-caching
This is an element option that allows sources to be staged more
seperately where possible rather than on a per element option. When
there is a source that has this option set to true, all previously
listed sources will be cached with this, and sources listed afterwards
will be cached individually. If no sources have this option, all sources
will be cached seperately.
Fixes #892
Diffstat (limited to 'buildstream/source.py')
-rw-r--r-- | buildstream/source.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/buildstream/source.py b/buildstream/source.py index 6f4ff575b..94cb82e2f 100644 --- a/buildstream/source.py +++ b/buildstream/source.py @@ -286,6 +286,15 @@ class Source(Plugin): *Since: 1.4* """ + BST_REQUIRES_PREVIOUS_SOURCES_CACHE = False + """Whether access to previous sources is required during cache + + When set to True: + * all sources listed before current source in the given element will be + passed to the source when it's cached. + * This source can not be the first source for an element. + """ + def __init__(self, context, project, meta, *, alias_override=None): provenance = _yaml.node_get_provenance(meta.config) super().__init__("{}-{}".format(meta.element_name, meta.element_index), @@ -709,7 +718,10 @@ class Source(Plugin): def _cache(self, previous_sources): # stage the source into the source cache - self.__source_cache.commit(self, previous_sources) + if self.BST_REQUIRES_PREVIOUS_SOURCES_CACHE: + self.__source_cache.commit(self, previous_sources) + else: + self.__source_cache.commit(self, []) # Wrapper for stage() api which gives the source # plugin a fully constructed path considering the |