Benjamin Schubert pushed to branch bschubert/pipeline at BuildStream / buildstream
Commits:
-
f6e423bd
by Benjamin Schubert at 2019-01-08T21:38:05Z
3 changed files:
- buildstream/_scheduler/queues/buildqueue.py
- buildstream/_scheduler/queues/trackqueue.py
- buildstream/element.py
Changes:
... | ... | @@ -107,7 +107,7 @@ class BuildQueue(Queue): |
107 | 107 |
element._assemble_done()
|
108 | 108 |
|
109 | 109 |
# Update the state of all reverse dependencies
|
110 |
- for reverse_dependency in element.reverse_build_dependencies:
|
|
110 |
+ for reverse_dependency in element.reverse_build_dependencies():
|
|
111 | 111 |
reverse_dependency._update_state()
|
112 | 112 |
|
113 | 113 |
# This has to be done after _assemble_done, such that the
|
... | ... | @@ -58,3 +58,6 @@ class TrackQueue(Queue): |
58 | 58 |
source._save_ref(new_ref)
|
59 | 59 |
|
60 | 60 |
element._tracking_done()
|
61 |
+ |
|
62 |
+ for rdep in element.reverse_build_dependencies(recurse=True):
|
|
63 |
+ rdep._update_state()
|
... | ... | @@ -197,7 +197,7 @@ class Element(Plugin): |
197 | 197 |
|
198 | 198 |
self.__runtime_dependencies = [] # Direct runtime dependency Elements
|
199 | 199 |
self.__build_dependencies = [] # Direct build dependency Elements
|
200 |
- self.reverse_build_dependencies = [] # Direct reverse build dependency Elements
|
|
200 |
+ self.__reverse_build_dependencies = [] # Direct reverse build dependency Elements
|
|
201 | 201 |
self.__sources = [] # List of Sources
|
202 | 202 |
self.__weak_cache_key = None # Our cached weak cache key
|
203 | 203 |
self.__strict_cache_key = None # Our cached cache key for strict builds
|
... | ... | @@ -440,6 +440,27 @@ class Element(Plugin): |
440 | 440 |
if should_yield and (recurse or recursed) and scope != Scope.BUILD:
|
441 | 441 |
yield self
|
442 | 442 |
|
443 |
+ def reverse_build_dependencies(self, recurse=False):
|
|
444 |
+ if not recurse:
|
|
445 |
+ yield from self.__reverse_build_dependencies
|
|
446 |
+ return
|
|
447 |
+ |
|
448 |
+ visited = set()
|
|
449 |
+ |
|
450 |
+ def recurse_rdeps(element):
|
|
451 |
+ if element in visited:
|
|
452 |
+ return
|
|
453 |
+ |
|
454 |
+ visited.add(element)
|
|
455 |
+ |
|
456 |
+ yield element
|
|
457 |
+ |
|
458 |
+ for rdep in element.__reverse_build_dependencies:
|
|
459 |
+ yield from recurse_rdeps(rdep)
|
|
460 |
+ |
|
461 |
+ for rdep in self.__reverse_build_dependencies:
|
|
462 |
+ yield from recurse_rdeps(rdep)
|
|
463 |
+ |
|
443 | 464 |
def search(self, scope, name):
|
444 | 465 |
"""Search for a dependency by name
|
445 | 466 |
|
... | ... | @@ -931,7 +952,7 @@ class Element(Plugin): |
931 | 952 |
for meta_dep in meta.build_dependencies:
|
932 | 953 |
dependency = Element._new_from_meta(meta_dep)
|
933 | 954 |
element.__build_dependencies.append(dependency)
|
934 |
- dependency.reverse_build_dependencies.append(element)
|
|
955 |
+ dependency.__reverse_build_dependencies.append(element)
|
|
935 | 956 |
|
936 | 957 |
return element
|
937 | 958 |
|