diff options
author | Feng, YunhuaX </o=Intel/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=Feng, YunhuaX4e1> | 2018-02-05 11:42:33 +0800 |
---|---|---|
committer | Yonghong Zhu <yonghong.zhu@intel.com> | 2018-02-07 09:29:08 +0800 |
commit | 4344a788c472fccd9af559891363374868fb6275 (patch) | |
tree | 641f541bc2fc6c49f9e3c42ac70280499220ea82 /BaseTools/Source/Python | |
parent | 8ad5f10a2be2c2c8dde111c0478b02da44a781e2 (diff) | |
download | edk2-4344a788c472fccd9af559891363374868fb6275.tar.gz edk2-4344a788c472fccd9af559891363374868fb6275.tar.bz2 edk2-4344a788c472fccd9af559891363374868fb6275.zip |
BaseTools: Report error when GUID format is incorrect
Flexible GUID format of PCD value support following format, so tool should report
error when it is not correct.
1. { GUID("11E13869-1896-4A07-8B21-D8B23DD2A2B4") }
2. { GUID({ 0x11e13869, 0x1896, 0x4a07,{
0x8b, 0x21, 0xd8, 0xb2, 0x3d, 0xd2, 0xa2, 0xb4 } }) }
3. { GUID(gEfiBlockIoProtocolGuid) }
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Diffstat (limited to 'BaseTools/Source/Python')
-rw-r--r-- | BaseTools/Source/Python/Common/Misc.py | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py index 0365ac9531..b13e35cd75 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:
|