summaryrefslogtreecommitdiff
path: root/src/buildstream/_pipeline.py
diff options
context:
space:
mode:
authorTristan van Berkom <tristan@codethink.co.uk>2020-08-24 16:53:06 +0900
committerTristan van Berkom <tristan@codethink.co.uk>2020-09-04 18:22:38 +0900
commit97812cbb7d295cc3d270be9205cbc12313215028 (patch)
tree8f5e2ca4303d43b0d4fbc5f36759bb6194da21f0 /src/buildstream/_pipeline.py
parent85400d162f1cf29e7f4230b18c0a96ec7e814519 (diff)
downloadbuildstream-97812cbb7d295cc3d270be9205cbc12313215028.tar.gz
Element.dependencies() now yields ElementProxy wrappers by default.
This prepares the ground for policing the dependencies which are visible to an Element plugin, such that plugins are only allowed to see the elements in their Scope.BUILD scope, even if they call Element.dependencies() on a dependency. This commit does the following: * Element.dependencies() is now a user facing frontend which yields ElementProxy elements instead of Elements. * Various core codepaths have been updated to call the internal Element._dependencies() codepath which still returns Elements.
Diffstat (limited to 'src/buildstream/_pipeline.py')
-rw-r--r--src/buildstream/_pipeline.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/buildstream/_pipeline.py b/src/buildstream/_pipeline.py
index 340c12b1a..0fb30e244 100644
--- a/src/buildstream/_pipeline.py
+++ b/src/buildstream/_pipeline.py
@@ -157,7 +157,7 @@ class Pipeline:
visited = (BitMap(), BitMap())
for target in targets:
- for element in target.dependencies(scope, recurse=recurse, visited=visited):
+ for element in target._dependencies(scope, recurse=recurse, visited=visited):
yield element
# plan()
@@ -251,7 +251,7 @@ class Pipeline:
if element in targeted:
yield element
else:
- for dep in element.dependencies(Scope.ALL, recurse=False):
+ for dep in element._dependencies(Scope.ALL, recurse=False):
yield from find_intersection(dep)
# Build a list of 'intersection' elements, i.e. the set of
@@ -272,7 +272,7 @@ class Pipeline:
continue
visited.append(element)
- queue.extend(element.dependencies(Scope.ALL, recurse=False))
+ queue.extend(element._dependencies(Scope.ALL, recurse=False))
# That looks like a lot, but overall we only traverse (part
# of) the graph twice. This could be reduced to once if we
@@ -474,12 +474,12 @@ class _Planner:
return
self.visiting_elements.add(element)
- for dep in element.dependencies(Scope.RUN, recurse=False):
+ for dep in element._dependencies(Scope.RUN, recurse=False):
self.plan_element(dep, depth)
# Dont try to plan builds of elements that are cached already
if not element._cached_success():
- for dep in element.dependencies(Scope.BUILD, recurse=False):
+ for dep in element._dependencies(Scope.BUILD, recurse=False):
self.plan_element(dep, depth + 1)
self.depth_map[element] = depth