From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: liming.gao@intel.com) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by groups.io with SMTP; Sun, 08 Sep 2019 23:46:11 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Sep 2019 23:46:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,484,1559545200"; d="scan'208";a="335500164" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga004.jf.intel.com with ESMTP; 08 Sep 2019 23:46:10 -0700 Received: from fmsmsx606.amr.corp.intel.com (10.18.126.86) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 8 Sep 2019 23:46:10 -0700 Received: from fmsmsx606.amr.corp.intel.com (10.18.126.86) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Sun, 8 Sep 2019 23:46:09 -0700 Received: from shsmsx108.ccr.corp.intel.com (10.239.4.97) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Sun, 8 Sep 2019 23:46:09 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.32]) by SHSMSX108.ccr.corp.intel.com ([169.254.8.146]) with mapi id 14.03.0439.000; Mon, 9 Sep 2019 14:46:08 +0800 From: "Liming Gao" To: "devel@edk2.groups.io" , "Feng, Bob C" CC: "Shi, Steven" Subject: Re: [edk2-devel] [Patch 1/1] BaseTools: Sort Pcd settings to make PcdTokenNumber be fixed Thread-Topic: [edk2-devel] [Patch 1/1] BaseTools: Sort Pcd settings to make PcdTokenNumber be fixed Thread-Index: AQHVYvXiVf8h0wIWmk6mJATr/HwDdKci7pRA Date: Mon, 9 Sep 2019 06:46:07 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E4F48C6@SHSMSX104.ccr.corp.intel.com> References: <20190904075337.19764-1-bob.c.feng@intel.com> In-Reply-To: <20190904075337.19764-1-bob.c.feng@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: liming.gao@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Liming Gao >-----Original Message----- >From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of >Bob Feng >Sent: Wednesday, September 04, 2019 3:54 PM >To: devel@edk2.groups.io >Cc: Feng, Bob C ; Gao, Liming >; Shi, Steven >Subject: [edk2-devel] [Patch 1/1] BaseTools: Sort Pcd settings to make >PcdTokenNumber be fixed > >BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2147 > >This patch is to sort the Pcd settings so that PcdTokenNumber >will not change if the platform's Pcd settings are the same. > >Signed-off-by: Bob Feng >Cc: Liming Gao >Cc: Steven Shi >--- > BaseTools/Source/Python/AutoGen/PlatformAutoGen.py | 3 ++- > BaseTools/Source/Python/Workspace/BuildClassObject.py | 10 ++++++++++ > 2 files changed, 12 insertions(+), 1 deletion(-) > >diff --git a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py >b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py >index 565424a95ead..a16918fd3178 100644 >--- a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py >+++ b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py >@@ -437,11 +437,11 @@ class PlatformAutoGen(AutoGen): > NoDatumTypePcdListString =3D "\n\t\t".join(NoDatumTypePcdLis= t) > EdkLogger.error("build", AUTOGEN_ERROR, "PCD setting error", > File=3Dself.MetaFile, > ExtraData=3D"\n\tPCD(s) without MaxDatumSize= :\n\t\t%s\n" > % NoDatumTypePcdListString) >- self._NonDynamicPcdList =3D self._NonDynaPcdList_ >+ self._NonDynamicPcdList =3D sorted(self._NonDynaPcdList_) > self._DynamicPcdList =3D self._DynaPcdList_ > > def SortDynamicPcd(self): > # > # Sort dynamic PCD list to: >@@ -700,10 +700,11 @@ class PlatformAutoGen(AutoGen): > OtherPcdArray.add(Pcd) > del self._DynamicPcdList[:] > self._DynamicPcdList.extend(list(UnicodePcdArray)) > self._DynamicPcdList.extend(list(HiiPcdArray)) > self._DynamicPcdList.extend(list(OtherPcdArray)) >+ self._DynamicPcdList.sort() > allskuset =3D [(SkuName, Sku.SkuId) for pcd in self._DynamicPcdL= ist for >(SkuName, Sku) in pcd.SkuInfoList.items()] > for pcd in self._DynamicPcdList: > if len(pcd.SkuInfoList) =3D=3D 1: > for (SkuName, SkuId) in allskuset: > if isinstance(SkuId, str) and eval(SkuId) =3D=3D 0 o= r SkuId =3D=3D 0: >diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py >b/BaseTools/Source/Python/Workspace/BuildClassObject.py >index 5d2bb733752a..db40e3b10c3c 100644 >--- a/BaseTools/Source/Python/Workspace/BuildClassObject.py >+++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py >@@ -12,10 +12,11 @@ import re > from collections import OrderedDict > from Common.Misc import CopyDict,ArrayIndex > import copy > import Common.EdkLogger as EdkLogger > from Common.BuildToolError import OPTION_VALUE_INVALID >+from Common.caching import cached_property > StructPattern =3D re.compile(r'[_a-zA-Z][0-9A-Za-z_\[\]]*$') > > ## PcdClassObject > # > # This Class is used for PcdObject >@@ -225,10 +226,19 @@ class PcdClassObject(object): > # @retval truple() Key for hash table > # > def __hash__(self): > return hash((self.TokenCName, self.TokenSpaceGuidCName)) > >+ @cached_property >+ def _fullname(self): >+ return ".".join((self.TokenSpaceGuidCName,self.TokenCName)) >+ >+ def __lt__(self,pcd): >+ return self._fullname < pcd._fullname >+ def __gt__(self,pcd): >+ return self._fullname > pcd._fullname >+ > def sharedcopy(self,new_pcd): > new_pcd.TokenCName =3D self.TokenCName > new_pcd.TokenSpaceGuidCName =3D self.TokenSpaceGuidCName > new_pcd.TokenSpaceGuidValue =3D self.TokenSpaceGuidValue > new_pcd.Type =3D self.Type >-- >2.20.1.windows.1 > > >