X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=BaseTools%2FSource%2FPython%2FCommon%2FMisc.py;h=1461d00669c20e54542f954d1bd336fe19a0a495;hp=b34cb4c3be6008dff3dc164e2e83154b23655e41;hb=8aaa8f7bc0f5dc79bce476e2ffa8a956c4db8bb0;hpb=6f49996cedfb198beb374ea0cb89a06a71ef960c diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py index b34cb4c3be..1461d00669 100644 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -1535,16 +1535,10 @@ def ParseFieldValue (Value): if Value.startswith('GUID') and Value.endswith(')'): Value = Value.split('(', 1)[1][:-1].strip() if Value[0] == '{' and Value[-1] == '}': - Value = Value[1:-1].strip() - Value = Value.split('{', 1) - Value = ['%02x' % int(Item, 16) for Item in (Value[0] + Value[1][:-1]).split(',')] - if len(Value[0]) != 8: - Value[0] = '%08X' % int(Value[0], 16) - if len(Value[1]) != 4: - Value[1] = '%04X' % int(Value[1], 16) - if len(Value[2]) != 4: - Value[2] = '%04X' % int(Value[2], 16) - Value = '-'.join(Value[0:3]) + '-' + ''.join(Value[3:5]) + '-' + ''.join(Value[5:11]) + TmpValue = GuidStructureStringToGuidString(Value) + if len(TmpValue) == 0: + raise BadExpression("Invalid GUID value string %s" % Value) + Value = TmpValue if Value[0] == '"' and Value[-1] == '"': Value = Value[1:-1] try: @@ -1572,6 +1566,8 @@ def ParseFieldValue (Value): if Value.startswith("L'") and Value.endswith("'"): # Unicode Character Constant List = list(Value[2:-1]) + if len(List) == 0: + raise BadExpression('Length %s is %s' % (Value, len(List))) List.reverse() Value = 0 for Char in List: @@ -1580,6 +1576,8 @@ def ParseFieldValue (Value): if Value.startswith("'") and Value.endswith("'"): # Character constant List = list(Value[1:-1]) + if len(List) == 0: + raise BadExpression('Length %s is %s' % (Value, len(List))) List.reverse() Value = 0 for Char in List: @@ -1599,7 +1597,8 @@ def ParseFieldValue (Value): Value = (Value << 8) | ((ItemValue >> 8 * I) & 0xff) return Value, RetSize if Value.startswith('DEVICE_PATH(') and Value.endswith(')'): - Value = Value.split('"')[1] + Value = Value.replace("DEVICE_PATH(", '').rstrip(')') + Value = Value.strip().strip('"') return ParseDevPathValue(Value) if Value.lower().startswith('0x'): Value = int(Value, 16) @@ -2240,6 +2239,10 @@ class SkuClass(): GlobalData.gSkuids = (self.SkuIdSet) if 'COMMON' in GlobalData.gSkuids: GlobalData.gSkuids.remove('COMMON') + if self.SkuUsageType == self.SINGLE: + if len(GlobalData.gSkuids) != 1: + if 'DEFAULT' in GlobalData.gSkuids: + GlobalData.gSkuids.remove('DEFAULT') if GlobalData.gSkuids: GlobalData.gSkuids.sort() @@ -2349,10 +2352,10 @@ def PackRegistryFormatGuid(Guid): def BuildOptionPcdValueFormat(TokenSpaceGuidCName, TokenCName, PcdDatumType, Value): if PcdDatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64,'BOOLEAN']: - if Value.startswith('L'): + if Value.startswith('L') or Value.startswith('"'): 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:] + '"' + Value = Value 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"{...}"')