]> code.ossystems Code Review - openembedded-core.git/commitdiff
buildhistory: output package variables in a repeatable order
authorRoss Burton <ross.burton@intel.com>
Mon, 8 Aug 2016 13:01:45 +0000 (14:01 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 10 Aug 2016 09:45:32 +0000 (10:45 +0100)
This code was outputting variables by iterating a dictionary.  In Py2 this
always results in the same iteration order but with Py3 the order changes every
execution, which resulted in buildhistory having to store diffs where fields
were simply re-ordered.

Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/classes/buildhistory.bbclass

index 2db9145abd221d0446609ee5a13f664c4c416701..6e5de0ef69c3e76b83efc4bc2070f4af99984c3f 100644 (file)
@@ -318,16 +318,14 @@ def write_pkghistory(pkginfo, d):
         f.write(u"PV = %s\n" %  pkginfo.pv)
         f.write(u"PR = %s\n" %  pkginfo.pr)
 
-        pkgvars = {}
-        pkgvars['PKG'] = pkginfo.pkg if pkginfo.pkg != pkginfo.name else ''
-        pkgvars['PKGE'] = pkginfo.pkge if pkginfo.pkge != pkginfo.pe else ''
-        pkgvars['PKGV'] = pkginfo.pkgv if pkginfo.pkgv != pkginfo.pv else ''
-        pkgvars['PKGR'] = pkginfo.pkgr if pkginfo.pkgr != pkginfo.pr else ''
-        for pkgvar in pkgvars:
-            val = pkgvars[pkgvar]
-            if val:
-                f.write(u"%s = %s\n" % (pkgvar, val))
-
+        if pkginfo.pkg != pkginfo.name:
+            f.write(u"PKG = %s\n" % pkginfo.pkg)
+        if pkginfo.pkge != pkginfo.pe:
+            f.write(u"PKGE = %s\n" % pkginfo.pkge)
+        if pkginfo.pkgv != pkginfo.pv:
+            f.write(u"PKGV = %s\n" % pkginfo.pkgv)
+        if pkginfo.pkgr != pkginfo.pr:
+            f.write(u"PKGR = %s\n" % pkginfo.pkgr)
         f.write(u"RPROVIDES = %s\n" %  pkginfo.rprovides)
         f.write(u"RDEPENDS = %s\n" %  pkginfo.rdepends)
         f.write(u"RRECOMMENDS = %s\n" %  pkginfo.rrecommends)