From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.151; helo=mga17.intel.com; envelope-from=yonghong.zhu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 28213203B8597 for ; Wed, 9 May 2018 01:35:17 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 May 2018 01:35:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,381,1520924400"; d="scan'208";a="49427599" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga003.jf.intel.com with ESMTP; 09 May 2018 01:35:16 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 9 May 2018 01:35:15 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.210]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.179]) with mapi id 14.03.0319.002; Wed, 9 May 2018 16:35:14 +0800 From: "Zhu, Yonghong" To: "Lin, Derek (HPS UEFI Dev)" , "edk2-devel@lists.01.org" Thread-Topic: [PATCH] BaseTools: Fix --hash Package and Module hash value. Thread-Index: AQHT52jHYtF9QFi/k0yevpdu06OXqKQnBRUAgAAEshA= Date: Wed, 9 May 2018 08:35:13 +0000 Message-ID: References: <20180509073836.6924-1-derek.lin2@hpe.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] BaseTools: Fix --hash Package and Module hash value. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2018 08:35:17 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Derek, Please refer below link to add Contributed-under and Signed-off-by info. We can use BaseTools\Scripts\PatchCheck.py to check the patch format. Than= ks. https://github.com/tianocore/tianocore.github.io/wiki/Commit-Message-Format= =20 Best Regards, Zhu Yonghong -----Original Message----- From: Lin, Derek (HPS UEFI Dev) [mailto:derek.lin2@hpe.com]=20 Sent: Wednesday, May 09, 2018 3:49 PM To: edk2-devel@lists.01.org Cc: Zhu, Yonghong ; Lin, Derek (HPS UEFI Dev) Subject: [PATCH] BaseTools: Fix --hash Package and Module hash value. From: Lin, Derek (HPS UEFI Dev)=20 Sent: Wednesday, May 9, 2018 3:39 PM To: Lin, Derek (HPS UEFI Dev) Subject: [PATCH] BaseTools: Fix --hash Package and Module hash value. The order of List enumeration is arbitrary. Need to be sorted while calculating Package/Module hash, otherwise it gener= ate different hash value even nothing changes. --- BaseTools/Source/Python/AutoGen/AutoGen.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/= Python/AutoGen/AutoGen.py index 54f6b1f173..90704dcae4 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -2,6 +2,7 @@ # Generate AutoGen.h, AutoGen.c and *.depex files # # Copyright (c) 2007= - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2018, Hewlett Packard Enterprise Development, L.P.
# This program and the accompanying materials # are licensed and made ava= ilable under the terms and conditions of the BSD License # which accompani= es this distribution. The full text of the license may be found at @@ -670= ,6 +671,9 @@ class WorkspaceAutoGen(AutoGen): return True =20 def _GenPkgLevelHash(self, Pkg): + if Pkg.PackageName in GlobalData.gPackageHash[Pkg.Arch]: + return + PkgDir =3D os.path.join(self.BuildDir, Pkg.Arch, Pkg.PackageName) CreateDirectory(PkgDir) HashFile =3D os.path.join(PkgDir, Pkg.PackageName + '.hash') @@ -6= 81,17 +685,16 @@ class WorkspaceAutoGen(AutoGen): m.update(Content) # Get include files hash value if Pkg.Includes: - for inc in Pkg.Includes: + for inc in sorted(Pkg.Includes, key=3Dlambda x: str(x)): for Root, Dirs, Files in os.walk(str(inc)): - for File in Files: + for File in sorted(Files): File_Path =3D os.path.join(Root, File) f =3D open(File_Path, 'r') Content =3D f.read() f.close() m.update(Content) SaveFileOnChange(HashFile, m.hexdigest(), True) - if Pkg.PackageName not in GlobalData.gPackageHash[Pkg.Arch]: - GlobalData.gPackageHash[Pkg.Arch][Pkg.PackageName] =3D m.hexdi= gest() + GlobalData.gPackageHash[Pkg.Arch][Pkg.PackageName] =3D=20 + m.hexdigest() =20 def _GetMetaFiles(self, Target, Toolchain, Arch): AllWorkSpaceMetaFiles =3D set() @@ -4432,13 +4435,13 @@ class ModuleAutoGen(AutoGen): m.update(GlobalData.gPlatformHash) # Add Package level hash if self.DependentPackageList: - for Pkg in 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]) =20 # Add Library hash if self.LibraryAutoGenList: - for Lib in self.LibraryAutoGenList: + for Lib in sorted(self.LibraryAutoGenList, key=3Dlambda x: x.N= ame): if Lib.Name not in GlobalData.gModuleHash[self.Arch]: Lib.GenModuleHash() m.update(GlobalData.gModuleHash[self.Arch][Lib.Name]) @@ -4450,7 +4453,7 @@ class ModuleAutoGen(AutoGen): m.update(Content) # Add Module's source files if self.SourceFileList: - for File in self.SourceFileList: + for File in sorted(self.SourceFileList, key=3Dlambda x: str(x)= ): f =3D open(str(File), 'r') Content =3D f.read() f.close() -- 2.15.1.windows.2