X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=BaseTools%2FSource%2FPython%2FWorkspace%2FInfBuildData.py;h=29e68aeb3bf38c67645a35e286c76c82ed19d302;hb=f64fbdde8c99bcf0c97f1348f02fdcd8685f1df2;hp=602746de32f7d15ac59525a8ee3c97d44689782b;hpb=c93356ada99e6f8083a64f99d162b44a2765ce63;p=mirror_edk2.git diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/Source/Python/Workspace/InfBuildData.py index 602746de32..29e68aeb3b 100644 --- a/BaseTools/Source/Python/Workspace/InfBuildData.py +++ b/BaseTools/Source/Python/Workspace/InfBuildData.py @@ -12,11 +12,12 @@ # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # -from Common.String import * +from __future__ import absolute_import +from Common.StringUtils import * from Common.DataType import * from Common.Misc import * from types import * -from MetaFileParser import * +from .MetaFileParser import * from collections import OrderedDict from Workspace.BuildClassObject import ModuleBuildClassObject, LibraryClassObject, PcdClassObject @@ -698,7 +699,7 @@ class InfBuildData(ModuleBuildClassObject): CName = Record[0] Value = ProtocolValue(CName, self.Packages, self.MetaFile.Path) if Value is None: - PackageList = "\n\t".join([str(P) for P in self.Packages]) + PackageList = "\n\t".join(str(P) for P in self.Packages) EdkLogger.error('build', RESOURCE_NOT_AVAILABLE, "Value of Protocol [%s] is not found under [Protocols] section in" % CName, ExtraData=PackageList, File=self.MetaFile, Line=Record[-1]) @@ -723,7 +724,7 @@ class InfBuildData(ModuleBuildClassObject): CName = Record[0] Value = PpiValue(CName, self.Packages, self.MetaFile.Path) if Value is None: - PackageList = "\n\t".join([str(P) for P in self.Packages]) + PackageList = "\n\t".join(str(P) for P in self.Packages) EdkLogger.error('build', RESOURCE_NOT_AVAILABLE, "Value of PPI [%s] is not found under [Ppis] section in " % CName, ExtraData=PackageList, File=self.MetaFile, Line=Record[-1]) @@ -748,7 +749,7 @@ class InfBuildData(ModuleBuildClassObject): CName = Record[0] Value = GuidValue(CName, self.Packages, self.MetaFile.Path) if Value is None: - PackageList = "\n\t".join([str(P) for P in self.Packages]) + PackageList = "\n\t".join(str(P) for P in self.Packages) EdkLogger.error('build', RESOURCE_NOT_AVAILABLE, "Value of Guid [%s] is not found under [Guids] section in" % CName, ExtraData=PackageList, File=self.MetaFile, Line=Record[-1]) @@ -911,14 +912,24 @@ class InfBuildData(ModuleBuildClassObject): ExtraData=Token, File=self.MetaFile, Line=Record[-1]) DepexList.append(Module.Guid) else: - # get the GUID value now - Value = ProtocolValue(Token, self.Packages, self.MetaFile.Path) - if Value is None: - Value = PpiValue(Token, self.Packages, self.MetaFile.Path) + # it use the Fixed PCD format + if '.' in Token: + if tuple(Token.split('.')[::-1]) not in self.Pcds: + EdkLogger.error('build', RESOURCE_NOT_AVAILABLE, "PCD [{}] used in [Depex] section should be listed in module PCD section".format(Token), File=self.MetaFile, Line=Record[-1]) + else: + if self.Pcds[tuple(Token.split('.')[::-1])].DatumType != TAB_VOID: + EdkLogger.error('build', FORMAT_INVALID, "PCD [{}] used in [Depex] section should be VOID* datum type".format(Token), File=self.MetaFile, Line=Record[-1]) + Value = Token + else: + # get the GUID value now + Value = ProtocolValue(Token, self.Packages, self.MetaFile.Path) if Value is None: - Value = GuidValue(Token, self.Packages, self.MetaFile.Path) + Value = PpiValue(Token, self.Packages, self.MetaFile.Path) + if Value is None: + Value = GuidValue(Token, self.Packages, self.MetaFile.Path) + if Value is None: - PackageList = "\n\t".join([str(P) for P in self.Packages]) + PackageList = "\n\t".join(str(P) for P in self.Packages) EdkLogger.error('build', RESOURCE_NOT_AVAILABLE, "Value of [%s] is not found in" % Token, ExtraData=PackageList, File=self.MetaFile, Line=Record[-1]) @@ -961,7 +972,7 @@ class InfBuildData(ModuleBuildClassObject): if TokenSpaceGuid not in self.Guids: Value = GuidValue(TokenSpaceGuid, self.Packages, self.MetaFile.Path) if Value is None: - PackageList = "\n\t".join([str(P) for P in self.Packages]) + PackageList = "\n\t".join(str(P) for P in self.Packages) EdkLogger.error('build', RESOURCE_NOT_AVAILABLE, "Value of Guid [%s] is not found under [Guids] section in" % TokenSpaceGuid, ExtraData=PackageList, File=self.MetaFile, Line=LineNo) @@ -1121,7 +1132,7 @@ class InfBuildData(ModuleBuildClassObject): else: try: Pcd.DefaultValue = ValueExpressionEx(Pcd.DefaultValue, Pcd.DatumType, _GuidDict)(True) - except BadExpression, Value: + except BadExpression as Value: EdkLogger.error('Parser', FORMAT_INVALID, 'PCD [%s.%s] Value "%s", %s' %(TokenSpaceGuid, PcdRealName, Pcd.DefaultValue, Value), File=self.MetaFile, Line=LineNo) break @@ -1131,7 +1142,7 @@ class InfBuildData(ModuleBuildClassObject): FORMAT_INVALID, "PCD [%s.%s] in [%s] is not found in dependent packages:" % (TokenSpaceGuid, PcdRealName, self.MetaFile), File=self.MetaFile, Line=LineNo, - ExtraData="\t%s" % '\n\t'.join([str(P) for P in self.Packages]) + ExtraData="\t%s" % '\n\t'.join(str(P) for P in self.Packages) ) Pcds[PcdCName, TokenSpaceGuid] = Pcd