From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (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 5711D21A04E32 for ; Thu, 11 May 2017 22:24:52 -0700 (PDT) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 May 2017 22:24:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,327,1491289200"; d="scan'208";a="855820290" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by FMSMGA003.fm.intel.com with ESMTP; 11 May 2017 22:24:51 -0700 Received: from fmsmsx114.amr.corp.intel.com (10.18.116.8) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 11 May 2017 22:24:51 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX114.amr.corp.intel.com (10.18.116.8) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 11 May 2017 22:24:50 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.246]) by SHSMSX104.ccr.corp.intel.com ([10.239.4.70]) with mapi id 14.03.0319.002; Fri, 12 May 2017 13:24:48 +0800 From: "Gao, Liming" To: "Zhu, Yonghong" , "edk2-devel@lists.01.org" Thread-Topic: [Patch] BaseTools: Fix the bug for CArray PCD override in command line Thread-Index: AQHSyt5NXljapyFiWEmWQ0N35uT0rKHwKmXw Date: Fri, 12 May 2017 05:24:47 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14D72D794@shsmsx102.ccr.corp.intel.com> References: <1494565914-75644-1-git-send-email-yonghong.zhu@intel.com> In-Reply-To: <1494565914-75644-1-git-send-email-yonghong.zhu@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: Fix the bug for CArray PCD override in command line X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 May 2017 05:24:52 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Liming Gao >-----Original Message----- >From: Zhu, Yonghong >Sent: Friday, May 12, 2017 1:12 PM >To: edk2-devel@lists.01.org >Cc: Gao, Liming >Subject: [Patch] BaseTools: Fix the bug for CArray PCD override in command >line > >This patch updated the CArray PCD override format from B"{}" to H"{}" >which align to build spec. Besides, it also do the clean up for the >function BuildOptionPcdValueFormat. > >Cc: Liming Gao >Contributed-under: TianoCore Contribution Agreement 1.0 >Signed-off-by: Yonghong Zhu >--- > BaseTools/Source/Python/AutoGen/AutoGen.py | 29 ++-----------------------= -- >-- > BaseTools/Source/Python/AutoGen/GenMake.py | 12 ++++++++++-- > BaseTools/Source/Python/Common/Misc.py | 26 >++++++++++++++++++++++++++ > BaseTools/Source/Python/GenFds/GenFds.py | 26 +------------------------= - > 4 files changed, 39 insertions(+), 54 deletions(-) > >diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py >b/BaseTools/Source/Python/AutoGen/AutoGen.py >index 8d8957b..736c1ae 100644 >--- a/BaseTools/Source/Python/AutoGen/AutoGen.py >+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py >@@ -414,20 +414,20 @@ class WorkspaceAutoGen(AutoGen): > for key in package.Pcds: > PcdItem =3D package.Pcds[key] > if HasTokenSpace: > if (PcdItem.TokenCName, PcdItem.TokenSpac= eGuidCName) >=3D=3D (TokenCName, TokenSpaceGuidCName): > PcdDatumType =3D PcdItem.DatumType >- NewValue =3D >self._BuildOptionPcdValueFormat(TokenSpaceGuidCName, TokenCName, >PcdDatumType, pcdvalue) >+ NewValue =3D >BuildOptionPcdValueFormat(TokenSpaceGuidCName, TokenCName, >PcdDatumType, pcdvalue) > FoundFlag =3D True > else: > if PcdItem.TokenCName =3D=3D TokenCName: > if not PcdItem.TokenSpaceGuidCName in >TokenSpaceGuidCNameList: > if len (TokenSpaceGuidCNameList) = < 1: > >TokenSpaceGuidCNameList.append(PcdItem.TokenSpaceGuidCName) > PcdDatumType =3D PcdItem.Datu= mType > TokenSpaceGuidCName =3D >PcdItem.TokenSpaceGuidCName >- NewValue =3D >self._BuildOptionPcdValueFormat(TokenSpaceGuidCName, TokenCName, >PcdDatumType, pcdvalue) >+ NewValue =3D >BuildOptionPcdValueFormat(TokenSpaceGuidCName, TokenCName, >PcdDatumType, pcdvalue) > FoundFlag =3D True > else: > EdkLogger.error( > 'build', > AUTOGEN_ERROR, >@@ -695,35 +695,10 @@ class WorkspaceAutoGen(AutoGen): > with open(os.path.join(self.BuildDir, 'AutoGen'), 'w+') as file: > for f in AllWorkSpaceMetaFiles: > print >> file, f > return True > >- def _BuildOptionPcdValueFormat(self, TokenSpaceGuidCName, >TokenCName, PcdDatumType, Value): >- if PcdDatumType =3D=3D 'VOID*': >- if Value.startswith('L'): >- if not Value[1]: >- EdkLogger.error('build', OPTION_VALUE_INVALID, 'For V= oid* type >PCD, when specify the Value in the command line, please use the following >format: "string", L"string", B"{...}"') >- Value =3D Value[0] + '"' + Value[1:] + '"' >- elif Value.startswith('B'): >- if not Value[1]: >- EdkLogger.error('build', OPTION_VALUE_INVALID, 'For V= oid* type >PCD, when specify the Value in the command line, please use the following >format: "string", L"string", B"{...}"') >- Value =3D Value[1:] >- else: >- if not Value[0]: >- EdkLogger.error('build', OPTION_VALUE_INVALID, 'For V= oid* type >PCD, when specify the Value in the command line, please use the following >format: "string", L"string", B"{...}"') >- Value =3D '"' + Value + '"' >- >- IsValid, Cause =3D CheckPcdDatum(PcdDatumType, Value) >- if not IsValid: >- EdkLogger.error('build', FORMAT_INVALID, Cause, ExtraData=3D"= %s.%s" % >(TokenSpaceGuidCName, TokenCName)) >- if PcdDatumType =3D=3D 'BOOLEAN': >- Value =3D Value.upper() >- if Value =3D=3D 'TRUE' or Value =3D=3D '1': >- Value =3D '1' >- elif Value =3D=3D 'FALSE' or Value =3D=3D '0': >- Value =3D '0' >- return Value > > def _GetMetaFiles(self, Target, Toolchain, Arch): > AllWorkSpaceMetaFiles =3D set() > # > # add fdf >diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py >b/BaseTools/Source/Python/AutoGen/GenMake.py >index ac24bd8..0f3ddd5 100644 >--- a/BaseTools/Source/Python/AutoGen/GenMake.py >+++ b/BaseTools/Source/Python/AutoGen/GenMake.py >@@ -1,9 +1,9 @@ > ## @file > # Create makefile for MS nmake and GNU make > # >-# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.
>+# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
> # This program and the accompanying materials > # are licensed and made available under the terms and conditions of the B= SD >License > # which accompanies this distribution. The full text of the license may = be >found at > # http://opensource.org/licenses/bsd-license.php > # >@@ -1451,11 +1451,19 @@ class TopLevelMakefile(BuildFile): > ExtraOption +=3D " --ignore-sources" > > if GlobalData.BuildOptionPcd: > for index, option in enumerate(GlobalData.gCommand): > if "--pcd" =3D=3D option and GlobalData.gCommand[index+1]= : >- ExtraOption +=3D " --pcd " + GlobalData.gCommand[inde= x+1] >+ pcdName, pcdValue =3D GlobalData.gCommand[index+1].sp= lit('=3D') >+ if pcdValue.startswith('H'): >+ pcdValue =3D 'H' + '"' + pcdValue[1:] + '"' >+ ExtraOption +=3D " --pcd " + pcdName + '=3D' + pc= dValue >+ elif pcdValue.startswith('L'): >+ pcdValue =3D 'L' + '"' + pcdValue[1:] + '"' >+ ExtraOption +=3D " --pcd " + pcdName + '=3D' + pc= dValue >+ else: >+ ExtraOption +=3D " --pcd " + GlobalData.gCommand[= index+1] > > MakefileName =3D self._FILE_NAME_[self._FileType] > SubBuildCommandList =3D [] > for A in PlatformInfo.ArchList: > Command =3D self._MAKE_TEMPLATE_[self._FileType] % >{"file":os.path.join("$(BUILD_DIR)", A, MakefileName)} >diff --git a/BaseTools/Source/Python/Common/Misc.py >b/BaseTools/Source/Python/Common/Misc.py >index 390ef36..dbb711e 100644 >--- a/BaseTools/Source/Python/Common/Misc.py >+++ b/BaseTools/Source/Python/Common/Misc.py >@@ -2060,10 +2060,36 @@ def PackRegistryFormatGuid(Guid): > int(Guid[4][-6:-4], 16), > int(Guid[4][-4:-2], 16), > int(Guid[4][-2:], 16) > ) > >+def BuildOptionPcdValueFormat(TokenSpaceGuidCName, TokenCName, >PcdDatumType, Value): >+ if PcdDatumType =3D=3D 'VOID*': >+ if Value.startswith('L'): >+ if not Value[1]: >+ EdkLogger.error("build", FORMAT_INVALID, 'For Void* type = PCD, >when specify the Value in the command line, please use the following forma= t: >"string", L"string", H"{...}"') >+ Value =3D Value[0] + '"' + Value[1:] + '"' >+ elif Value.startswith('H'): >+ if not Value[1]: >+ EdkLogger.error("build", FORMAT_INVALID, 'For Void* type = PCD, >when specify the Value in the command line, please use the following forma= t: >"string", L"string", H"{...}"') >+ Value =3D Value[1:] >+ else: >+ if not Value[0]: >+ EdkLogger.error("build", FORMAT_INVALID, 'For Void* type = PCD, >when specify the Value in the command line, please use the following forma= t: >"string", L"string", H"{...}"') >+ Value =3D '"' + Value + '"' >+ >+ IsValid, Cause =3D CheckPcdDatum(PcdDatumType, Value) >+ if not IsValid: >+ EdkLogger.error("build", FORMAT_INVALID, Cause, ExtraData=3D"%s.%= s" % >(TokenSpaceGuidCName, TokenCName)) >+ if PcdDatumType =3D=3D 'BOOLEAN': >+ Value =3D Value.upper() >+ if Value =3D=3D 'TRUE' or Value =3D=3D '1': >+ Value =3D '1' >+ elif Value =3D=3D 'FALSE' or Value =3D=3D '0': >+ Value =3D '0' >+ return Value >+ > ## > # > # This acts like the main() function for the script, unless it is 'import= 'ed into >another > # script. > # >diff --git a/BaseTools/Source/Python/GenFds/GenFds.py >b/BaseTools/Source/Python/GenFds/GenFds.py >index aa8c041..277da35 100644 >--- a/BaseTools/Source/Python/GenFds/GenFds.py >+++ b/BaseTools/Source/Python/GenFds/GenFds.py >@@ -37,10 +37,11 @@ from Common.String import * > from Common.Misc import DirCache, PathClass > from Common.Misc import SaveFileOnChange > from Common.Misc import ClearDuplicatedInf > from Common.Misc import GuidStructureStringToGuidString > from Common.Misc import CheckPcdDatum >+from Common.Misc import BuildOptionPcdValueFormat > from Common.BuildVersion import gBUILD_VERSION > from Common.MultipleWorkspace import MultipleWorkspace as mws > > ## Version and Copyright > versionNumber =3D "1.0" + ' ' + gBUILD_VERSION >@@ -406,35 +407,10 @@ def CheckBuildOptionPcd(): > "The Pcd %s is found under mu= ltiple different >TokenSpaceGuid: %s and %s." % (TokenCName, >PcdItem.TokenSpaceGuidCName, TokenSpaceGuidCNameList[0]) > ) > > GlobalData.BuildOptionPcd[i] =3D (TokenSpaceGuidCName, TokenC= Name, >NewValue) > >-def BuildOptionPcdValueFormat(TokenSpaceGuidCName, TokenCName, >PcdDatumType, Value): >- if PcdDatumType =3D=3D 'VOID*': >- if Value.startswith('L'): >- if not Value[1]: >- EdkLogger.error('GenFds', OPTION_VALUE_INVALID, 'For Void= * type >PCD, when specify the Value in the command line, please use the following >format: "string", L"string", B"{...}"') >- Value =3D Value[0] + '"' + Value[1:] + '"' >- elif Value.startswith('B'): >- if not Value[1]: >- EdkLogger.error('GenFds', OPTION_VALUE_INVALID, 'For Void= * type >PCD, when specify the Value in the command line, please use the following >format: "string", L"string", B"{...}"') >- Value =3D Value[1:] >- else: >- if not Value[0]: >- EdkLogger.error('GenFds', OPTION_VALUE_INVALID, 'For Void= * type >PCD, when specify the Value in the command line, please use the following >format: "string", L"string", B"{...}"') >- Value =3D '"' + Value + '"' >- >- IsValid, Cause =3D CheckPcdDatum(PcdDatumType, Value) >- if not IsValid: >- EdkLogger.error('build', FORMAT_INVALID, Cause, ExtraData=3D"%s.%= s" % >(TokenSpaceGuidCName, TokenCName)) >- if PcdDatumType =3D=3D 'BOOLEAN': >- Value =3D Value.upper() >- if Value =3D=3D 'TRUE' or Value =3D=3D '1': >- Value =3D '1' >- elif Value =3D=3D 'FALSE' or Value =3D=3D '0': >- Value =3D '0' >- return Value > > ## FindExtendTool() > # > # Find location of tools to process data > # >-- >2.6.1.windows.1