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.24, mailfrom: liming.gao@intel.com) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by groups.io with SMTP; Mon, 12 Aug 2019 08:40:26 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Aug 2019 08:40:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,377,1559545200"; d="scan'208";a="204761261" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga002.fm.intel.com with ESMTP; 12 Aug 2019 08:40:24 -0700 Received: from FMSMSX110.amr.corp.intel.com (10.18.116.10) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 12 Aug 2019 08:40:24 -0700 Received: from shsmsx154.ccr.corp.intel.com (10.239.6.54) by fmsmsx110.amr.corp.intel.com (10.18.116.10) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 12 Aug 2019 08:39:22 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.112]) by SHSMSX154.ccr.corp.intel.com ([169.254.7.249]) with mapi id 14.03.0439.000; Mon, 12 Aug 2019 23:39:20 +0800 From: "Liming Gao" To: "Rodriguez, Christian" , "devel@edk2.groups.io" CC: "Feng, Bob C" 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: AQHVUSMf3FYkc+wmv0iPpXKfDW3bIab3pZ0A Date: Mon, 12 Aug 2019 15:39:20 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E4CF0DD@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: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiODE5YzFlNTEtNDg5ZS00M2RlLTk3NzUtOGYyNjhkYTBmMDlhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiTnExVEFhOEZ6NmZ4NHhqeXA0bDgxQzYxVHZ1SDR5c1kzNGQrT3N2R0xPNUp2RG5zM1NHczczc0hDQUZ2YzRuSiJ9 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 Tested-by: Liming Gao > -----Original Message----- > From: Rodriguez, Christian > 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 fi= le >=20 > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1804 >=20 > 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 of Package includes. This change adds the > exclusions. >=20 > 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(-) >=20 > diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Sourc= e/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 >=20 > ) >=20 >=20 >=20 > + # Get a set of unique package includes from MetaFile >=20 > + parentMetaFileIncludes =3D set() >=20 > + for aInclude in self._AutoGenObject.PackageIncludePathList: >=20 > + aIncludeName =3D str(aInclude) >=20 > + parentMetaFileIncludes.add(aIncludeName.lower()) >=20 > + >=20 > # Check if header files are listed in metafile >=20 > - # Get a list of unique module header source files from MetaFile >=20 > + # Get a set of unique module header source files from MetaFile >=20 > headerFilesInMetaFileSet =3D set() >=20 > for aFile in self._AutoGenObject.SourceFileList: >=20 > aFileName =3D str(aFile) >=20 > @@ -915,24 +921,37 @@ cleanlib: > continue >=20 > headerFilesInMetaFileSet.add(aFileName.lower()) >=20 >=20 >=20 > - # Get a list of unique module autogen files >=20 > + # Get a set of unique module autogen files >=20 > localAutoGenFileSet =3D set() >=20 > for aFile in self._AutoGenObject.AutoGenFileList: >=20 > localAutoGenFileSet.add(str(aFile).lower()) >=20 >=20 >=20 > - # Get a list of unique module dependency header files >=20 > + # Get a set of unique module dependency header files >=20 > # Exclude autogen files and files not in the source directory >=20 > + # and files that are under the package include list >=20 > headerFileDependencySet =3D set() >=20 > localSourceDir =3D str(self._AutoGenObject.SourceDir).lower() >=20 > for Dependency in FileDependencyDict.values(): >=20 > for aFile in Dependency: >=20 > aFileName =3D str(aFile).lower() >=20 > + # Exclude non-header files >=20 > if not aFileName.endswith('.h'): >=20 > continue >=20 > + # Exclude autogen files >=20 > if aFileName in localAutoGenFileSet: >=20 > continue >=20 > + # Exclude include out of local scope >=20 > if localSourceDir not in aFileName: >=20 > continue >=20 > + # Exclude files covered by package includes >=20 > + pathNeeded =3D True >=20 > + for aIncludePath in parentMetaFileIncludes: >=20 > + if aIncludePath in aFileName: >=20 > + pathNeeded =3D False >=20 > + break >=20 > + if not pathNeeded: >=20 > + continue >=20 > + # Keep the file to be checked >=20 > headerFileDependencySet.add(aFileName) >=20 >=20 >=20 > # Ensure that gModuleBuildTracking has been initialized per arch= itecture >=20 > diff --git a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.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): >=20 > return sum(len(inc)+1 for inc in self.IncludePathList) >=20 >=20 >=20 > + ## Get the list of include paths from the packages >=20 > + # >=20 > + # @IncludesList list The list path >=20 > + # >=20 > + @cached_property >=20 > + def PackageIncludePathList(self): >=20 > + IncludesList =3D [] >=20 > + for Package in self.Module.Packages: >=20 > + PackageDir =3D mws.join(self.WorkspaceDir, Package.MetaFile.= Dir) >=20 > + IncludesList =3D Package.Includes >=20 > + if Package._PrivateIncludes: >=20 > + if not self.MetaFile.Path.startswith(PackageDir): >=20 > + IncludesList =3D list(set(Package.Includes).differen= ce(set(Package._PrivateIncludes))) >=20 > + return IncludesList >=20 > + >=20 > ## Get HII EX PCDs which maybe used by VFR >=20 > # >=20 > # efivarstore used by VFR may relate with HII EX PCDs >=20 > -- > 2.22.0.windows.1