From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.136, mailfrom: bob.c.feng@intel.com) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by groups.io with SMTP; Tue, 13 Aug 2019 19:34:20 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Aug 2019 19:34:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,383,1559545200"; d="scan'208";a="167245229" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga007.jf.intel.com with ESMTP; 13 Aug 2019 19:34:18 -0700 Received: from fmsmsx155.amr.corp.intel.com (10.18.116.71) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 13 Aug 2019 19:34:17 -0700 Received: from shsmsx153.ccr.corp.intel.com (10.239.6.53) by FMSMSX155.amr.corp.intel.com (10.18.116.71) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 13 Aug 2019 19:34:17 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.112]) by SHSMSX153.ccr.corp.intel.com ([169.254.12.215]) with mapi id 14.03.0439.000; Wed, 14 Aug 2019 10:34:14 +0800 From: "Bob Feng" To: "Rodriguez, Christian" , "devel@edk2.groups.io" CC: "Gao, Liming" Subject: Re: [Patch V3] BaseTools: Fix checking for Sources section in INF file Thread-Topic: [Patch V3] BaseTools: Fix checking for Sources section in INF file Thread-Index: AQHVUSMfpi0oMqHq7EWCKXtvKnTWuab57yEw Date: Wed, 14 Aug 2019 02:34:14 +0000 Message-ID: <08650203BA1BD64D8AD9B6D5D74A85D16152258A@SHSMSX104.ccr.corp.intel.com> References: <20190812153211.1791-1-christian.rodriguez@intel.com> In-Reply-To: <20190812153211.1791-1-christian.rodriguez@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: bob.c.feng@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Bob Feng -----Original Message----- From: Rodriguez, Christian=20 Sent: Monday, August 12, 2019 11:32 PM To: devel@edk2.groups.io Cc: Feng, Bob C ; Gao, Liming Subject: [Patch V3] BaseTools: Fix checking for Sources section in INF file BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1804 The check to see if [Sources] section lists all the header type files of a = module is missing the exclusion of source files that fall under the scope o= f Package includes. This change adds the exclusions. Signed-off-by: Christian Rodriguez Cc: Bob Feng Cc: Liming Gao --- BaseTools/Source/Python/AutoGen/GenMake.py | 25 ++++++++++++++++++++= ++--- BaseTools/Source/Python/AutoGen/ModuleAutoGen.py | 15 +++++++++++++++ 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/= Python/AutoGen/GenMake.py index 5802ae5ae4..499ef82aea 100644 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -906,8 +906,14 @@ cleanlib: self._AutoGenObject.IncludePathList + = self._AutoGenObject.BuildOptionIncPathList = ) + # Get a set of unique package includes from MetaFile+ = parentMetaFileIncludes =3D set()+ for aInclude in self._AutoGenObje= ct.PackageIncludePathList:+ aIncludeName =3D str(aInclude)+ = parentMetaFileIncludes.add(aIncludeName.lower())+ # Check if= header files are listed in metafile- # Get a list of unique module = header source files from MetaFile+ # Get a set of unique module head= er source files from MetaFile headerFilesInMetaFileSet =3D set() = for aFile in self._AutoGenObject.SourceFileList: aFileNam= e =3D str(aFile)@@ -915,24 +921,37 @@ cleanlib: continue headerFilesInMetaFileSet.add(aFileNam= e.lower()) - # Get a list of unique module autogen files+ # G= et a set of unique module autogen files localAutoGenFileSet =3D set= () for aFile in self._AutoGenObject.AutoGenFileList: lo= calAutoGenFileSet.add(str(aFile).lower()) - # Get a list of unique m= odule dependency header files+ # Get a set of unique module dependen= cy header files # Exclude autogen files and files not in the source= directory+ # and files that are under the package include list = headerFileDependencySet =3D set() localSourceDir =3D str(self._= AutoGenObject.SourceDir).lower() for Dependency in FileDependencyDi= ct.values(): for aFile in Dependency: aFileName= =3D str(aFile).lower()+ # Exclude non-header files = if not aFileName.endswith('.h'): continue+ = # Exclude autogen files if aFileName in localAut= oGenFileSet: continue+ # Exclude include= out of local scope if localSourceDir not in aFileName: = continue+ # Exclude files covered by packag= e includes+ pathNeeded =3D True+ for aInclude= Path in parentMetaFileIncludes:+ if aIncludePath in aFil= eName:+ pathNeeded =3D False+ = break+ if not pathNeeded:+ continue+ = # Keep the file to be checked headerFileDepende= ncySet.add(aFileName) # Ensure that gModuleBuildTracking has been = initialized per architecturediff --git a/BaseTools/Source/Python/AutoGen/Mo= duleAutoGen.py b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py index ed6822334e..aaea8767ef 100644 --- a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py +++ b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py @@ -1114,6 +1114,21 @@ class ModuleAutoGen(AutoGen): def IncludePathLength(self): return sum(len(inc)+1 for inc in = self.IncludePathList) + ## Get the list of include paths from the packag= es+ #+ # @IncludesList list The list path+ #+ = @cached_property+ def PackageIncludePathList(self):+ IncludesLis= t =3D []+ for Package in self.Module.Packages:+ PackageDi= r =3D mws.join(self.WorkspaceDir, Package.MetaFile.Dir)+ Include= sList =3D Package.Includes+ if Package._PrivateIncludes:+ = if not self.MetaFile.Path.startswith(PackageDir):+ = IncludesList =3D list(set(Package.Includes).difference(set(Package._Pri= vateIncludes)))+ return IncludesList+ ## Get HII EX PCDs which m= aybe used by VFR # # efivarstore used by VFR may relate with HII E= X PCDs--=20 2.22.0.windows.1