BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2147
This patch is to sort the Pcd settings so that PcdTokenNumber will not change if the platform's Pcd settings are the same. Signed-off-by: Bob Feng <bob.c.f...@intel.com> Cc: Liming Gao <liming....@intel.com> Cc: Steven Shi <steven....@intel.com> --- BaseTools/Source/Python/AutoGen/PlatformAutoGen.py | 3 ++- BaseTools/Source/Python/Workspace/BuildClassObject.py | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py index 565424a95ead..a16918fd3178 100644 --- a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py +++ b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py @@ -437,11 +437,11 @@ class PlatformAutoGen(AutoGen): NoDatumTypePcdListString = "\n\t\t".join(NoDatumTypePcdList) EdkLogger.error("build", AUTOGEN_ERROR, "PCD setting error", File=self.MetaFile, ExtraData="\n\tPCD(s) without MaxDatumSize:\n\t\t%s\n" % NoDatumTypePcdListString) - self._NonDynamicPcdList = self._NonDynaPcdList_ + self._NonDynamicPcdList = sorted(self._NonDynaPcdList_) self._DynamicPcdList = self._DynaPcdList_ def SortDynamicPcd(self): # # Sort dynamic PCD list to: @@ -700,10 +700,11 @@ class PlatformAutoGen(AutoGen): OtherPcdArray.add(Pcd) del self._DynamicPcdList[:] self._DynamicPcdList.extend(list(UnicodePcdArray)) self._DynamicPcdList.extend(list(HiiPcdArray)) self._DynamicPcdList.extend(list(OtherPcdArray)) + self._DynamicPcdList.sort() allskuset = [(SkuName, Sku.SkuId) for pcd in self._DynamicPcdList for (SkuName, Sku) in pcd.SkuInfoList.items()] for pcd in self._DynamicPcdList: if len(pcd.SkuInfoList) == 1: for (SkuName, SkuId) in allskuset: if isinstance(SkuId, str) and eval(SkuId) == 0 or SkuId == 0: diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py b/BaseTools/Source/Python/Workspace/BuildClassObject.py index 5d2bb733752a..db40e3b10c3c 100644 --- a/BaseTools/Source/Python/Workspace/BuildClassObject.py +++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py @@ -12,10 +12,11 @@ import re from collections import OrderedDict from Common.Misc import CopyDict,ArrayIndex import copy import Common.EdkLogger as EdkLogger from Common.BuildToolError import OPTION_VALUE_INVALID +from Common.caching import cached_property StructPattern = re.compile(r'[_a-zA-Z][0-9A-Za-z_\[\]]*$') ## PcdClassObject # # This Class is used for PcdObject @@ -225,10 +226,19 @@ class PcdClassObject(object): # @retval truple() Key for hash table # def __hash__(self): return hash((self.TokenCName, self.TokenSpaceGuidCName)) + @cached_property + def _fullname(self): + return ".".join((self.TokenSpaceGuidCName,self.TokenCName)) + + def __lt__(self,pcd): + return self._fullname < pcd._fullname + def __gt__(self,pcd): + return self._fullname > pcd._fullname + def sharedcopy(self,new_pcd): new_pcd.TokenCName = self.TokenCName new_pcd.TokenSpaceGuidCName = self.TokenSpaceGuidCName new_pcd.TokenSpaceGuidValue = self.TokenSpaceGuidValue new_pcd.Type = self.Type -- 2.20.1.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#46759): https://edk2.groups.io/g/devel/message/46759 Mute This Topic: https://groups.io/mt/33135853/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-