tools: ynl: store ops in ordered dict to avoid random ordering

When rendering code we should walk the ops in the order in which
they are declared in the spec. This is both more intuitive and
prevents code from jumping around when hashing in the dict changes.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Jakub Kicinski 2023-01-25 16:02:35 -08:00
parent b49c34e217
commit 3a43ded081

View file

@ -1,6 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
import argparse import argparse
import collections
import jsonschema import jsonschema
import os import os
import yaml import yaml
@ -793,7 +794,7 @@ class Family:
# list of all operations # list of all operations
self.msg_list = [] self.msg_list = []
# dict of operations which have their own message type (have attributes) # dict of operations which have their own message type (have attributes)
self.ops = dict() self.ops = collections.OrderedDict()
self.attr_sets = dict() self.attr_sets = dict()
self.attr_sets_list = [] self.attr_sets_list = []