Benjamin Schubert pushed to branch bschubert/rework-sort at BuildStream / buildstream
Commits:
-
78bdd7e8
by Benjamin Schubert at 2019-02-04T14:19:24Z
2 changed files:
Changes:
... | ... | @@ -65,7 +65,6 @@ class LoadElement(): |
65 | 65 |
self.full_name = None # The element full name (with associated junction)
|
66 | 66 |
self.visited = False
|
67 | 67 |
self.tried_visit = False
|
68 |
- self.in_pipeline = False
|
|
69 | 68 |
self.__on_visit = []
|
70 | 69 |
#
|
71 | 70 |
# Private members
|
... | ... | @@ -428,11 +428,13 @@ class Loader(): |
428 | 428 |
while elements_to_load:
|
429 | 429 |
element = elements_to_load.popleft()
|
430 | 430 |
|
431 |
+ if element.visited:
|
|
432 |
+ continue
|
|
433 |
+ |
|
431 | 434 |
if any(filter(not_visited, element.reverse_dependencies)):
|
432 | 435 |
# We will want to treat this item as soon as possible.
|
433 | 436 |
# Mark it as already seen
|
434 | 437 |
element.tried_visit = True
|
435 |
- element.in_pipeline = False
|
|
436 | 438 |
continue
|
437 | 439 |
|
438 | 440 |
element.visited = True
|
... | ... | @@ -445,15 +447,12 @@ class Loader(): |
445 | 447 |
if dep.dep_type != Symbol.BUILD:
|
446 | 448 |
dep.element.on_visit(meta_element.dependencies.append)
|
447 | 449 |
|
448 |
- if not dep.element.in_pipeline:
|
|
449 |
- dep.element.in_pipeline = True
|
|
450 |
- |
|
451 |
- if dep.element.tried_visit:
|
|
452 |
- # This element has already been requested, we should treat
|
|
453 |
- # it as soon as possible
|
|
454 |
- elements_to_load.appendleft(dep.element)
|
|
455 |
- else:
|
|
456 |
- elements_to_load.append(dep.element)
|
|
450 |
+ if dep.element.tried_visit:
|
|
451 |
+ # This element has already been requested, we should treat
|
|
452 |
+ # it as soon as possible
|
|
453 |
+ elements_to_load.appendleft(dep.element)
|
|
454 |
+ else:
|
|
455 |
+ elements_to_load.append(dep.element)
|
|
457 | 456 |
|
458 | 457 |
for element in self._meta_elements.values():
|
459 | 458 |
element.build_dependencies.sort(key=attrgetter("index"), reverse=True)
|