All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lib/bb/utils.py: Fix explode_dep_versions2() determinism issue
@ 2016-05-09 13:07 Richard Purdie
  2016-05-09 16:37 ` Christopher Larson
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Purdie @ 2016-05-09 13:07 UTC (permalink / raw)
  To: bitbake-devel

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 <richard.purdie@linuxfoundation.org>

diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index 3544bbe..bf4ac40 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -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 = ""




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] lib/bb/utils.py: Fix explode_dep_versions2() determinism issue
  2016-05-09 13:07 [PATCH] lib/bb/utils.py: Fix explode_dep_versions2() determinism issue Richard Purdie
@ 2016-05-09 16:37 ` Christopher Larson
  0 siblings, 0 replies; 2+ messages in thread
From: Christopher Larson @ 2016-05-09 16:37 UTC (permalink / raw)
  To: Richard Purdie; +Cc: bitbake-devel

[-- Attachment #1: Type: text/plain, Size: 673 bytes --]

On Mon, May 9, 2016 at 6:07 AM, Richard Purdie <
richard.purdie@linuxfoundation.org> wrote:

> 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 <richard.purdie@linuxfoundation.org>
>

Nicely spotted. Looks good.
-- 
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics

[-- Attachment #2: Type: text/html, Size: 1187 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-05-09 16:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-09 13:07 [PATCH] lib/bb/utils.py: Fix explode_dep_versions2() determinism issue Richard Purdie
2016-05-09 16:37 ` Christopher Larson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.