dcavalca / rpms / qemu

Forked from rpms/qemu a year ago
Clone

Blame 0001-qapi-ensure-stable-sort-ordering-when-checking-QAPI-.patch

Daniel P. Berrangé 28d4d1
From f7a5376d4b667cf6c83c1d640e32d22456d7b5ee Mon Sep 17 00:00:00 2001
Daniel P. Berrangé 28d4d1
From: "Daniel P. Berrange" <berrange@redhat.com>
Daniel P. Berrangé 28d4d1
Date: Tue, 16 Jan 2018 13:42:10 +0000
Daniel P. Berrangé 28d4d1
Subject: [PATCH] qapi: ensure stable sort ordering when checking QAPI entities
Daniel P. Berrangé 28d4d1
MIME-Version: 1.0
Daniel P. Berrangé 28d4d1
Content-Type: text/plain; charset=UTF-8
Daniel P. Berrangé 28d4d1
Content-Transfer-Encoding: 8bit
Daniel P. Berrangé 28d4d1
Daniel P. Berrangé 28d4d1
Some early python 3.x versions will have different default
Daniel P. Berrangé 28d4d1
ordering when calling the 'values()' method on a dict, compared
Daniel P. Berrangé 28d4d1
to python 2.x and later 3.x versions. Explicitly sort the items
Daniel P. Berrangé 28d4d1
to get a stable ordering.
Daniel P. Berrangé 28d4d1
Daniel P. Berrangé 28d4d1
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Daniel P. Berrangé 28d4d1
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Daniel P. Berrangé 28d4d1
Message-Id: <20180116134217.8725-8-berrange@redhat.com>
Daniel P. Berrangé 28d4d1
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Daniel P. Berrangé 28d4d1
---
Daniel P. Berrangé 28d4d1
 scripts/qapi.py | 2 +-
Daniel P. Berrangé 28d4d1
 1 file changed, 1 insertion(+), 1 deletion(-)
Daniel P. Berrangé 28d4d1
Daniel P. Berrangé 28d4d1
diff --git a/scripts/qapi.py b/scripts/qapi.py
Daniel P. Berrangé 28d4d1
index 1fdd189c0d..58f995b07f 100644
Daniel P. Berrangé 28d4d1
--- a/scripts/qapi.py
Daniel P. Berrangé 28d4d1
+++ b/scripts/qapi.py
Daniel P. Berrangé 28d4d1
@@ -1678,7 +1678,7 @@ class QAPISchema(object):
Daniel P. Berrangé 28d4d1
                 assert False
Daniel P. Berrangé 28d4d1
 
Daniel P. Berrangé 28d4d1
     def check(self):
Daniel P. Berrangé 28d4d1
-        for ent in self._entity_dict.values():
Daniel P. Berrangé 28d4d1
+        for (name, ent) in sorted(self._entity_dict.items()):
Daniel P. Berrangé 28d4d1
             ent.check(self)
Daniel P. Berrangé 28d4d1
 
Daniel P. Berrangé 28d4d1
     def visit(self, visitor):
Daniel P. Berrangé 28d4d1
-- 
Daniel P. Berrangé 28d4d1
2.14.3
Daniel P. Berrangé 28d4d1