From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.31, mailfrom: liming.gao@intel.com) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by groups.io with SMTP; Thu, 22 Aug 2019 07:32:33 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Aug 2019 07:32:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,417,1559545200"; d="scan'208";a="173152177" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga008.jf.intel.com with ESMTP; 22 Aug 2019 07:32:32 -0700 Received: from fmsmsx162.amr.corp.intel.com (10.18.125.71) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 22 Aug 2019 07:32:32 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx162.amr.corp.intel.com (10.18.125.71) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 22 Aug 2019 07:32:31 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.112]) by shsmsx102.ccr.corp.intel.com ([169.254.2.19]) with mapi id 14.03.0439.000; Thu, 22 Aug 2019 22:32:29 +0800 From: "Liming Gao" To: "Feng, Bob C" , "devel@edk2.groups.io" Subject: Re: [Patch V2][edk2-stable201908] BaseTools: Incorrect error message for library instance not found Thread-Topic: [Patch V2][edk2-stable201908] BaseTools: Incorrect error message for library instance not found Thread-Index: AQHVWJ46myteGYWU3E2vHtFSf3FUnKcHO5cw Date: Thu, 22 Aug 2019 14:32:29 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E4DAF3C@SHSMSX104.ccr.corp.intel.com> References: <20190822040046.12628-1-bob.c.feng@intel.com> In-Reply-To: <20190822040046.12628-1-bob.c.feng@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNGZkYTI2NzAtZDJlMi00Y2U2LTlmNjktN2U1ZTdhNGI3YjcxIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiQTJRMFI3ZTJrQzlcL1BtK21iSG5kQXNndDAzRHZrWTBQcUlQQ3E2aVJLZmd2MEdzcmFuc2xiT2tTV05zRTV2Q0UifQ== dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: liming.gao@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Liming Gao > -----Original Message----- > From: Feng, Bob C > Sent: Thursday, August 22, 2019 12:01 PM > To: devel@edk2.groups.io > Cc: Feng, Bob C ; Gao, Liming > Subject: [Patch V2][edk2-stable201908] BaseTools: Incorrect error message= for library instance not found >=20 > BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=3D2099 > This is a regression issue introduced by commit e8449e. >=20 > This patch is to fix this issue. >=20 > Signed-off-by: Bob Feng > Cc: Liming Gao > --- > V2: We need to check if a inf is a Library or a Module. > BaseTools/Source/Python/AutoGen/DataPipe.py | 2 +- > BaseTools/Source/Python/AutoGen/PlatformAutoGen.py | 2 +- > BaseTools/Source/Python/AutoGen/WorkspaceAutoGen.py | 4 +++- > .../Source/Python/Workspace/WorkspaceCommon.py | 13 +++++++------ > 4 files changed, 12 insertions(+), 9 deletions(-) >=20 > diff --git a/BaseTools/Source/Python/AutoGen/DataPipe.py b/BaseTools/Sour= ce/Python/AutoGen/DataPipe.py > index 2ca4f9ff4a..8b8cfd1c51 100755 > --- a/BaseTools/Source/Python/AutoGen/DataPipe.py > +++ b/BaseTools/Source/Python/AutoGen/DataPipe.py > @@ -87,11 +87,11 @@ class MemoryDataPipe(DataPipe): > #Module's Library Instance > ModuleLibs =3D {} > libModules =3D {} > for m in PlatformInfo.Platform.Modules: > module_obj =3D BuildDB.BuildObject[m,PlatformInfo.Arch,Platf= ormInfo.BuildTarget,PlatformInfo.ToolChain] > - Libs =3D GetModuleLibInstances(module_obj, PlatformInfo.Plat= form, BuildDB.BuildObject, > PlatformInfo.Arch,PlatformInfo.BuildTarget,PlatformInfo.ToolChain) > + Libs =3D GetModuleLibInstances(module_obj, PlatformInfo.Plat= form, BuildDB.BuildObject, > PlatformInfo.Arch,PlatformInfo.BuildTarget,PlatformInfo.ToolChain,Platfor= mInfo.MetaFile,EdkLogger) > for lib in Libs: > try: >=20 > libModules[(lib.MetaFile.File,lib.MetaFile.Root,lib.Arch,lib.MetaFile.Pat= h)].append((m.File,m.Root,module_obj.Arch,m.Path)) > except: > libModules[(lib.MetaFile.File,lib.MetaFile.Root,lib.= Arch,lib.MetaFile.Path)] =3D > [(m.File,m.Root,module_obj.Arch,m.Path)] > diff --git a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py b/BaseToo= ls/Source/Python/AutoGen/PlatformAutoGen.py > index dd629ba2fa..565424a95e 100644 > --- a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py > +++ b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py > @@ -1087,11 +1087,11 @@ class PlatformAutoGen(AutoGen): > def GetAllModuleInfo(self,WithoutPcd=3DTrue): > ModuleLibs =3D set() > for m in self.Platform.Modules: > module_obj =3D self.BuildDatabase[m,self.Arch,self.BuildTarg= et,self.ToolChain] > if not bool(module_obj.LibraryClass): > - Libs =3D GetModuleLibInstances(module_obj, self.Platform= , self.BuildDatabase, self.Arch,self.BuildTarget,self.ToolChain) > + Libs =3D GetModuleLibInstances(module_obj, self.Platform= , self.BuildDatabase, > self.Arch,self.BuildTarget,self.ToolChain,self.MetaFile,EdkLogger) > else: > Libs =3D [] >=20 > ModuleLibs.update( set([(l.MetaFile.File,l.MetaFile.Root,l.MetaFile.Path,= l.MetaFile.BaseName,l.MetaFile.OriginalPath,l.Arch,True) for l in > Libs])) > if WithoutPcd and module_obj.PcdIsDriver: > continue > diff --git a/BaseTools/Source/Python/AutoGen/WorkspaceAutoGen.py b/BaseTo= ols/Source/Python/AutoGen/WorkspaceAutoGen.py > index ea0d8f8bfb..2494267472 100644 > --- a/BaseTools/Source/Python/AutoGen/WorkspaceAutoGen.py > +++ b/BaseTools/Source/Python/AutoGen/WorkspaceAutoGen.py > @@ -246,11 +246,13 @@ class WorkspaceAutoGen(AutoGen): > if BuildData.MetaFile.Ext =3D=3D '.inf' and str(BuildDat= a) in Platform.Modules : > Libs.extend(GetModuleLibInstances(BuildData, Platfor= m, > self.BuildDatabase, > Arch, > self.BuildTarget, > - self.ToolChain > + self.ToolChain, > + self.Platform.MetaFile, > + EdkLogger > )) > for BuildData in list(self.BuildDatabase._CACHE_.values()): > if BuildData.Arch !=3D Arch: > continue > if BuildData.MetaFile.Ext =3D=3D '.inf': > diff --git a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py b/BaseT= ools/Source/Python/Workspace/WorkspaceCommon.py > index 76583f46e5..0b11ec2d59 100644 > --- a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py > +++ b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py > @@ -13,10 +13,11 @@ from .BuildClassObject import LibraryClassObject > import Common.GlobalData as GlobalData > from Workspace.BuildClassObject import StructurePcd > from Common.BuildToolError import RESOURCE_NOT_AVAILABLE > from Common.BuildToolError import OPTION_MISSING > from Common.BuildToolError import BUILD_ERROR > +import Common.EdkLogger as EdkLogger >=20 > class OrderedListDict(OrderedDict): > def __init__(self, *args, **kwargs): > super(OrderedListDict, self).__init__(*args, **kwargs) > self.default_factory =3D list > @@ -83,11 +84,11 @@ def GetDeclaredPcd(Platform, BuildDatabase, Arch, Tar= get, Toolchain, additionalP > # @param Target: Current target > # @param Toolchain: Current toolchain > # @retval: List of dependent libraries which are InfBuildData instances > # > def GetLiabraryInstances(Module, Platform, BuildDatabase, Arch, Target, = Toolchain): > - return GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, = Target, Toolchain) > + return GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, = Target, Toolchain,Platform.MetaFile,EdkLogger) >=20 > def GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, Target,= Toolchain, FileName =3D '', EdkLogger =3D None): > if Module.LibInstances: > return Module.LibInstances > ModuleType =3D Module.ModuleType > @@ -111,11 +112,11 @@ def GetModuleLibInstances(Module, Platform, BuildDa= tabase, Arch, Target, Toolcha > LibraryConsumerList =3D [Module] > Constructor =3D [] > ConsumedByList =3D OrderedListDict() > LibraryInstance =3D OrderedDict() >=20 > - if FileName: > + if not Module.LibraryClass: > EdkLogger.verbose("") > EdkLogger.verbose("Library instances of module [%s] [%s]:" % (st= r(Module), Arch)) >=20 > while len(LibraryConsumerList) > 0: > M =3D LibraryConsumerList.pop() > @@ -124,11 +125,11 @@ def GetModuleLibInstances(Module, Platform, BuildDa= tabase, Arch, Target, Toolcha > # override library instance for this module > LibraryPath =3D > Platform.Modules[str(Module)].LibraryClasses.get(LibraryClassName,Platfor= m.LibraryClasses[LibraryClassName, ModuleType]) > if LibraryPath is None: > LibraryPath =3D M.LibraryClasses.get(LibraryClassNam= e) > if LibraryPath is None: > - if FileName: > + if not Module.LibraryClass: > EdkLogger.error("build", RESOURCE_NOT_AVAILA= BLE, > "Instance of library class [= %s] is not found" % LibraryClassName, > File=3DFileName, > ExtraData=3D"in [%s] [%s]\n\= tconsumed by module [%s]" % (str(M), Arch, str(Module))) > else: > @@ -141,21 +142,21 @@ def GetModuleLibInstances(Module, Platform, BuildDa= tabase, Arch, Target, Toolcha > elif LibraryModule.LibraryClass is None \ > or len(LibraryModule.LibraryClass) =3D=3D 0 \ > or (ModuleType !=3D SUP_MODULE_USER_DEFINED and Mod= uleType !=3D SUP_MODULE_HOST_APPLICATION > and ModuleType not in LibraryModule.LibraryClas= s[0].SupModList): > # only USER_DEFINED can link against any library ins= tance despite of its SupModList > - if FileName: > + if not Module.LibraryClass: > EdkLogger.error("build", OPTION_MISSING, > "Module type [%s] is not support= ed by library instance [%s]" \ > % (ModuleType, LibraryPath), Fil= e=3DFileName, > ExtraData=3D"consumed by [%s]" %= str(Module)) > else: > return [] >=20 > LibraryInstance[LibraryClassName] =3D LibraryModule > LibraryConsumerList.append(LibraryModule) > - if FileName: > + if not Module.LibraryClass: > EdkLogger.verbose("\t" + str(LibraryClassName) + " := " + str(LibraryModule)) > else: > LibraryModule =3D LibraryInstance[LibraryClassName] >=20 > if LibraryModule is None: > @@ -232,11 +233,11 @@ def GetModuleLibInstances(Module, Platform, BuildDa= tabase, Arch, Target, Toolcha > # > # if any remaining node Item in the graph has a constructor and an i= ncoming edge, then the graph has a cycle > # > for Item in LibraryList: > if ConsumedByList[Item] and Item in Constructor and len(Construc= tor) > 1: > - if FileName: > + if not Module.LibraryClass: > ErrorMessage =3D "\tconsumed by " + "\n\tconsumed by ".j= oin(str(L) for L in ConsumedByList[Item]) > EdkLogger.error("build", BUILD_ERROR, 'Library [%s] with= constructors has a cycle' % str(Item), > ExtraData=3DErrorMessage, File=3DFileNam= e) > else: > return [] > -- > 2.20.1.windows.1