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 <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
@ -416,7 +416,7 @@ class WorkspaceAutoGen(AutoGen):
|
|||||||
if HasTokenSpace:
|
if HasTokenSpace:
|
||||||
if (PcdItem.TokenCName, PcdItem.TokenSpaceGuidCName) == (TokenCName, TokenSpaceGuidCName):
|
if (PcdItem.TokenCName, PcdItem.TokenSpaceGuidCName) == (TokenCName, TokenSpaceGuidCName):
|
||||||
PcdDatumType = PcdItem.DatumType
|
PcdDatumType = PcdItem.DatumType
|
||||||
NewValue = self._BuildOptionPcdValueFormat(TokenSpaceGuidCName, TokenCName, PcdDatumType, pcdvalue)
|
NewValue = BuildOptionPcdValueFormat(TokenSpaceGuidCName, TokenCName, PcdDatumType, pcdvalue)
|
||||||
FoundFlag = True
|
FoundFlag = True
|
||||||
else:
|
else:
|
||||||
if PcdItem.TokenCName == TokenCName:
|
if PcdItem.TokenCName == TokenCName:
|
||||||
@ -425,7 +425,7 @@ class WorkspaceAutoGen(AutoGen):
|
|||||||
TokenSpaceGuidCNameList.append(PcdItem.TokenSpaceGuidCName)
|
TokenSpaceGuidCNameList.append(PcdItem.TokenSpaceGuidCName)
|
||||||
PcdDatumType = PcdItem.DatumType
|
PcdDatumType = PcdItem.DatumType
|
||||||
TokenSpaceGuidCName = PcdItem.TokenSpaceGuidCName
|
TokenSpaceGuidCName = PcdItem.TokenSpaceGuidCName
|
||||||
NewValue = self._BuildOptionPcdValueFormat(TokenSpaceGuidCName, TokenCName, PcdDatumType, pcdvalue)
|
NewValue = BuildOptionPcdValueFormat(TokenSpaceGuidCName, TokenCName, PcdDatumType, pcdvalue)
|
||||||
FoundFlag = True
|
FoundFlag = True
|
||||||
else:
|
else:
|
||||||
EdkLogger.error(
|
EdkLogger.error(
|
||||||
@ -697,31 +697,6 @@ class WorkspaceAutoGen(AutoGen):
|
|||||||
print >> file, f
|
print >> file, f
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _BuildOptionPcdValueFormat(self, TokenSpaceGuidCName, TokenCName, PcdDatumType, Value):
|
|
||||||
if PcdDatumType == 'VOID*':
|
|
||||||
if Value.startswith('L'):
|
|
||||||
if not Value[1]:
|
|
||||||
EdkLogger.error('build', 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 = Value[0] + '"' + Value[1:] + '"'
|
|
||||||
elif Value.startswith('B'):
|
|
||||||
if not Value[1]:
|
|
||||||
EdkLogger.error('build', 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 = Value[1:]
|
|
||||||
else:
|
|
||||||
if not Value[0]:
|
|
||||||
EdkLogger.error('build', 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 = '"' + Value + '"'
|
|
||||||
|
|
||||||
IsValid, Cause = CheckPcdDatum(PcdDatumType, Value)
|
|
||||||
if not IsValid:
|
|
||||||
EdkLogger.error('build', FORMAT_INVALID, Cause, ExtraData="%s.%s" % (TokenSpaceGuidCName, TokenCName))
|
|
||||||
if PcdDatumType == 'BOOLEAN':
|
|
||||||
Value = Value.upper()
|
|
||||||
if Value == 'TRUE' or Value == '1':
|
|
||||||
Value = '1'
|
|
||||||
elif Value == 'FALSE' or Value == '0':
|
|
||||||
Value = '0'
|
|
||||||
return Value
|
|
||||||
|
|
||||||
def _GetMetaFiles(self, Target, Toolchain, Arch):
|
def _GetMetaFiles(self, Target, Toolchain, Arch):
|
||||||
AllWorkSpaceMetaFiles = set()
|
AllWorkSpaceMetaFiles = set()
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
## @file
|
## @file
|
||||||
# Create makefile for MS nmake and GNU make
|
# Create makefile for MS nmake and GNU make
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -1453,7 +1453,15 @@ class TopLevelMakefile(BuildFile):
|
|||||||
if GlobalData.BuildOptionPcd:
|
if GlobalData.BuildOptionPcd:
|
||||||
for index, option in enumerate(GlobalData.gCommand):
|
for index, option in enumerate(GlobalData.gCommand):
|
||||||
if "--pcd" == option and GlobalData.gCommand[index+1]:
|
if "--pcd" == option and GlobalData.gCommand[index+1]:
|
||||||
ExtraOption += " --pcd " + GlobalData.gCommand[index+1]
|
pcdName, pcdValue = GlobalData.gCommand[index+1].split('=')
|
||||||
|
if pcdValue.startswith('H'):
|
||||||
|
pcdValue = 'H' + '"' + pcdValue[1:] + '"'
|
||||||
|
ExtraOption += " --pcd " + pcdName + '=' + pcdValue
|
||||||
|
elif pcdValue.startswith('L'):
|
||||||
|
pcdValue = 'L' + '"' + pcdValue[1:] + '"'
|
||||||
|
ExtraOption += " --pcd " + pcdName + '=' + pcdValue
|
||||||
|
else:
|
||||||
|
ExtraOption += " --pcd " + GlobalData.gCommand[index+1]
|
||||||
|
|
||||||
MakefileName = self._FILE_NAME_[self._FileType]
|
MakefileName = self._FILE_NAME_[self._FileType]
|
||||||
SubBuildCommandList = []
|
SubBuildCommandList = []
|
||||||
|
@ -2062,6 +2062,32 @@ def PackRegistryFormatGuid(Guid):
|
|||||||
int(Guid[4][-2:], 16)
|
int(Guid[4][-2:], 16)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def BuildOptionPcdValueFormat(TokenSpaceGuidCName, TokenCName, PcdDatumType, Value):
|
||||||
|
if PcdDatumType == '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 format: "string", L"string", H"{...}"')
|
||||||
|
Value = 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 format: "string", L"string", H"{...}"')
|
||||||
|
Value = 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 format: "string", L"string", H"{...}"')
|
||||||
|
Value = '"' + Value + '"'
|
||||||
|
|
||||||
|
IsValid, Cause = CheckPcdDatum(PcdDatumType, Value)
|
||||||
|
if not IsValid:
|
||||||
|
EdkLogger.error("build", FORMAT_INVALID, Cause, ExtraData="%s.%s" % (TokenSpaceGuidCName, TokenCName))
|
||||||
|
if PcdDatumType == 'BOOLEAN':
|
||||||
|
Value = Value.upper()
|
||||||
|
if Value == 'TRUE' or Value == '1':
|
||||||
|
Value = '1'
|
||||||
|
elif Value == 'FALSE' or Value == '0':
|
||||||
|
Value = '0'
|
||||||
|
return Value
|
||||||
|
|
||||||
##
|
##
|
||||||
#
|
#
|
||||||
# This acts like the main() function for the script, unless it is 'import'ed into another
|
# This acts like the main() function for the script, unless it is 'import'ed into another
|
||||||
|
@ -39,6 +39,7 @@ from Common.Misc import SaveFileOnChange
|
|||||||
from Common.Misc import ClearDuplicatedInf
|
from Common.Misc import ClearDuplicatedInf
|
||||||
from Common.Misc import GuidStructureStringToGuidString
|
from Common.Misc import GuidStructureStringToGuidString
|
||||||
from Common.Misc import CheckPcdDatum
|
from Common.Misc import CheckPcdDatum
|
||||||
|
from Common.Misc import BuildOptionPcdValueFormat
|
||||||
from Common.BuildVersion import gBUILD_VERSION
|
from Common.BuildVersion import gBUILD_VERSION
|
||||||
from Common.MultipleWorkspace import MultipleWorkspace as mws
|
from Common.MultipleWorkspace import MultipleWorkspace as mws
|
||||||
|
|
||||||
@ -408,31 +409,6 @@ def CheckBuildOptionPcd():
|
|||||||
|
|
||||||
GlobalData.BuildOptionPcd[i] = (TokenSpaceGuidCName, TokenCName, NewValue)
|
GlobalData.BuildOptionPcd[i] = (TokenSpaceGuidCName, TokenCName, NewValue)
|
||||||
|
|
||||||
def BuildOptionPcdValueFormat(TokenSpaceGuidCName, TokenCName, PcdDatumType, Value):
|
|
||||||
if PcdDatumType == '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 = 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 = 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 = '"' + Value + '"'
|
|
||||||
|
|
||||||
IsValid, Cause = CheckPcdDatum(PcdDatumType, Value)
|
|
||||||
if not IsValid:
|
|
||||||
EdkLogger.error('build', FORMAT_INVALID, Cause, ExtraData="%s.%s" % (TokenSpaceGuidCName, TokenCName))
|
|
||||||
if PcdDatumType == 'BOOLEAN':
|
|
||||||
Value = Value.upper()
|
|
||||||
if Value == 'TRUE' or Value == '1':
|
|
||||||
Value = '1'
|
|
||||||
elif Value == 'FALSE' or Value == '0':
|
|
||||||
Value = '0'
|
|
||||||
return Value
|
|
||||||
|
|
||||||
## FindExtendTool()
|
## FindExtendTool()
|
||||||
#
|
#
|
||||||
|
Reference in New Issue
Block a user