Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 1 | From b6f9b3f6fa782807c4a7ec16ee8ef868cdfbf468 Mon Sep 17 00:00:00 2001 |
| 2 | From: Naveen Saini <naveen.kumar.saini@intel.com> |
| 3 | Date: Mon, 15 Mar 2021 14:56:18 +0800 |
| 4 | Subject: [PATCH] The output in moddep.lst generated from syminfo.lst using |
| 5 | genmoddep.awk is not deterministic since the order of the dependencies on |
| 6 | each line can vary depending on how awk sorts the values in the array. |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 7 | |
| 8 | Be deterministic in the output by sorting the dependencies on each line. |
| 9 | |
| 10 | Also, the output of the SOURCES lines in grub-core/Makefile.core.am, generated |
| 11 | from grub-core/Makefile.core.def with gentpl.py is not deterministic due to |
| 12 | missing sorting of the list used to generate it. Add such a sort. |
| 13 | |
| 14 | Also ensure the generated unidata.c file is deterministic by sorting the |
| 15 | keys of the dict. |
| 16 | |
| 17 | Upstream-Status: Pending |
| 18 | Richard Purdie <richard.purdie@linuxfoundation.org> |
Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 19 | Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com> |
| 20 | --- |
| 21 | gentpl.py | 1 + |
| 22 | grub-core/genmoddep.awk | 4 +++- |
| 23 | util/import_unicode.py | 2 +- |
| 24 | 3 files changed, 5 insertions(+), 2 deletions(-) |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 25 | |
Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 26 | diff --git a/gentpl.py b/gentpl.py |
| 27 | index c86550d4f..589285192 100644 |
| 28 | --- a/gentpl.py |
| 29 | +++ b/gentpl.py |
| 30 | @@ -568,6 +568,7 @@ def foreach_platform_value(defn, platform, suffix, closure): |
| 31 | for group in RMAP[platform]: |
| 32 | for value in defn.find_all(group + suffix): |
| 33 | r.append(closure(value)) |
| 34 | + r.sort() |
| 35 | return ''.join(r) |
| 36 | |
| 37 | def platform_conditional(platform, closure): |
| 38 | diff --git a/grub-core/genmoddep.awk b/grub-core/genmoddep.awk |
| 39 | index 04c2863e5..247436392 100644 |
| 40 | --- a/grub-core/genmoddep.awk |
| 41 | +++ b/grub-core/genmoddep.awk |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 42 | @@ -59,7 +59,9 @@ END { |
| 43 | } |
| 44 | modlist = "" |
| 45 | depcount[mod] = 0 |
| 46 | - for (depmod in uniqmods) { |
| 47 | + n = asorti(uniqmods, w) |
| 48 | + for (i = 1; i <= n; i++) { |
| 49 | + depmod = w[i] |
| 50 | modlist = modlist " " depmod; |
| 51 | inverse_dependencies[depmod] = inverse_dependencies[depmod] " " mod |
| 52 | depcount[mod]++ |
Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 53 | diff --git a/util/import_unicode.py b/util/import_unicode.py |
| 54 | index 08f80591e..1f434a069 100644 |
| 55 | --- a/util/import_unicode.py |
| 56 | +++ b/util/import_unicode.py |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 57 | @@ -174,7 +174,7 @@ infile.close () |
| 58 | |
| 59 | outfile.write ("struct grub_unicode_arabic_shape grub_unicode_arabic_shapes[] = {\n ") |
| 60 | |
| 61 | -for x in arabicsubst: |
| 62 | +for x in sorted(arabicsubst): |
| 63 | try: |
| 64 | if arabicsubst[x]['join'] == "DUAL": |
| 65 | 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])) |
Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 66 | -- |
| 67 | 2.17.1 |
| 68 | |