]> code.ossystems Code Review - openembedded-core.git/commitdiff
update-alternatives: Fix determinism issue
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 9 May 2016 13:12:16 +0000 (14:12 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 11 May 2016 09:08:30 +0000 (10:08 +0100)
getVarFlags returns a dict and there is therefore no sort order. This
means the order of the X_VARDEPS_X variables can change and hence the
task checksums can change. This can lead to rebuilds of any parts of
the system using update-alternatives and their dependees. This is a
particular issue under python v3.

Add in a sort to make the order of the variables deterministic.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/update-alternatives.bbclass

index 70a818572c1c58178e0c888430047f314675d6c2..1fdd681315949c2554c991770d577e1c24a14f5a 100644 (file)
@@ -71,14 +71,14 @@ def gen_updatealternativesvardeps(d):
 
     # First compute them for non_pkg versions
     for v in vars:
-        for flag in (d.getVarFlags(v) or {}):
+        for flag in sorted((d.getVarFlags(v) or {}).keys()):
             if flag == "doc" or flag == "vardeps" or flag == "vardepsexp":
                 continue
             d.appendVar('%s_VARDEPS' % (v), ' %s:%s' % (flag, d.getVarFlag(v, flag, False)))
 
     for p in pkgs:
         for v in vars:
-            for flag in (d.getVarFlags("%s_%s" % (v,p)) or {}):
+            for flag in sorted((d.getVarFlags("%s_%s" % (v,p)) or {}).keys()):
                 if flag == "doc" or flag == "vardeps" or flag == "vardepsexp":
                     continue
                 d.appendVar('%s_VARDEPS_%s' % (v,p), ' %s:%s' % (flag, d.getVarFlag('%s_%s' % (v,p), flag, False)))