make-event-names: Fix determinism issue
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Sat, 20 Feb 2021 14:41:01 +0000 (14:41 +0000)
committerJihoon Kim <jihoon48.kim@samsung.com>
Fri, 17 Nov 2023 10:41:23 +0000 (19:41 +0900)
The order of dict values is not deterministic in python leading to differing 
header file generation which results in differing build output for the same
configuration. Sort to remove this inconsistency and make the output 
reproducible.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Reviewed-by: Filipe Laíns <lains@archlinux.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
libevdev/make-event-names.py

index 88addd77e3583e06a9f2c3772dde778c2ef83c19..743b4b58b170f6da0c09e57dcc908ec0a879bf96 100755 (executable)
@@ -70,10 +70,10 @@ def print_bits(bits, prefix):
     if not hasattr(bits, prefix):
         return
     print("static const char * const %s_map[%s_MAX + 1] = {" % (prefix, prefix.upper()))
-    for val, name in list(getattr(bits, prefix).items()):
+    for val, name in sorted(list(getattr(bits, prefix).items())):
         print("    [%s] = \"%s\"," % (name, name))
     if prefix == "key":
-        for val, name in list(getattr(bits, "btn").items()):
+        for val, name in sorted(list(getattr(bits, "btn").items())):
             print("    [%s] = \"%s\"," % (name, name))
     print("};")
     print("")
@@ -118,7 +118,7 @@ def print_lookup(bits, prefix):
     if not hasattr(bits, prefix):
         return
 
-    names = list(getattr(bits, prefix).items())
+    names = sorted(list(getattr(bits, prefix).items()))
     if prefix == "btn":
         names = names + btn_additional