X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=BaseTools%2FSource%2FPython%2FWorkspace%2FDscBuildData.py;h=129c0c950b25869e97f170a3a7d44f9e9fe570b3;hb=a004d17d01a9fa5275e902085cc1860c8c18d0f6;hp=e45beb3924a68921c176138f942241cbe45f1774;hpb=68c67d3a2a33261e41ff0123129b4e9759617f71;p=mirror_edk2.git diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index e45beb3924..129c0c950b 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -155,15 +155,14 @@ def GetDependencyList(FileStack, SearchPathList): if len(FileContent) == 0: continue - if FileContent[0] == 0xff or FileContent[0] == 0xfe: - FileContent = FileContent.decode('utf-16') - IncludedFileList = gIncludePattern.findall(FileContent) - else: - try: - FileContent = str(FileContent) - IncludedFileList = gIncludePattern.findall(FileContent) - except: - pass + try: + if FileContent[0] == 0xff or FileContent[0] == 0xfe: + FileContent = FileContent.decode('utf-16') + else: + FileContent = FileContent.decode() + except: + # The file is not txt file. for example .mcb file + continue IncludedFileList = gIncludePattern.findall(FileContent) for Inc in IncludedFileList: @@ -249,7 +248,6 @@ class DscBuildData(PlatformBuildClassObject): self._Toolchain = Toolchain self._ToolChainFamily = None self._Clear() - self._HandleOverridePath() self.WorkspaceDir = os.getenv("WORKSPACE") if os.getenv("WORKSPACE") else "" self.DefaultStores = None self.SkuIdMgr = SkuClass(self.SkuName, self.SkuIds) @@ -308,24 +306,6 @@ class DscBuildData(PlatformBuildClassObject): self._MacroDict = None self.DefaultStores = None - ## handle Override Path of Module - def _HandleOverridePath(self): - RecordList = self._RawData[MODEL_META_DATA_COMPONENT, self._Arch] - for Record in RecordList: - ModuleId = Record[6] - LineNo = Record[7] - ModuleFile = PathClass(NormPath(Record[0]), GlobalData.gWorkspace, Arch=self._Arch) - RecordList = self._RawData[MODEL_META_DATA_COMPONENT_SOURCE_OVERRIDE_PATH, self._Arch, None, ModuleId] - if RecordList != []: - SourceOverridePath = mws.join(GlobalData.gWorkspace, NormPath(RecordList[0][0])) - - # Check if the source override path exists - if not os.path.isdir(SourceOverridePath): - EdkLogger.error('build', FILE_NOT_FOUND, Message='Source override path does not exist:', File=self.MetaFile, ExtraData=SourceOverridePath, Line=LineNo) - - # Add to GlobalData Variables - GlobalData.gOverrideDir[ModuleFile.Key] = SourceOverridePath - ## Get current effective macros @property def _Macros(self): @@ -1537,6 +1517,9 @@ class DscBuildData(PlatformBuildClassObject): 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 {}) #{TAB_DEFAULT_STORES_DEFAULT:stru_pcd.DefaultValues}) if not NoDefault: stru_pcd.ValueChain.add((skuid, '')) + if 'DEFAULT' in stru_pcd.SkuOverrideValues and not GlobalData.gPcdSkuOverrides.get((stru_pcd.TokenCName, stru_pcd.TokenSpaceGuidCName)): + GlobalData.gPcdSkuOverrides.update( + {(stru_pcd.TokenCName, stru_pcd.TokenSpaceGuidCName): {'DEFAULT':stru_pcd.SkuOverrideValues['DEFAULT']}}) 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 @@ -1796,7 +1779,7 @@ class DscBuildData(PlatformBuildClassObject): EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " % (".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName.strip('.'))), FieldList[FieldName.strip(".")][1], FieldList[FieldName.strip(".")][2])) Value, ValueSize = ParseFieldValue(Value) - if not Pcd.IsArray: + if not Pcd.IsArray(): CApp = CApp + ' __FLEXIBLE_SIZE(*Size, %s, %s, %d / __ARRAY_ELEMENT_SIZE(%s, %s) + ((%d %% __ARRAY_ELEMENT_SIZE(%s, %s)) ? 1 : 0)); // From %s Line %d Value %s \n' % (Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.strip("."), FieldList[FieldName.strip(".")][1], FieldList[FieldName.strip(".")][2], FieldList[FieldName.strip(".")][0]); else: NewFieldName = '' @@ -1806,7 +1789,7 @@ class DscBuildData(PlatformBuildClassObject): ArrayIndex = int(FieldName.split('[', 1)[1].split(']', 1)[0]) FieldName = FieldName.split(']', 1)[1] FieldName = NewFieldName + FieldName - while '[' in FieldName and not Pcd.IsArray: + while '[' in FieldName and not Pcd.IsArray(): FieldName = FieldName.rsplit('[', 1)[0] CApp = CApp + ' __FLEXIBLE_SIZE(*Size, %s, %s, %d); // From %s Line %d Value %s\n' % (Pcd.DatumType, FieldName.strip("."), ArrayIndex + 1, FieldList[FieldName_ori][1], FieldList[FieldName_ori][2], FieldList[FieldName_ori][0]) for skuname in Pcd.SkuOverrideValues: @@ -1828,7 +1811,7 @@ class DscBuildData(PlatformBuildClassObject): EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " % (".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName.strip('.'))), FieldList[FieldName.strip(".")][1], FieldList[FieldName.strip(".")][2])) Value, ValueSize = ParseFieldValue(Value) - if not Pcd.IsArray: + if not Pcd.IsArray(): CApp = CApp + ' __FLEXIBLE_SIZE(*Size, %s, %s, %d / __ARRAY_ELEMENT_SIZE(%s, %s) + ((%d %% __ARRAY_ELEMENT_SIZE(%s, %s)) ? 1 : 0)); // From %s Line %d Value %s\n' % (Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.strip("."), FieldList[FieldName.strip(".")][1], FieldList[FieldName.strip(".")][2], FieldList[FieldName.strip(".")][0]); else: NewFieldName = '' @@ -1838,7 +1821,7 @@ class DscBuildData(PlatformBuildClassObject): ArrayIndex = int(FieldName.split('[', 1)[1].split(']', 1)[0]) FieldName = FieldName.split(']', 1)[1] FieldName = NewFieldName + FieldName - while '[' in FieldName and not Pcd.IsArray: + while '[' in FieldName and not Pcd.IsArray(): FieldName = FieldName.rsplit('[', 1)[0] CApp = CApp + ' __FLEXIBLE_SIZE(*Size, %s, %s, %d); // From %s Line %d Value %s \n' % (Pcd.DatumType, FieldName.strip("."), ArrayIndex + 1, FieldList[FieldName_ori][1], FieldList[FieldName_ori][2], FieldList[FieldName_ori][0]) if Pcd.PcdFieldValueFromFdf: @@ -1853,7 +1836,7 @@ class DscBuildData(PlatformBuildClassObject): EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " % (".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName.strip('.'))), Pcd.PcdFieldValueFromFdf[FieldName.strip(".")][1], Pcd.PcdFieldValueFromFdf[FieldName.strip(".")][2])) Value, ValueSize = ParseFieldValue(Value) - if not Pcd.IsArray: + if not Pcd.IsArray(): CApp = CApp + ' __FLEXIBLE_SIZE(*Size, %s, %s, %d / __ARRAY_ELEMENT_SIZE(%s, %s) + ((%d %% __ARRAY_ELEMENT_SIZE(%s, %s)) ? 1 : 0)); // From %s Line %d Value %s\n' % (Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.strip("."), Pcd.PcdFieldValueFromFdf[FieldName.strip(".")][1], Pcd.PcdFieldValueFromFdf[FieldName.strip(".")][2], Pcd.PcdFieldValueFromFdf[FieldName.strip(".")][0]); else: NewFieldName = '' @@ -1878,7 +1861,7 @@ class DscBuildData(PlatformBuildClassObject): EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " % (".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName.strip('.'))), Pcd.PcdFieldValueFromComm[FieldName.strip(".")][1], Pcd.PcdFieldValueFromComm[FieldName.strip(".")][2])) Value, ValueSize = ParseFieldValue(Value) - if not Pcd.IsArray: + if not Pcd.IsArray(): CApp = CApp + ' __FLEXIBLE_SIZE(*Size, %s, %s, %d / __ARRAY_ELEMENT_SIZE(%s, %s) + ((%d %% __ARRAY_ELEMENT_SIZE(%s, %s)) ? 1 : 0)); // From %s Line %d Value %s\n' % (Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.strip("."), ValueSize, Pcd.DatumType, FieldName.strip("."), Pcd.PcdFieldValueFromComm[FieldName.strip(".")][1], Pcd.PcdFieldValueFromComm[FieldName.strip(".")][2], Pcd.PcdFieldValueFromComm[FieldName.strip(".")][0]); else: NewFieldName = '' @@ -1888,7 +1871,7 @@ class DscBuildData(PlatformBuildClassObject): ArrayIndex = int(FieldName.split('[', 1)[1].split(']', 1)[0]) FieldName = FieldName.split(']', 1)[1] FieldName = NewFieldName + FieldName - while '[' in FieldName and not Pcd.IsArray: + while '[' in FieldName and not Pcd.IsArray(): FieldName = FieldName.rsplit('[', 1)[0] CApp = CApp + ' __FLEXIBLE_SIZE(*Size, %s, %s, %d); // From %s Line %d Value %s \n' % (Pcd.DatumType, FieldName.strip("."), ArrayIndex + 1, Pcd.PcdFieldValueFromComm[FieldName_ori][1], Pcd.PcdFieldValueFromComm[FieldName_ori][2], Pcd.PcdFieldValueFromComm[FieldName_ori][0]) if Pcd.GetPcdMaxSize(): @@ -2394,7 +2377,7 @@ class DscBuildData(PlatformBuildClassObject): for defaultstore in skuinfo.DefaultStoreDict: pcddscrawdefaultvalue = self.GetPcdDscRawDefaultValue(Pcd, skuname, defaultstore) if pcddscrawdefaultvalue: - Value = skuinfo[defaultstore] + Value = skuinfo.DefaultStoreDict[defaultstore] if "{CODE(" in Value: realvalue = Value.strip()[6:-2] # "{CODE(").rstrip(")}" CApp += "static %s %s_%s_%s_%s_Value%s = %s;\n" % (Pcd.BaseDatumType,Pcd.TokenSpaceGuidCName,Pcd.TokenCName,skuname,defaultstore,Demesion,realvalue)