From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.24; helo=mga09.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (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 61D8C21962301 for ; Mon, 24 Sep 2018 18:08:20 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Sep 2018 18:08:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,300,1534834800"; d="scan'208";a="82974783" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by FMSMGA003.fm.intel.com with ESMTP; 24 Sep 2018 18:08:19 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 24 Sep 2018 18:08:19 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.183]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.37]) with mapi id 14.03.0319.002; Tue, 25 Sep 2018 09:07:37 +0800 From: "Gao, Liming" To: "Zhao, ZhiqiangX" , "edk2-devel@lists.01.org" Thread-Topic: [PATCH V2] BaseTools: Latter full value should overwrite the former field value. Thread-Index: AQHUSnnVJCVAnKzm4ECRISn7uMxJkqUAQ1HQ Date: Tue, 25 Sep 2018 01:07:36 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E3177E5@SHSMSX104.ccr.corp.intel.com> References: <20180912091926.21356-1-zhiqiangx.zhao@intel.com> In-Reply-To: <20180912091926.21356-1-zhiqiangx.zhao@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 Subject: Re: [PATCH V2] BaseTools: Latter full value should overwrite the former field value. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2018 01:08:20 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Liming Gao >-----Original Message----- >From: Zhao, ZhiqiangX >Sent: Wednesday, September 12, 2018 5:19 PM >To: edk2-devel@lists.01.org >Cc: Zhao, ZhiqiangX ; Gao, Liming >; Zhu, Yonghong ; Feng, >Bob C >Subject: [PATCH V2] BaseTools: Latter full value should overwrite the form= er >field value. > >For structure Pcd, the latter full assign value in commandLine should >override the former field assign value. For example in commandLine, >build --pcd Token.pcd.field=3D"haha" --pcd Token.pcd=3DH"{0x01,0x02}", >the former field value "haha" will be ignored and overwrite by the latter >full value "{0x01,0x02}". > >Contributed-under: TianoCore Contribution Agreement 1.1 >Signed-off-by: ZhiqiangX Zhao >Cc: Liming Gao >Cc: Yonghong Zhu >Cc: Bob Feng >--- > BaseTools/Source/Python/Workspace/DscBuildData.py | 17 >+++++++++++++++++ > BaseTools/Source/Python/build/BuildReport.py | 20 ++++++++++++++++- >--- > 2 files changed, 33 insertions(+), 4 deletions(-) > >diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py >b/BaseTools/Source/Python/Workspace/DscBuildData.py >index 88ba415c5a..4e505c1e99 100644 >--- a/BaseTools/Source/Python/Workspace/DscBuildData.py >+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py >@@ -1032,6 +1032,23 @@ class DscBuildData(PlatformBuildClassObject): > PcdItem =3D BuildData.Pcds[key] > if (TokenSpaceGuidCName, TokenCName) =3D=3D >(PcdItem.TokenSpaceGuidCName, PcdItem.TokenCName) and FieldName >=3D=3D"": > PcdItem.DefaultValue =3D pcdvalue >+ #In command line, the latter full assign value in commandLine sho= uld >override the former field assign value. >+ #For example, --pcd Token.pcd.field=3D"" --pcd Token.pcd=3DH"{}" >+ delete_assign =3D [] >+ field_assign =3D {} >+ if GlobalData.BuildOptionPcd: >+ for pcdTuple in GlobalData.BuildOptionPcd: >+ TokenSpaceGuid, Token, Field =3D pcdTuple[0], pcdTuple[1]= , >pcdTuple[2] >+ if Field: >+ if (TokenSpaceGuid, Token) not in field_assign: >+ field_assign[TokenSpaceGuid, Token] =3D [] >+ field_assign[TokenSpaceGuid, Token].append(pcdTuple) >+ else: >+ if (TokenSpaceGuid, Token) in field_assign: >+ delete_assign.extend(field_assign[TokenSpaceGuid,= Token]) >+ field_assign[TokenSpaceGuid, Token] =3D [] >+ for item in delete_assign: >+ GlobalData.BuildOptionPcd.remove(item) > > @staticmethod > def HandleFlexiblePcd(TokenSpaceGuidCName, TokenCName, PcdValue, >PcdDatumType, GuidDict, FieldName=3D''): >diff --git a/BaseTools/Source/Python/build/BuildReport.py >b/BaseTools/Source/Python/build/BuildReport.py >index a598d64244..3886a7a55e 100644 >--- a/BaseTools/Source/Python/build/BuildReport.py >+++ b/BaseTools/Source/Python/build/BuildReport.py >@@ -982,12 +982,16 @@ class PcdReport(object): > PcdValue =3D DecDefaultValue > if DscDefaultValue: > PcdValue =3D DscDefaultValue >- Pcd.DefaultValue =3D PcdValue >+ #The DefaultValue of StructurePcd already be the latest, = no need to >update. >+ if not self.IsStructurePcd(Pcd.TokenCName, >Pcd.TokenSpaceGuidCName): >+ Pcd.DefaultValue =3D PcdValue > if ModulePcdSet is not None: > if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Type) no= t in >ModulePcdSet: > continue > InfDefaultValue, PcdValue =3D ModulePcdSet[Pcd.TokenC= Name, >Pcd.TokenSpaceGuidCName, Type] >- Pcd.DefaultValue =3D PcdValue >+ #The DefaultValue of StructurePcd already be the late= st, no need >to update. >+ if not self.IsStructurePcd(Pcd.TokenCName, >Pcd.TokenSpaceGuidCName): >+ Pcd.DefaultValue =3D PcdValue > if InfDefaultValue: > try: > InfDefaultValue =3D ValueExpressionEx(InfDefa= ultValue, >Pcd.DatumType, self._GuidDict)(True) >@@ -1003,7 +1007,9 @@ class PcdReport(object): > if pcd[2]: > continue > PcdValue =3D pcd[3] >- Pcd.DefaultValue =3D PcdValue >+ #The DefaultValue of StructurePcd already be = the latest, no >need to update. >+ if not self.IsStructurePcd(Pcd.TokenCName, >Pcd.TokenSpaceGuidCName): >+ Pcd.DefaultValue =3D PcdValue > BuildOptionMatch =3D True > break > >@@ -1050,7 +1056,7 @@ class PcdReport(object): > DscMatch =3D (DscDefaultValue.strip() =3D=3D PcdV= alue.strip()) > > IsStructure =3D False >- if GlobalData.gStructurePcd and (self.Arch in >GlobalData.gStructurePcd) and ((Pcd.TokenCName, >Pcd.TokenSpaceGuidCName) in GlobalData.gStructurePcd[self.Arch]): >+ if self.IsStructurePcd(Pcd.TokenCName, >Pcd.TokenSpaceGuidCName): > IsStructure =3D True > if TypeName in ('DYNVPD', 'DEXVPD'): > SkuInfoList =3D Pcd.SkuInfoList >@@ -1413,6 +1419,12 @@ class PcdReport(object): > else: > return value > >+ def IsStructurePcd(self, PcdToken, PcdTokenSpaceGuid): >+ if GlobalData.gStructurePcd and (self.Arch in GlobalData.gStructu= rePcd) >and ((PcdToken, PcdTokenSpaceGuid) in GlobalData.gStructurePcd[self.Arch])= : >+ return True >+ else: >+ return False >+ > ## > # Reports platform and module Prediction information > # >-- >2.14.1.windows.1