| From b6f9b3f6fa782807c4a7ec16ee8ef868cdfbf468 Mon Sep 17 00:00:00 2001 |
| From: Naveen Saini <naveen.kumar.saini@intel.com> |
| Date: Mon, 15 Mar 2021 14:56:18 +0800 |
| Subject: [PATCH] The output in moddep.lst generated from syminfo.lst using |
| genmoddep.awk is not deterministic since the order of the dependencies on |
| each line can vary depending on how awk sorts the values in the array. |
| |
| Be deterministic in the output by sorting the dependencies on each line. |
| |
| Also, the output of the SOURCES lines in grub-core/Makefile.core.am, generated |
| from grub-core/Makefile.core.def with gentpl.py is not deterministic due to |
| missing sorting of the list used to generate it. Add such a sort. |
| |
| Also ensure the generated unidata.c file is deterministic by sorting the |
| keys of the dict. |
| |
| Upstream-Status: Pending |
| Richard Purdie <richard.purdie@linuxfoundation.org> |
| Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com> |
| --- |
| gentpl.py | 1 + |
| grub-core/genmoddep.awk | 4 +++- |
| util/import_unicode.py | 2 +- |
| 3 files changed, 5 insertions(+), 2 deletions(-) |
| |
| diff --git a/gentpl.py b/gentpl.py |
| index c86550d4f..589285192 100644 |
| --- a/gentpl.py |
| +++ b/gentpl.py |
| @@ -568,6 +568,7 @@ def foreach_platform_value(defn, platform, suffix, closure): |
| for group in RMAP[platform]: |
| for value in defn.find_all(group + suffix): |
| r.append(closure(value)) |
| + r.sort() |
| return ''.join(r) |
| |
| def platform_conditional(platform, closure): |
| diff --git a/grub-core/genmoddep.awk b/grub-core/genmoddep.awk |
| index 04c2863e5..247436392 100644 |
| --- a/grub-core/genmoddep.awk |
| +++ b/grub-core/genmoddep.awk |
| @@ -59,7 +59,9 @@ END { |
| } |
| modlist = "" |
| depcount[mod] = 0 |
| - for (depmod in uniqmods) { |
| + n = asorti(uniqmods, w) |
| + for (i = 1; i <= n; i++) { |
| + depmod = w[i] |
| modlist = modlist " " depmod; |
| inverse_dependencies[depmod] = inverse_dependencies[depmod] " " mod |
| depcount[mod]++ |
| diff --git a/util/import_unicode.py b/util/import_unicode.py |
| index 08f80591e..1f434a069 100644 |
| --- a/util/import_unicode.py |
| +++ b/util/import_unicode.py |
| @@ -174,7 +174,7 @@ infile.close () |
| |
| outfile.write ("struct grub_unicode_arabic_shape grub_unicode_arabic_shapes[] = {\n ") |
| |
| -for x in arabicsubst: |
| +for x in sorted(arabicsubst): |
| try: |
| if arabicsubst[x]['join'] == "DUAL": |
| outfile.write ("{0x%x, 0x%x, 0x%x, 0x%x, 0x%x},\n " % (arabicsubst[x][0], arabicsubst[x][1], arabicsubst[x][2], arabicsubst[x][3], arabicsubst[x][4])) |
| -- |
| 2.17.1 |
| |