summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/Workspace
diff options
context:
space:
mode:
authorFeng, Bob C <bob.c.feng@intel.com>2019-09-04 15:53:37 +0800
committerFeng, Bob C <bob.c.feng@intel.com>2019-09-10 08:39:19 +0800
commit000ab98574793b685e7a0f6a6e5032523d5c37c4 (patch)
tree04572c8b7b62f5106678aa32f996203a3f2da77e /BaseTools/Source/Python/Workspace
parent373298ca0d605b29d6f46f5ba57af53e112f59b3 (diff)
downloadedk2-000ab98574793b685e7a0f6a6e5032523d5c37c4.tar.gz
edk2-000ab98574793b685e7a0f6a6e5032523d5c37c4.tar.bz2
edk2-000ab98574793b685e7a0f6a6e5032523d5c37c4.zip
BaseTools: Sort Pcd settings to make PcdTokenNumber be fixed
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> Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/Workspace')
-rw-r--r--BaseTools/Source/Python/Workspace/BuildClassObject.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py b/BaseTools/Source/Python/Workspace/BuildClassObject.py
index 5d2bb73375..db40e3b10c 100644
--- a/BaseTools/Source/Python/Workspace/BuildClassObject.py
+++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py
@@ -14,6 +14,7 @@ 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
@@ -227,6 +228,15 @@ class PcdClassObject(object):
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