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; Mon, 08 Apr 2019 22:09:12 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Apr 2019 22:09:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,328,1549958400"; d="scan'208";a="141197099" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga007.fm.intel.com with ESMTP; 08 Apr 2019 22:09:11 -0700 Received: from fmsmsx123.amr.corp.intel.com (10.18.125.38) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 8 Apr 2019 22:09:11 -0700 Received: from shsmsx154.ccr.corp.intel.com (10.239.6.54) by fmsmsx123.amr.corp.intel.com (10.18.125.38) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 8 Apr 2019 22:09:11 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.164]) by SHSMSX154.ccr.corp.intel.com ([169.254.7.149]) with mapi id 14.03.0415.000; Tue, 9 Apr 2019 13:09:09 +0800 From: "BobCF" To: "Rodriguez, Christian" , "devel@edk2.groups.io" CC: "Gao, Liming" , "Zhu, Yonghong" Subject: Re: [Patch V2 2/4] BaseTools: Fix corner-cases of --hash feature Thread-Topic: [Patch V2 2/4] BaseTools: Fix corner-cases of --hash feature Thread-Index: AQHU6wAniz2ySwS/GEaTzSVui05S/aYzTqEA Date: Tue, 9 Apr 2019 05:09:08 +0000 Message-ID: <08650203BA1BD64D8AD9B6D5D74A85D1600DB390@SHSMSX101.ccr.corp.intel.com> References: <20190404160423.5268-1-christian.rodriguez@intel.com> <20190404160423.5268-3-christian.rodriguez@intel.com> In-Reply-To: <20190404160423.5268-3-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: Friday, April 5, 2019 12:04 AM To: devel@edk2.groups.io Cc: Feng, Bob C ; Gao, Liming ;= Zhu, Yonghong Subject: [Patch V2 2/4] BaseTools: Fix corner-cases of --hash feature BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1680 Re-order hashing operations so we don't do redundant hashes. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Christian Rodriguez Cc: Bob Feng Cc: Liming Gao Cc: Yonghong Zhu --- BaseTools/Source/Python/AutoGen/AutoGen.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/= Python/AutoGen/AutoGen.py index 792bc99f54..b516404696 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -661,7 +661,7 @@ class WorkspaceAutoGen(AutoGen): # # Generate Package level hash value # - GlobalData.gPackageHash[Arch] =3D {} + GlobalData.gPackageHash =3D {} if GlobalData.gUseHashCache: for Pkg in Pkgs: self._GenPkgLevelHash(Pkg) @@ -747,7 +747,7 @@ class W= orkspaceAutoGen(AutoGen): return True =20 def _GenPkgLevelHash(self, Pkg): - if Pkg.PackageName in GlobalData.gPackageHash[Pkg.Arch]: + if Pkg.PackageName in GlobalData.gPackageHash: return =20 PkgDir =3D os.path.join(self.BuildDir, Pkg.Arch, Pkg.PackageName) = @@ -770,7 +770,7 @@ class WorkspaceAutoGen(AutoGen): f.close() m.update(Content) SaveFileOnChange(HashFile, m.hexdigest(), False) - GlobalData.gPackageHash[Pkg.Arch][Pkg.PackageName] =3D m.hexdigest= () + GlobalData.gPackageHash[Pkg.PackageName] =3D m.hexdigest() =20 def _GetMetaFiles(self, Target, Toolchain, Arch): AllWorkSpaceMetaFiles =3D set() @@ -4092,14 +4092,16 @@ class ModuleAutoGen(AutoGen): def GenModuleHash(self): if self.Arch not in GlobalData.gModuleHash: GlobalData.gModuleHash[self.Arch] =3D {} + if self.Name in GlobalData.gModuleHash[self.Arch] and GlobalData.g= BinCacheSource 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): - if Pkg.PackageName in GlobalData.gPackageHash[self.Arch]: - m.update(GlobalData.gPackageHash[self.Arch][Pkg.Packag= eName].encode('utf-8')) + if Pkg.PackageName in GlobalData.gPackageHash: + =20 + m.update(GlobalData.gPackageHash[Pkg.PackageName].encode('utf-8')) =20 # Add Library hash if self.LibraryAutoGenList: @@ -4124,9 +4126,8 @@ class ModuleAutoGen(AutoGen): 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.hexdigest() - if GlobalData.gBinCacheSource: - if self.AttemptModuleCacheCopy(): - return False + if GlobalData.gBinCacheSource and self.AttemptModuleCacheCopy(): + return False return SaveFileOnChange(ModuleHashFile, m.hexdigest(), False) =20 ## Decide whether we can skip the ModuleAutoGen process -- 2.19.1.windows.1