summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2019-01-10 14:57:21 -0500
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2019-01-10 15:02:50 -0500
commit0b83d024920e319d0fefcba34d22ced490e185d0 (patch)
treee51a671327b171ade82583524b907f6a416bb4c5
parent6bc27bc1d086e6196c3b32fb053607cace743071 (diff)
downloadbuildstream-0b83d024920e319d0fefcba34d22ced490e185d0.tar.gz
_pipeline.py: Fix the planner to retain the original order when depth sorting
The algorithm adds elements to a dictionary and then sorts the dictionary by the discovered depths while recursing - using an OrderedDict is enough to ensure a stable order. This fixes `bst show --deps plan ...` reporting different results on each invocation. This fixes an aspect of #824
-rw-r--r--buildstream/_pipeline.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/buildstream/_pipeline.py b/buildstream/_pipeline.py
index 1dd4ec815..3dc3019eb 100644
--- a/buildstream/_pipeline.py
+++ b/buildstream/_pipeline.py
@@ -22,6 +22,7 @@
import os
import itertools
from operator import itemgetter
+from collections import OrderedDict
from ._exceptions import PipelineError
from ._message import Message, MessageType
@@ -479,7 +480,7 @@ class Pipeline():
#
class _Planner():
def __init__(self):
- self.depth_map = {}
+ self.depth_map = OrderedDict()
self.visiting_elements = set()
# Here we want to traverse the same element more than once when