lib/bb/utils.py: Fix explode_dep_versions2() determinism issue
PATCH 1/1 lib/bb/utils.py: Fix explode_dep_versions2() determinism issue
When we pass data into explode_dep_versions2(), we need to result to be able to be processed in a deterministic way so that we end up with consistent hash values. This means we need an ordered structure rather than an unordered one.
To do this, return an OrderedDict() rather than a dict().
Signed-off-by Richard Purdie <[email protected]>
bitbake/lib/bb/utils.py +2 -1
@@ -34,6 +34,7 @@ import traceback import errno import signal import ast +import collections from commands import getstatusoutput from contextlib import contextmanager from ctypes import cdll
@@ -188,7 +189,7 @@ def explode_dep_versions2(s): "DEPEND1 (optional version) DEPEND2 (optional version) ..." and return a dictionary of dependencies and versions. """ - r = {} + r = collections.OrderedDict() l = s.replace(",", "").split() lastdep = None lastcmp = ""
Quoted 9 lines · Richard Purdie
When we pass data into
explode_dep_versions2(), we need to result to be able to be processed in a deterministic way so that we end up with consistent hash values. This means we need an ordered structure rather than an unordered one.To do this, return an
OrderedDict()rather than adict().Signed-off-by Richard Purdie <[email protected]>
Nicely spotted. Looks good.
Signature · 5 lines
Christopher Larson clarson at kergoth dot com Founder - BitBake, OpenEmbedded, OpenZaurus Maintainer - Tslib Senior Software Engineer, Mentor Graphics