From nobody Sun Apr 28 15:52:13 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1525856609012581.550055682729; Wed, 9 May 2018 02:03:29 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id D84B4203B85B8; Wed, 9 May 2018 02:03:27 -0700 (PDT) Received: from g9t5009.houston.hpe.com (g9t5009.houston.hpe.com [15.241.48.73]) (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 BC0D3203B85B3 for ; Wed, 9 May 2018 02:03:26 -0700 (PDT) Received: from G2W6309.americas.hpqcorp.net (g2w6309.austin.hp.com [16.197.64.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g9t5009.houston.hpe.com (Postfix) with ESMTPS id CB40951 for ; Wed, 9 May 2018 09:03:25 +0000 (UTC) Received: from G4W9122.americas.hpqcorp.net (2002:10d2:1511::10d2:1511) by G2W6309.americas.hpqcorp.net (2002:10c5:4033::10c5:4033) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Wed, 9 May 2018 09:03:25 +0000 Received: from NAM01-BY2-obe.outbound.protection.outlook.com (15.241.52.13) 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:03:25 +0000 Received: from CS1PR8401MB0678.NAMPRD84.PROD.OUTLOOK.COM (10.169.15.11) by CS1PR8401MB0709.NAMPRD84.PROD.OUTLOOK.COM (10.169.15.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.735.17; Wed, 9 May 2018 09:03:23 +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:03:23 +0000 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: None (no SPF record) identity=mailfrom; client-ip=15.241.48.73; helo=g9t5009.houston.hpe.com; envelope-from=derek.lin2@hpe.com; receiver=edk2-devel@lists.01.org From: "Lin, Derek (HPS UEFI Dev)" To: "edk2-devel@lists.01.org" Thread-Topic: [PATCH] BaseTools: Fix --hash Package and Module hash value. Thread-Index: AQHT53QVfyM26jl8YUiT2x4ShU8beaQnGW7g Date: Wed, 9 May 2018 09:03:23 +0000 Message-ID: References: <20180509085924.13140-1-derek.lin2@hpe.com> In-Reply-To: <20180509085924.13140-1-derek.lin2@hpe.com> Accept-Language: en-US Content-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; CS1PR8401MB0709; 7:4W9MOV2+QiQopGZL6oJWQEFqu7fXjRRX/M9Tu1JcCrfI2muIZqLTrE7Ivl4UkRIxQKScS6cshBETzDovNX2a/NdgHxlW8D2n3PL+fEbpIrGRqqxkvrxzkSWoEkAk6n5Z3lwtxQcoc/2I1THRdHc4yGx80E4HmLHiPIP/YcYnHiS9gjoyVxpLUnslul7xXAvxreWh1CE0kusXHJynwTAjazaMpsH2ikjtc11yaGYxL3jciiGsKs3avYiM4JwTfggP x-ms-exchange-antispam-srfa-diagnostics: SOS;SOR; x-forefront-antispam-report: SFV:SKI; SCL:-1; SFV:NSPM; SFS:(10019020)(366004)(396003)(39860400002)(376002)(39380400002)(346002)(189003)(199004)(6116002)(53936002)(5640700003)(3846002)(106356001)(2900100001)(9686003)(5660300001)(105586002)(97736004)(6436002)(102836004)(6506007)(26005)(55016002)(3280700002)(3660700001)(8676002)(81156014)(8936002)(81166006)(54906003)(2351001)(86362001)(7736002)(14454004)(6916009)(2906002)(305945005)(316002)(5250100002)(486006)(68736007)(476003)(186003)(25786009)(11346002)(76176011)(59450400001)(1857600001)(99286004)(33656002)(4326008)(66066001)(478600001)(74316002)(7696005)(2501003)(446003); DIR:OUT; SFP:1102; SCL:1; SRVR:CS1PR8401MB0709; H:CS1PR8401MB0678.NAMPRD84.PROD.OUTLOOK.COM; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:(222181515654134); BCL:0; PCL:0; RULEID:(7020095)(4652020)(8989080)(4534165)(4627221)(201703031133081)(201702281549075)(8990040)(5600026)(48565401081)(2017052603328)(7153060)(7193020); SRVR:CS1PR8401MB0709; x-ms-traffictypediagnostic: CS1PR8401MB0709: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(227479698468861)(222181515654134); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(3231254)(944501410)(52105095)(93006095)(93001095)(10201501046)(6055026)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011); SRVR:CS1PR8401MB0709; BCL:0; PCL:0; RULEID:; SRVR:CS1PR8401MB0709; x-forefront-prvs: 0667289FF8 received-spf: None (protection.outlook.com: hpe.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 5gfvN3hjiy9NNH2M3qDLYXPlRKMbRptsmyr2dPvoVmVOVKlHFEm712/24CvXQyTPljVNNCjlwv3AYA1ouO3bbhUhBpBAZVVetChGHRC6jLMhFxLszSQj4Gfgnjani/M7N8ozwaOCFzQVy6PYgUKVXEToub1ccdpUprPZYloQyg13HqZa3kHSpPDzi84e2MYG spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 60a0d19c-9100-42bb-fe52-08d5b58bb7f9 X-MS-Exchange-CrossTenant-Network-Message-Id: 60a0d19c-9100-42bb-fe52-08d5b58bb7f9 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 May 2018 09:03:23.3551 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-Transport-CrossTenantHeadersStamped: CS1PR8401MB0709 X-OriginatorOrg: hpe.com Subject: [edk2] [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: , Cc: "Lin, Derek \(HPS UEFI Dev\)" Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Derek Lin Reviewed-by: Jaben Carsey Reviewed-by: Yonghong Zhu =20 --- 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 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel