diff options
author | Jürg Billeter <j@bitron.ch> | 2018-05-10 14:35:05 +0200 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2018-05-11 07:57:37 +0200 |
commit | 37e5362ea6057926b9af86f00b41449ed4f3c3e9 (patch) | |
tree | dac2b2a3f30fc25ae18963e00997ed9ad778fe29 | |
parent | 6d71826e52049cc068ed137f17159242276560f6 (diff) | |
download | buildstream-37e5362ea6057926b9af86f00b41449ed4f3c3e9.tar.gz |
_pipeline.py: Allow pulling strict artifacts in non-strict mode
Remotely cached artifacts matching the strict cache key take precedence
over locally cached artifacts matching only the weak cache key. However,
locally cached artifacts were excluded from the build plan, which means
that BuildStream never even checked whether the strict artifact is
available in the remote artifact cache.
This changes planning to keep cached elements in the build plan in
non-strict mode if a remote artifact cache is used.
-rw-r--r-- | buildstream/_pipeline.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/buildstream/_pipeline.py b/buildstream/_pipeline.py index 55e2c47fb..0bf57cd3d 100644 --- a/buildstream/_pipeline.py +++ b/buildstream/_pipeline.py @@ -193,7 +193,11 @@ class Pipeline(): # (list of Element): A depth sorted list of the build plan # def plan(self, elements): - return _Planner().plan(elements) + # Keep locally cached elements in the plan if remote artifact cache is used + # to allow pulling artifact with strict cache key, if available. + plan_cached = not self._context.get_strict() and self._artifacts.has_fetch_remotes() + + return _Planner().plan(elements, plan_cached) # get_selection() # @@ -478,9 +482,9 @@ class _Planner(): self.depth_map[element] = depth self.visiting_elements.remove(element) - def plan(self, roots): + def plan(self, roots, plan_cached): for root in roots: self.plan_element(root, 0) depth_sorted = sorted(self.depth_map.items(), key=itemgetter(1), reverse=True) - return [item[0] for item in depth_sorted if not item[0]._cached()] + return [item[0] for item in depth_sorted if plan_cached or not item[0]._cached()] |