From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: None (no SPF record) identity=mailfrom; client-ip=15.233.44.25; helo=g2t2352.austin.hpe.com; envelope-from=derek.lin2@hpe.com; receiver=edk2-devel@lists.01.org Received: from g2t2352.austin.hpe.com (g2t2352.austin.hpe.com [15.233.44.25]) (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 2B94C2096AEFC for ; Wed, 9 May 2018 02:04:45 -0700 (PDT) Received: from G1W8107.americas.hpqcorp.net (g1w8107.austin.hp.com [16.193.72.59]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g2t2352.austin.hpe.com (Postfix) with ESMTPS id 52875B1 for ; Wed, 9 May 2018 09:04:44 +0000 (UTC) Received: from G4W9122.americas.hpqcorp.net (2002:10d2:1511::10d2:1511) by G1W8107.americas.hpqcorp.net (2002:10c1:483b::10c1:483b) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Wed, 9 May 2018 09:04:22 +0000 Received: from NAM01-SN1-obe.outbound.protection.outlook.com (15.241.52.11) by G4W9122.americas.hpqcorp.net (16.210.21.17) with Microsoft SMTP Server (TLS) id 15.0.1178.4 via Frontend Transport; Wed, 9 May 2018 09:04:22 +0000 Received: from CS1PR8401MB0678.NAMPRD84.PROD.OUTLOOK.COM (10.169.15.11) by CS1PR8401MB0791.NAMPRD84.PROD.OUTLOOK.COM (10.169.15.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.755.16; Wed, 9 May 2018 09:04:21 +0000 Received: from CS1PR8401MB0678.NAMPRD84.PROD.OUTLOOK.COM ([fe80::a04f:e190:f2e7:d258]) by CS1PR8401MB0678.NAMPRD84.PROD.OUTLOOK.COM ([fe80::a04f:e190:f2e7:d258%15]) with mapi id 15.20.0735.019; Wed, 9 May 2018 09:04:20 +0000 From: "Lin, Derek (HPS UEFI Dev)" To: "Zhu, Yonghong" , "edk2-devel@lists.01.org" Thread-Topic: [PATCH] BaseTools: Fix --hash Package and Module hash value. Thread-Index: AQHT52jHYtF9QFi/k0yevpdu06OXqKQnBRUAgAAEshCAABClIA== Date: Wed, 9 May 2018 09:04:20 +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: authentication-results: spf=none (sender IP is ) smtp.mailfrom=derek.lin2@hpe.com; x-originating-ip: [16.242.247.137] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; CS1PR8401MB0791; 7:OEoQ9usmYuWFd/2hjv6qKo4qaAvFh3q8/TcxeIMXyEZDGYqKGw4KObW+77FfemQMyAuVi7sBSF3rfTvPoluLz3+nMzYwGGV335PkZ0hr+cZ7qTr72heVwTw15TeikJJzlztbYgoVdnuc5t3uXn4HiTeyAY9XsBudzEOkraie7k5pP0QJPIVPArLMDU45HGrx1jYKvF8SThc9+IK5zd5BdZC8v16vK7b5QuIKEWJ0PXQzqu8oZHd2N8L5IzUn9v2F x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:(222181515654134); BCL:0; PCL:0; RULEID:(7020095)(4652020)(8989080)(5600026)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(8990040)(2017052603328)(7153060)(7193020); SRVR:CS1PR8401MB0791; x-ms-traffictypediagnostic: CS1PR8401MB0791: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(227479698468861)(166708455590820)(162533806227266)(222181515654134)(228905959029699); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3231254)(944501410)(52105095)(93006095)(93001095)(3002001)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011); SRVR:CS1PR8401MB0791; BCL:0; PCL:0; RULEID:; SRVR:CS1PR8401MB0791; x-forefront-prvs: 0667289FF8 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(366004)(396003)(346002)(39380400002)(39860400002)(376002)(189003)(13464003)(199004)(7736002)(53936002)(229853002)(316002)(6506007)(7696005)(26005)(99286004)(2906002)(110136005)(2900100001)(5660300001)(74316002)(86362001)(446003)(186003)(76176011)(11346002)(6306002)(476003)(53546011)(55016002)(3660700001)(59450400001)(9686003)(5250100002)(102836004)(2501003)(3280700002)(486006)(106356001)(105586002)(8676002)(81166006)(81156014)(33656002)(8936002)(6116002)(3846002)(6246003)(14454004)(68736007)(66066001)(6436002)(966005)(25786009)(478600001)(97736004)(305945005); DIR:OUT; SFP:1102; SCL:1; SRVR:CS1PR8401MB0791; H:CS1PR8401MB0678.NAMPRD84.PROD.OUTLOOK.COM; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: hpe.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: +SK8AF0nW+OA7smZQBdK51I2z4qJnxv3v1AbM3SEJzixpxnhgnAZPURaCFQGtkgy9Mo+p29FwznqWZR13/HaXiOD4a8VRx8pdvUdSf8JdklTHyR1zV4Zy6YKKnjLFKBSa+4dves+rmm2Tr36VyZImauc0CChStDjdYZWwG1kTXMO5Mm7rxtX4sDzqpOzhfA+ spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 762cfd5e-8183-45f4-5204-08d5b58bda36 X-MS-Exchange-CrossTenant-Network-Message-Id: 762cfd5e-8183-45f4-5204-08d5b58bda36 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 May 2018 09:04:20.7774 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-Transport-CrossTenantHeadersStamped: CS1PR8401MB0791 X-OriginatorOrg: hpe.com 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 09:04:45 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Yonghong, Thanks for notify about this. I resend the patch. Thanks, Derek -----Original Message----- From: Zhu, Yonghong [mailto:yonghong.zhu@intel.com]=20 Sent: Wednesday, May 9, 2018 4:35 PM To: Lin, Derek (HPS UEFI Dev) ; edk2-devel@lists.01.org Cc: Zhu, Yonghong Subject: RE: [PATCH] BaseTools: Fix --hash Package and Module hash value. 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