From nobody Sun Apr 28 09:24:26 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 1525852192177574.0643099993487; Wed, 9 May 2018 00:49:52 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 03015203B8598; Wed, 9 May 2018 00:49:51 -0700 (PDT) Received: from g4t3425.houston.hpe.com (g4t3425.houston.hpe.com [15.241.140.78]) (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 CA271203B858C for ; Wed, 9 May 2018 00:49:49 -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 g4t3425.houston.hpe.com (Postfix) with ESMTPS id 990BBBB for ; Wed, 9 May 2018 07:49:48 +0000 (UTC) Received: from G4W9120.americas.hpqcorp.net (2002:10d2:150f::10d2:150f) by G2W6309.americas.hpqcorp.net (2002:10c5:4033::10c5:4033) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Wed, 9 May 2018 07:49:23 +0000 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (15.241.52.11) by G4W9120.americas.hpqcorp.net (16.210.21.15) with Microsoft SMTP Server (TLS) id 15.0.1178.4 via Frontend Transport; Wed, 9 May 2018 07:49:23 +0000 Received: from CS1PR8401MB0678.NAMPRD84.PROD.OUTLOOK.COM (10.169.15.11) by CS1PR8401MB1223.NAMPRD84.PROD.OUTLOOK.COM (10.169.97.141) 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 07:49:22 +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 07:49:21 +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.140.78; helo=g4t3425.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: AQHT52jHYtF9QFi/k0yevpdu06OXqKQnBRUA Date: Wed, 9 May 2018 07:49:21 +0000 Message-ID: References: <20180509073836.6924-1-derek.lin2@hpe.com> In-Reply-To: <20180509073836.6924-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; CS1PR8401MB1223; 7:yEIv1KdXZ4SzlNVcGKjCBewG3y3dAJ4c6ubdGfUFPa/h3CgYvlPdU/d9ehSBS+yuo+rJPtZztSJkMKnAJOG00AyedaYusukL+ZOHwUU7slwHLXt7N29GvlEN1MF1ZxFXyADo4RffXWYAkvQIEJVtl6jS+kYV2sJfjvBUhV0OX7gS2MxNHCQnaSas32LXdsYj3m0sf2ekJ2fuL3d1rPd6x9wZKnSU0PEGXhsrSkymkSeRvJooAxZobwKt7n10UxSU x-ms-exchange-antispam-srfa-diagnostics: SOS;SOR; x-forefront-antispam-report: SFV:SKI; SCL:-1; SFV:NSPM; SFS:(10019020)(396003)(39380400002)(346002)(39860400002)(376002)(366004)(189003)(199004)(2906002)(99286004)(478600001)(305945005)(55016002)(5250100002)(5640700003)(59450400001)(316002)(6506007)(97736004)(7736002)(8936002)(3660700001)(53936002)(54906003)(3280700002)(476003)(6116002)(4326008)(486006)(81166006)(81156014)(8676002)(86362001)(446003)(11346002)(3846002)(26005)(6436002)(186003)(102836004)(33656002)(66066001)(5660300001)(74316002)(106356001)(105586002)(7696005)(25786009)(1857600001)(53546011)(2900100001)(2501003)(76176011)(9686003)(2351001)(68736007)(6916009)(14454004); DIR:OUT; SFP:1102; SCL:1; SRVR:CS1PR8401MB1223; 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:CS1PR8401MB1223; x-ms-traffictypediagnostic: CS1PR8401MB1223: 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)(10201501046)(93006095)(93001095)(3231254)(944501410)(52105095)(3002001)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011); SRVR:CS1PR8401MB1223; BCL:0; PCL:0; RULEID:; SRVR:CS1PR8401MB1223; x-forefront-prvs: 0667289FF8 received-spf: None (protection.outlook.com: hpe.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: CDm4mlVg2kJy3aviqgHnmBNgsGiugJWthFftAuzJ5J5NibbjsJo129TVrvSf8v7F2Dc2S9qVJjDUfX9qf5cLWbLx2OZCxk+QEfch0++9c4EUh2U3vat42/Nyrq6hqE+pE/ripObQdcU5f+LDWSnTKpK9SMBe4ag758dsHaWQ3/WrAfIkoo67Z9dmSlvdSp5/ spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: e55c0818-1466-4963-44d2-08d5b5816092 X-MS-Exchange-CrossTenant-Network-Message-Id: e55c0818-1466-4963-44d2-08d5b5816092 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 May 2018 07:49:21.7775 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-Transport-CrossTenantHeadersStamped: CS1PR8401MB1223 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" 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 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel