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.43, mailfrom: jaben.carsey@intel.com) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by groups.io with SMTP; Thu, 09 May 2019 16:39:06 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 May 2019 16:39:05 -0700 X-ExtLoop1: 1 Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga003.jf.intel.com with ESMTP; 09 May 2019 16:39:05 -0700 Received: from fmsmsx161.amr.corp.intel.com (10.18.125.9) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 9 May 2019 16:39:05 -0700 Received: from fmsmsx103.amr.corp.intel.com ([169.254.2.107]) by FMSMSX161.amr.corp.intel.com ([169.254.12.11]) with mapi id 14.03.0415.000; Thu, 9 May 2019 16:39:05 -0700 From: "Carsey, Jaben" To: "devel@edk2.groups.io" , "Rodriguez, Christian" CC: "Feng, Bob C" , "Gao, Liming" , "Zhu, Yonghong" Subject: Re: [edk2-devel] [PATCH] BaseTools: Include headers not mentioned in inf are not hashed Thread-Topic: [edk2-devel] [PATCH] BaseTools: Include headers not mentioned in inf are not hashed Thread-Index: AQHVBq4PdUG0FlWYxU2Tc9jPwsVOEKZjcrKQ Date: Thu, 9 May 2019 23:39:04 +0000 Message-ID: References: <20190509212719.6156-1-christian.rodriguez@intel.com> In-Reply-To: <20190509212719.6156-1-christian.rodriguez@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNTQ4NWIxNTUtYzcyYi00OGZmLWFjOTItYmM3YmQwMWRiMjE5IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiUjlzUVYrdXVGRDhralJ4WWthNFRxYW9ZZzJHXC9KQ1hIYTZ6NEd3U3l5Nkg3MVJKWUoxaVBhcUFjRFRDUW83N2oifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action x-originating-ip: [10.1.200.107] MIME-Version: 1.0 Return-Path: jaben.carsey@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Some questions inline. > -----Original Message----- > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of > Christian Rodriguez > Sent: Thursday, May 09, 2019 2:27 PM > To: devel@edk2.groups.io > Cc: Feng, Bob C ; Gao, Liming > ; Zhu, Yonghong > Subject: [edk2-devel] [PATCH] BaseTools: Include headers not mentioned i= n > inf are not hashed >=20 > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1787 >=20 > Get a list of local header files that are not present in the > MetaFile for this module. Add those local header files into > the hashing algorithm for a module. If a local header file is > not present in the MetaFile, the module will still build correctly > though the hashing system didn't know about it before. >=20 > Signed-off-by: Christian Rodriguez > Cc: Bob Feng > Cc: Liming Gao > Cc: Yonghong Zhu > --- > BaseTools/Source/Python/AutoGen/AutoGen.py | 24 > ++++++++++++++++++++++++ > 1 file changed, 24 insertions(+) >=20 > diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py > b/BaseTools/Source/Python/AutoGen/AutoGen.py > index 31721a6f9f..bd282d3ec1 100644 > --- a/BaseTools/Source/Python/AutoGen/AutoGen.py > +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py > @@ -4098,8 +4098,10 @@ class ModuleAutoGen(AutoGen): > if self.Name in GlobalData.gModuleHash[self.Arch] and > GlobalData.gBinCacheSource and self.AttemptModuleCacheCopy(): > return False > m =3D hashlib.md5() > + > # Add Platform level hash > m.update(GlobalData.gPlatformHash.encode('utf-8')) > + > # Add Package level hash > if self.DependentPackageList: > for Pkg in sorted(self.DependentPackageList, key=3Dlambda x= : > x.PackageName): > @@ -4118,14 +4120,36 @@ class ModuleAutoGen(AutoGen): > Content =3D f.read() > f.close() > m.update(Content) > + > # Add Module's source files > + localSourceFileList =3D set() > if self.SourceFileList: > for File in sorted(self.SourceFileList, key=3Dlambda x: str= (x)): > + localSourceFileList.add(str(File)) > f =3D open(str(File), 'rb') > Content =3D f.read() > f.close() > m.update(Content) >=20 > + # Get a list of Module's local header files not included in met= aFile > + localHeaderList =3D set() > + if self.SourceDir: > + for root, dirs, files in os.walk(self.SourceDir): > + for aFile in files: > + filePath =3D os.path.join(self.WorkspaceDir, os.pat= h.join(root, > aFile)) > + if not filePath.endswith(('.h', '.H')): > + continue > + if filePath not in localSourceFileList: Confused about localSourceFileList. Why is it a set and named list? Why not just use self.SourceFileList? > + localHeaderList.add(filePath) > + > + # Add Module's local header files > + localHeaderList =3D list(localHeaderList) > + for File in sorted(localHeaderList): > + f =3D open(str(File), 'rb') > + Content =3D f.read() Can you use 'with open(...) as...:' syntax to make sure the file is always= closed? > + f.close() > + m.update(Content) > + > ModuleHashFile =3D path.join(self.BuildDir, self.Name + ".hash"= ) > if self.Name not in GlobalData.gModuleHash[self.Arch]: > GlobalData.gModuleHash[self.Arch][self.Name] =3D m.hexdiges= t() > -- > 2.19.1.windows.1 >=20 >=20 >=20