From nobody Sat Nov 2 08:35:06 2024 Delivered-To: importer@patchew.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; Authentication-Results: mx.zoho.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 1494565922537412.3564395465223; Thu, 11 May 2017 22:12:02 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id DE5EC21A04E31; Thu, 11 May 2017 22:12:00 -0700 (PDT) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (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 4444B21A04E31 for ; Thu, 11 May 2017 22:11:59 -0700 (PDT) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 May 2017 22:11:58 -0700 Received: from shwdeopenpsi168.ccr.corp.intel.com ([10.239.158.121]) by fmsmga004.fm.intel.com with ESMTP; 11 May 2017 22:11:57 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,327,1491289200"; d="scan'208";a="260202162" From: Yonghong Zhu To: edk2-devel@lists.01.org Date: Fri, 12 May 2017 13:11:54 +0800 Message-Id: <1494565914-75644-1-git-send-email-yonghong.zhu@intel.com> X-Mailer: git-send-email 2.6.1.windows.1 Subject: [edk2] [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: , Cc: Liming Gao MIME-Version: 1.0 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" 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 Reviewed-by: Liming Gao --- 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.TokenSpace= GuidCName) =3D=3D (TokenCName, TokenSpaceGuidCName): PcdDatumType =3D PcdItem.DatumType - NewValue =3D self._BuildOptionPcdValue= Format(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.Datum= Type TokenSpaceGuidCName =3D PcdIte= m.TokenSpaceGuidCName - NewValue =3D self._BuildOption= PcdValueFormat(TokenSpaceGuidCName, TokenCName, PcdDatumType, pcdvalue) + NewValue =3D BuildOptionPcdVal= ueFormat(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 =20 - 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 Vo= id* type PCD, when specify the Value in the command line, please use the fo= llowing 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 Vo= id* type PCD, when specify the Value in the command line, please use the fo= llowing format: "string", L"string", B"{...}"') - Value =3D Value[1:] - else: - if not Value[0]: - EdkLogger.error('build', OPTION_VALUE_INVALID, 'For Vo= id* type PCD, when specify the Value in the command line, please use the fo= llowing 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 =20 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 BS= D License # which accompanies this distribution. The full text of the license may b= e found at # http://opensource.org/licenses/bsd-license.php # @@ -1451,11 +1451,19 @@ class TopLevelMakefile(BuildFile): ExtraOption +=3D " --ignore-sources" =20 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[index= +1] + pcdName, pcdValue =3D GlobalData.gCommand[index+1].spl= it('=3D') + if pcdValue.startswith('H'): + pcdValue =3D 'H' + '"' + pcdValue[1:] + '"' + ExtraOption +=3D " --pcd " + pcdName + '=3D' + pcd= Value + elif pcdValue.startswith('L'): + pcdValue =3D 'L' + '"' + pcdValue[1:] + '"' + ExtraOption +=3D " --pcd " + pcdName + '=3D' + pcd= Value + else: + ExtraOption +=3D " --pcd " + GlobalData.gCommand[i= ndex+1] =20 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/Pyth= on/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) ) =20 +def BuildOptionPcdValueFormat(TokenSpaceGuidCName, TokenCName, PcdDatumTyp= e, Value): + if PcdDatumType =3D=3D 'VOID*': + if Value.startswith('L'): + if not Value[1]: + EdkLogger.error("build", FORMAT_INVALID, 'For Void* type P= CD, when specify the Value in the command line, please use the following fo= rmat: "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 P= CD, when specify the Value in the command line, please use the following fo= rmat: "string", L"string", H"{...}"') + Value =3D Value[1:] + else: + if not Value[0]: + EdkLogger.error("build", FORMAT_INVALID, 'For Void* type P= CD, when specify the Value in the command line, please use the following fo= rmat: "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/Py= thon/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 =20 ## Version and Copyright versionNumber =3D "1.0" + ' ' + gBUILD_VERSION @@ -406,35 +407,10 @@ def CheckBuildOptionPcd(): "The Pcd %s is found under mul= tiple different TokenSpaceGuid: %s and %s." % (TokenCName, PcdItem.TokenSpa= ceGuidCName, TokenSpaceGuidCNameList[0]) ) =20 GlobalData.BuildOptionPcd[i] =3D (TokenSpaceGuidCName, TokenCN= ame, NewValue) =20 -def BuildOptionPcdValueFormat(TokenSpaceGuidCName, TokenCName, PcdDatumTyp= e, 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 follo= wing 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 follo= wing 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 follo= wing 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 =20 ## FindExtendTool() # # Find location of tools to process data # --=20 2.6.1.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel