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>
This commit is contained in:
Feng, Bob C
2019-09-04 15:53:37 +08:00
parent 373298ca0d
commit 000ab98574
2 changed files with 12 additions and 1 deletions

View File

@ -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