BaseTool: Replace dict with OrderedDict.
Replace dict with OrderedDict for PCD so that the pcd list has same order. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
@ -64,6 +64,7 @@ from Common.LongFilePathSupport import OpenLongFilePath as open
|
|||||||
from .Capsule import EFI_CERT_TYPE_PKCS7_GUID
|
from .Capsule import EFI_CERT_TYPE_PKCS7_GUID
|
||||||
from .Capsule import EFI_CERT_TYPE_RSA2048_SHA256_GUID
|
from .Capsule import EFI_CERT_TYPE_RSA2048_SHA256_GUID
|
||||||
from Common.RangeExpression import RangeExpression
|
from Common.RangeExpression import RangeExpression
|
||||||
|
from collections import OrderedDict
|
||||||
|
|
||||||
##define T_CHAR_SPACE ' '
|
##define T_CHAR_SPACE ' '
|
||||||
##define T_CHAR_NULL '\0'
|
##define T_CHAR_NULL '\0'
|
||||||
@ -227,8 +228,8 @@ class FileProfile :
|
|||||||
EdkLogger.error("FdfParser", FILE_OPEN_FAILURE, ExtraData=FileName)
|
EdkLogger.error("FdfParser", FILE_OPEN_FAILURE, ExtraData=FileName)
|
||||||
|
|
||||||
self.FileName = FileName
|
self.FileName = FileName
|
||||||
self.PcdDict = {}
|
self.PcdDict = OrderedDict()
|
||||||
self.PcdLocalDict = {}
|
self.PcdLocalDict = OrderedDict()
|
||||||
self.InfList = []
|
self.InfList = []
|
||||||
self.InfDict = {'ArchTBD':[]}
|
self.InfDict = {'ArchTBD':[]}
|
||||||
# ECC will use this Dict and List information
|
# ECC will use this Dict and List information
|
||||||
@ -274,7 +275,7 @@ class FdfParser:
|
|||||||
# Key: [section name, UI name, arch]
|
# Key: [section name, UI name, arch]
|
||||||
# Value: {MACRO_NAME : MACRO_VALUE}
|
# Value: {MACRO_NAME : MACRO_VALUE}
|
||||||
self.__MacroDict = tdict(True, 3)
|
self.__MacroDict = tdict(True, 3)
|
||||||
self.__PcdDict = {}
|
self.__PcdDict = OrderedDict()
|
||||||
|
|
||||||
self.__WipeOffArea = []
|
self.__WipeOffArea = []
|
||||||
if GenFdsGlobalVariable.WorkSpaceDir == '':
|
if GenFdsGlobalVariable.WorkSpaceDir == '':
|
||||||
|
@ -13,7 +13,11 @@
|
|||||||
|
|
||||||
from collections import OrderedDict, namedtuple
|
from collections import OrderedDict, namedtuple
|
||||||
from Common.DataType import *
|
from Common.DataType import *
|
||||||
|
import collections
|
||||||
|
import re
|
||||||
|
from collections import OrderedDict
|
||||||
|
StructPattern = re.compile(r'[_a-zA-Z][0-9A-Za-z_\[\]]*$')
|
||||||
|
ArrayIndex = re.compile("\[\s*\d{0,1}\s*\]")
|
||||||
## PcdClassObject
|
## PcdClassObject
|
||||||
#
|
#
|
||||||
# This Class is used for PcdObject
|
# This Class is used for PcdObject
|
||||||
@ -41,7 +45,7 @@ from Common.DataType import *
|
|||||||
# @var Phase: To store value for Phase, default is "DXE"
|
# @var Phase: To store value for Phase, default is "DXE"
|
||||||
#
|
#
|
||||||
class PcdClassObject(object):
|
class PcdClassObject(object):
|
||||||
def __init__(self, Name = None, Guid = None, Type = None, DatumType = None, Value = None, Token = None, MaxDatumSize = None, SkuInfoList = {}, IsOverrided = False, GuidValue = None, validateranges = [], validlists = [], expressions = [], IsDsc = False, UserDefinedDefaultStoresFlag = False):
|
def __init__(self, Name = None, Guid = None, Type = None, DatumType = None, Value = None, Token = None, MaxDatumSize = None, SkuInfoList = None, IsOverrided = False, GuidValue = None, validateranges = None, validlists = None, expressions = None, IsDsc = False, UserDefinedDefaultStoresFlag = False):
|
||||||
self.TokenCName = Name
|
self.TokenCName = Name
|
||||||
self.TokenSpaceGuidCName = Guid
|
self.TokenSpaceGuidCName = Guid
|
||||||
self.TokenSpaceGuidValue = GuidValue
|
self.TokenSpaceGuidValue = GuidValue
|
||||||
@ -51,15 +55,15 @@ class PcdClassObject(object):
|
|||||||
self.TokenValue = Token
|
self.TokenValue = Token
|
||||||
self.MaxDatumSize = MaxDatumSize
|
self.MaxDatumSize = MaxDatumSize
|
||||||
self.MaxSizeUserSet = None
|
self.MaxSizeUserSet = None
|
||||||
self.SkuInfoList = SkuInfoList
|
self.SkuInfoList = SkuInfoList if SkuInfoList is not None else OrderedDict()
|
||||||
self.Phase = "DXE"
|
self.Phase = "DXE"
|
||||||
self.Pending = False
|
self.Pending = False
|
||||||
self.IsOverrided = IsOverrided
|
self.IsOverrided = IsOverrided
|
||||||
self.IsFromBinaryInf = False
|
self.IsFromBinaryInf = False
|
||||||
self.IsFromDsc = False
|
self.IsFromDsc = False
|
||||||
self.validateranges = validateranges
|
self.validateranges = validateranges if validateranges is not None else []
|
||||||
self.validlists = validlists
|
self.validlists = validlists if validlists is not None else []
|
||||||
self.expressions = expressions
|
self.expressions = expressions if expressions is not None else []
|
||||||
self.DscDefaultValue = None
|
self.DscDefaultValue = None
|
||||||
self.DscRawValue = {}
|
self.DscRawValue = {}
|
||||||
if IsDsc:
|
if IsDsc:
|
||||||
|
@ -1287,12 +1287,17 @@ class DscBuildData(PlatformBuildClassObject):
|
|||||||
if len(commpcds[0]) == 5:
|
if len(commpcds[0]) == 5:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
NoFiledValues = OrderedDict()
|
||||||
if CheckStructureInComm(GlobalData.BuildOptionPcd):
|
if CheckStructureInComm(GlobalData.BuildOptionPcd):
|
||||||
StructurePcdInCom = {(item[0], item[1], item[2] ):(item[3], item[4]) for item in GlobalData.BuildOptionPcd } if GlobalData.BuildOptionPcd else {}
|
StructurePcdInCom = OrderedDict()
|
||||||
NoFiledValues = {(item[0], item[1]):StructurePcdInCom[item] for item in StructurePcdInCom if not item[2]}
|
for item in GlobalData.BuildOptionPcd:
|
||||||
|
StructurePcdInCom[(item[0], item[1], item[2] )] = (item[3], item[4])
|
||||||
|
for item in StructurePcdInCom:
|
||||||
|
if not item[2]:
|
||||||
|
NoFiledValues[(item[0], item[1])] = StructurePcdInCom[item]
|
||||||
else:
|
else:
|
||||||
NoFiledValues = {(item[0], item[1]):[item[2]] for item in GlobalData.BuildOptionPcd}
|
for item in GlobalData.BuildOptionPcd:
|
||||||
|
NoFiledValues[(item[0], item[1])] = [item[2]]
|
||||||
for Guid, Name in NoFiledValues:
|
for Guid, Name in NoFiledValues:
|
||||||
if (Name, Guid) in AllPcds:
|
if (Name, Guid) in AllPcds:
|
||||||
Pcd = AllPcds.get((Name, Guid))
|
Pcd = AllPcds.get((Name, Guid))
|
||||||
@ -2219,7 +2224,7 @@ class DscBuildData(PlatformBuildClassObject):
|
|||||||
'include $(MAKEROOT)/Makefiles/app.makefile\n' + 'INCLUDE +='
|
'include $(MAKEROOT)/Makefiles/app.makefile\n' + 'INCLUDE +='
|
||||||
|
|
||||||
IncSearchList = []
|
IncSearchList = []
|
||||||
PlatformInc = {}
|
PlatformInc = OrderedDict()
|
||||||
for Cache in self._Bdb._CACHE_.values():
|
for Cache in self._Bdb._CACHE_.values():
|
||||||
if Cache.MetaFile.Ext.lower() != '.dec':
|
if Cache.MetaFile.Ext.lower() != '.dec':
|
||||||
continue
|
continue
|
||||||
@ -2249,7 +2254,7 @@ class DscBuildData(PlatformBuildClassObject):
|
|||||||
CC_FLAGS = LinuxCFLAGS
|
CC_FLAGS = LinuxCFLAGS
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
CC_FLAGS = WindowsCFLAGS
|
CC_FLAGS = WindowsCFLAGS
|
||||||
BuildOptions = {}
|
BuildOptions = OrderedDict()
|
||||||
for Options in self.BuildOptions:
|
for Options in self.BuildOptions:
|
||||||
if Options[2] != EDKII_NAME:
|
if Options[2] != EDKII_NAME:
|
||||||
continue
|
continue
|
||||||
@ -2264,7 +2269,7 @@ class DscBuildData(PlatformBuildClassObject):
|
|||||||
if Tag == "*" or Tag == self._Toolchain:
|
if Tag == "*" or Tag == self._Toolchain:
|
||||||
if Arch == "*" or Arch == self.Arch:
|
if Arch == "*" or Arch == self.Arch:
|
||||||
if Tool not in BuildOptions:
|
if Tool not in BuildOptions:
|
||||||
BuildOptions[Tool] = {}
|
BuildOptions[Tool] = OrderedDict()
|
||||||
if Attr != "FLAGS" or Attr not in BuildOptions[Tool] or self.BuildOptions[Options].startswith('='):
|
if Attr != "FLAGS" or Attr not in BuildOptions[Tool] or self.BuildOptions[Options].startswith('='):
|
||||||
BuildOptions[Tool][Attr] = self.BuildOptions[Options]
|
BuildOptions[Tool][Attr] = self.BuildOptions[Options]
|
||||||
else:
|
else:
|
||||||
@ -2469,7 +2474,7 @@ class DscBuildData(PlatformBuildClassObject):
|
|||||||
PcdValue,
|
PcdValue,
|
||||||
'',
|
'',
|
||||||
MaxDatumSize,
|
MaxDatumSize,
|
||||||
{SkuName : SkuInfo},
|
OrderedDict({SkuName : SkuInfo}),
|
||||||
False,
|
False,
|
||||||
None,
|
None,
|
||||||
IsDsc=True)
|
IsDsc=True)
|
||||||
@ -2526,7 +2531,7 @@ class DscBuildData(PlatformBuildClassObject):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def CompletePcdValues(self, PcdSet):
|
def CompletePcdValues(self, PcdSet):
|
||||||
Pcds = {}
|
Pcds = OrderedDict()
|
||||||
DefaultStoreObj = DefaultStore(self._GetDefaultStores())
|
DefaultStoreObj = DefaultStore(self._GetDefaultStores())
|
||||||
SkuIds = {skuname:skuid for skuname, skuid in self.SkuIdMgr.AvailableSkuIdSet.items() if skuname != TAB_COMMON}
|
SkuIds = {skuname:skuid for skuname, skuid in self.SkuIdMgr.AvailableSkuIdSet.items() if skuname != TAB_COMMON}
|
||||||
DefaultStores = set(storename for pcdobj in PcdSet.values() for skuobj in pcdobj.SkuInfoList.values() for storename in skuobj.DefaultStoreDict)
|
DefaultStores = set(storename for pcdobj in PcdSet.values() for skuobj in pcdobj.SkuInfoList.values() for storename in skuobj.DefaultStoreDict)
|
||||||
@ -2664,7 +2669,7 @@ class DscBuildData(PlatformBuildClassObject):
|
|||||||
DefaultValue,
|
DefaultValue,
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
{SkuName : SkuInfo},
|
OrderedDict({SkuName : SkuInfo}),
|
||||||
False,
|
False,
|
||||||
None,
|
None,
|
||||||
pcdDecObject.validateranges,
|
pcdDecObject.validateranges,
|
||||||
@ -2808,7 +2813,7 @@ class DscBuildData(PlatformBuildClassObject):
|
|||||||
InitialValue,
|
InitialValue,
|
||||||
'',
|
'',
|
||||||
MaxDatumSize,
|
MaxDatumSize,
|
||||||
{SkuName : SkuInfo},
|
OrderedDict({SkuName : SkuInfo}),
|
||||||
False,
|
False,
|
||||||
None,
|
None,
|
||||||
IsDsc=True)
|
IsDsc=True)
|
||||||
|
Reference in New Issue
Block a user