BaseTools: Correct PCD generation logic to make sure DB is use

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Feng Bob C <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Liming Gao 2017-12-18 12:42:41 +08:00
parent 0b6c5954e1
commit 67e63e9a7b
1 changed files with 20 additions and 20 deletions

View File

@ -1014,25 +1014,6 @@ class DscBuildData(PlatformBuildClassObject):
for stru_pcd in S_pcd_set.values(): for stru_pcd in S_pcd_set.values():
if stru_pcd.Type not in DynamicPcdType: if stru_pcd.Type not in DynamicPcdType:
continue continue
if stru_pcd.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII], self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]:
for skuid in SkuIds:
nextskuid = skuid
NoDefault = False
if skuid not in stru_pcd.SkuOverrideValues:
while nextskuid not in stru_pcd.SkuOverrideValues:
if nextskuid == "DEFAULT":
NoDefault = True
break
nextskuid = self.SkuIdMgr.GetNextSkuId(nextskuid)
stru_pcd.SkuOverrideValues[skuid] = {}
if NoDefault:
continue
PcdDefaultStoreSet = set([defaultstorename for defaultstorename in stru_pcd.SkuOverrideValues[nextskuid]])
mindefaultstorename = DefaultStoreMgr.GetMin(PcdDefaultStoreSet)
for defaultstoreid in DefaultStores:
if defaultstoreid not in stru_pcd.SkuOverrideValues[skuid]:
stru_pcd.SkuOverrideValues[skuid][defaultstoreid] = copy.deepcopy(stru_pcd.SkuOverrideValues[nextskuid][mindefaultstorename])
for skuid in SkuIds: for skuid in SkuIds:
if skuid in stru_pcd.SkuOverrideValues: if skuid in stru_pcd.SkuOverrideValues:
continue continue
@ -1043,13 +1024,32 @@ class DscBuildData(PlatformBuildClassObject):
NoDefault = True NoDefault = True
break break
nextskuid = self.SkuIdMgr.GetNextSkuId(nextskuid) nextskuid = self.SkuIdMgr.GetNextSkuId(nextskuid)
stru_pcd.SkuOverrideValues[skuid] = copy.deepcopy(stru_pcd.SkuOverrideValues[nextskuid]) if not NoDefault else copy.deepcopy({defaultstorename: stru_pcd.DefaultValues for defaultstorename in DefaultStores}) stru_pcd.SkuOverrideValues[skuid] = copy.deepcopy(stru_pcd.SkuOverrideValues[nextskuid]) if not NoDefault else copy.deepcopy({defaultstorename: stru_pcd.DefaultValues for defaultstorename in DefaultStores} if DefaultStores else {'STANDARD':stru_pcd.DefaultValues})
if stru_pcd.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII], self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]:
for skuid in SkuIds:
nextskuid = skuid
NoDefault = False
if skuid not in stru_pcd.SkuOverrideValues:
while nextskuid not in stru_pcd.SkuOverrideValues:
if nextskuid == "DEFAULT":
NoDefault = True
break
nextskuid = self.SkuIdMgr.GetNextSkuId(nextskuid)
if NoDefault:
continue
PcdDefaultStoreSet = set([defaultstorename for defaultstorename in stru_pcd.SkuOverrideValues[nextskuid]])
mindefaultstorename = DefaultStoreMgr.GetMin(PcdDefaultStoreSet)
for defaultstoreid in DefaultStores:
if defaultstoreid not in stru_pcd.SkuOverrideValues[skuid]:
stru_pcd.SkuOverrideValues[skuid][defaultstoreid] = copy.deepcopy(stru_pcd.SkuOverrideValues[nextskuid][mindefaultstorename])
Str_Pcd_Values = self.GenerateByteArrayValue(S_pcd_set) Str_Pcd_Values = self.GenerateByteArrayValue(S_pcd_set)
if Str_Pcd_Values: if Str_Pcd_Values:
for (skuname,StoreName,PcdGuid,PcdName,PcdValue) in Str_Pcd_Values: for (skuname,StoreName,PcdGuid,PcdName,PcdValue) in Str_Pcd_Values:
str_pcd_obj = S_pcd_set.get((PcdName, PcdGuid)) str_pcd_obj = S_pcd_set.get((PcdName, PcdGuid))
if str_pcd_obj is None: if str_pcd_obj is None:
print PcdName, PcdGuid
raise raise
if str_pcd_obj.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII], if str_pcd_obj.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII],
self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]: self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]: