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.88; helo=mga01.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 5D62B20348605 for ; Wed, 16 May 2018 09:20:21 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 May 2018 09:20:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,406,1520924400"; d="scan'208";a="41766051" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga008.jf.intel.com with ESMTP; 16 May 2018 09:20:20 -0700 Received: from fmsmsx122.amr.corp.intel.com (10.18.125.37) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 16 May 2018 09:20:20 -0700 Received: from fmsmsx103.amr.corp.intel.com ([169.254.2.228]) by fmsmsx122.amr.corp.intel.com ([169.254.5.203]) with mapi id 14.03.0319.002; Wed, 16 May 2018 09:20:20 -0700 From: "Carsey, Jaben" To: "Zhu, Yonghong" , "Lin, Derek (HPS UEFI Dev)" , "edk2-devel@lists.01.org" Thread-Topic: [PATCH] BaseTools: Fix --hash Package and Module hash value. Thread-Index: AQHT53QVYtF9QFi/k0yevpdu06OXqKQnGW7ggAtXdQCAACK9oA== Date: Wed, 16 May 2018 16:20:18 +0000 Message-ID: References: <20180509085924.13140-1-derek.lin2@hpe.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZGIwZDIwNmYtM2M4ZS00ZmEzLThkZGEtMDQ3M2ExMzIwOGQxIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6Im1FMEZrMVZJeGFmUlI5Z3dWSVB4N2ttWUFaTDNVOXVmMGcyUGpaWFlxaWs9In0= x-ctpclassification: CTP_NT x-originating-ip: [10.1.200.107] 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, 16 May 2018 16:20:22 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Derek, The change is good. I have a comment/question on the message. Reviewed-by: Jaben Carsey Order of list enumeration is not arbitrary, it's based on python lists bein= g inherently insertion-ordered objects. If insertion order is irrelevant, should we consider changing those to a di= fferent type? (set?) -Jaben > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Zhu, Yonghong > Sent: Wednesday, May 16, 2018 12:12 AM > To: Lin, Derek (HPS UEFI Dev) ; edk2- > devel@lists.01.org > Subject: Re: [edk2] [PATCH] BaseTools: Fix --hash Package and Module hash > value. >=20 > Reviewed-by: Yonghong Zhu >=20 > Best Regards, > Zhu Yonghong >=20 >=20 > -----Original Message----- > From: Lin, Derek (HPS UEFI Dev) [mailto:derek.lin2@hpe.com] > Sent: Wednesday, May 09, 2018 5:03 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. >=20 > The order of List enumeration is arbitrary. > Need to be sorted while calculating Package/Module hash, otherwise it > generate different hash value even nothing changes. >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Derek Lin > --- > BaseTools/Source/Python/AutoGen/AutoGen.py | 17 ++++++++++------- > 1 file changed, 10 insertions(+), 7 deletions(-) >=20 > 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) 20= 07 > - 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 > available under the terms and conditions of the BSD License # which > accompanies 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') @@ = -681,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.hexdigest() > + GlobalData.gPackageHash[Pkg.Arch][Pkg.PackageName] =3D > + 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]= : >=20 > m.update(GlobalData.gPackageHash[self.Arch][Pkg.PackageName]) >=20 > # Add Library hash > if self.LibraryAutoGenList: > - for Lib in self.LibraryAutoGenList: > + for Lib in sorted(self.LibraryAutoGenList, key=3Dlambda x: x= .Name): > 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 >=20 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel