From: "Bob Feng" <bob.c.feng@intel.com>
To: devel@edk2.groups.io
Cc: Bob Feng <bob.c.feng@intel.com>,
Liming Gao <liming.gao@intel.com>,
Steven Shi <steven.shi@intel.com>
Subject: [Patch 1/1] BaseTools: Sort Pcd settings to make PcdTokenNumber be fixed
Date: Wed, 4 Sep 2019 15:53:37 +0800 [thread overview]
Message-ID: <20190904075337.19764-1-bob.c.feng@intel.com> (raw)
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.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Steven Shi <steven.shi@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
next reply other threads:[~2019-09-04 7:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-04 7:53 Bob Feng [this message]
2019-09-09 6:46 ` [edk2-devel] [Patch 1/1] BaseTools: Sort Pcd settings to make PcdTokenNumber be fixed Liming Gao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190904075337.19764-1-bob.c.feng@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox