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.20; helo=mga02.intel.com; envelope-from=yonghong.zhu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (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 5276521959CB2 for ; Tue, 11 Sep 2018 20:49:40 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Sep 2018 20:49:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,363,1531810800"; d="scan'208";a="256445829" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga005.jf.intel.com with ESMTP; 11 Sep 2018 20:49:26 -0700 Received: from fmsmsx155.amr.corp.intel.com (10.18.116.71) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 11 Sep 2018 20:49:26 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by FMSMSX155.amr.corp.intel.com (10.18.116.71) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 11 Sep 2018 20:49:26 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.240]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.205]) with mapi id 14.03.0319.002; Wed, 12 Sep 2018 11:49:23 +0800 From: "Zhu, Yonghong" To: "Zhao, ZhiqiangX" , "edk2-devel@lists.01.org" CC: "Gao, Liming" , "Feng, Bob C" , "Zhu, Yonghong" Thread-Topic: [PATCH] BaseTools: pcd in commandLine. Thread-Index: AQHUSjnOg0PsKs0anEuFoDEuLalmC6TsAiYQ Date: Wed, 12 Sep 2018 03:49:23 +0000 Message-ID: References: <20180912014126.16724-1-zhiqiangx.zhao@intel.com> In-Reply-To: <20180912014126.16724-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] BaseTools: pcd in commandLine. 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: Wed, 12 Sep 2018 03:49:40 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable The patch's subject is too generic. Best Regards, Zhu Yonghong -----Original Message----- From: Zhao, ZhiqiangX=20 Sent: Wednesday, September 12, 2018 9:41 AM To: edk2-devel@lists.01.org Cc: Zhao, ZhiqiangX ; Gao, Liming ; Zhu, Yonghong ; Feng, Bob C Subject: [PATCH] BaseTools: pcd in commandLine. In command line, the latter full assign value in commandLine should overrid= e the former field assign value. For example, --pcd Token.pcd.field=3D"" --pcd Token.pcd=3DH"{}". 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 aaef404772..74cb135bbd 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 (PcdIt= em.TokenSpaceGuidCName, PcdItem.TokenCName) and FieldName =3D=3D"": PcdItem.DefaultValue =3D pcdvalue + #In command line, the latter full assign value in commandLine shou= ld 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) =20 @staticmethod def HandleFlexiblePcd(TokenSpaceGuidCName, TokenCName, PcdValue, PcdDa= tumType, GuidDict, FieldName=3D''): diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Sourc= e/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, n= o need to update. + if not self.IsStructurePcd(Pcd.TokenCName, Pcd.TokenSpaceG= uidCName): + Pcd.DefaultValue =3D PcdValue if ModulePcdSet is not None: if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Type) not= in ModulePcdSet: continue InfDefaultValue, PcdValue =3D ModulePcdSet[Pcd.TokenCN= ame, Pcd.TokenSpaceGuidCName, Type] - Pcd.DefaultValue =3D PcdValue + #The DefaultValue of StructurePcd already be the lates= t, no need to update. + if not self.IsStructurePcd(Pcd.TokenCName, Pcd.TokenSp= aceGuidCName): + Pcd.DefaultValue =3D PcdValue if InfDefaultValue: try: InfDefaultValue =3D ValueExpressionEx(InfDefau= ltValue, Pcd.DatumType, self._GuidDict)(True) @@ -1003,7 +1007,9 @@ class P= cdReport(object): if pcd[2]: continue PcdValue =3D pcd[3] - Pcd.DefaultValue =3D PcdValue + #The DefaultValue of StructurePcd already be t= he latest, no need to update. + if not self.IsStructurePcd(Pcd.TokenCName, Pcd= .TokenSpaceGuidCName): + Pcd.DefaultValue =3D PcdValue BuildOptionMatch =3D True break =20 @@ -1050,7 +1056,7 @@ class PcdReport(object): DscMatch =3D (DscDefaultValue.strip() =3D=3D PcdVa= lue.strip()) =20 IsStructure =3D False - if GlobalData.gStructurePcd and (self.Arch in GlobalData.g= StructurePcd) and ((Pcd.TokenCName, Pcd.TokenSpaceGuidCName) in GlobalData.= gStructurePcd[self.Arch]): + if self.IsStructurePcd(Pcd.TokenCName, Pcd.TokenSpaceGuidC= Name): IsStructure =3D True if TypeName in ('DYNVPD', 'DEXVPD'): SkuInfoList =3D Pcd.SkuInfoList @@ -1413,6 +1419,1= 2 @@ class PcdReport(object): else: return value =20 + def IsStructurePcd(self, PcdToken, PcdTokenSpaceGuid): + if GlobalData.gStructurePcd and (self.Arch in GlobalData.gStructur= ePcd) and ((PcdToken, PcdTokenSpaceGuid) in GlobalData.gStructurePcd[self.A= rch]): + return True + else: + return False + ## # Reports platform and module Prediction information # -- 2.14.1.windows.1