From db55dac77579fa2722e4457bfc4369f98b8ff52a Mon Sep 17 00:00:00 2001 From: Yonghong Zhu Date: Fri, 12 May 2017 12:12:23 +0800 Subject: 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 Reviewed-by: Liming Gao --- BaseTools/Source/Python/Common/Misc.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'BaseTools/Source/Python/Common/Misc.py') diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py index 390ef3606f..dbb711e96c 100644 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -2062,6 +2062,32 @@ def PackRegistryFormatGuid(Guid): 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 -- cgit v1.2.3