util/spd_tools: Sort platforms_manifest entries by set number

Ensure that the order of entries in each platform manifest is consistent
every time spd_gen is run.

BUG=b:191776301
TEST=Run spd_gen for lp4x and ddr4, check that the manifests are
unchanged.

Change-Id: I7bfea65c8fc781df80a8725c0cf20c7547c857e8
Signed-off-by: Reka Norman <rekanorman@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/57773
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
This commit is contained in:
Reka Norman 2021-09-20 12:19:16 +10:00 committed by Furquan Shaikh
parent 273a9eb830
commit 8f690dd762
1 changed files with 10 additions and 3 deletions

View File

@ -10,6 +10,7 @@ import (
"path/filepath"
"reflect"
"regexp"
"sort"
"strings"
)
@ -191,9 +192,15 @@ func writeSetMap(setMap map[int][]int, SPDDirName string) {
s += getGeneratedString()
for index, arr := range setMap {
for _, item := range arr {
s += fmt.Sprintf("%s,set-%d\n", platformNames[item], index)
var setNumbers []int
for k, _ := range setMap {
setNumbers = append(setNumbers, k)
}
sort.Ints(setNumbers)
for _, num := range setNumbers {
for _, item := range setMap[num] {
s += fmt.Sprintf("%s,set-%d\n", platformNames[item], num)
}
}