From: Yonghong Zhu Date: Mon, 22 Jan 2018 05:38:39 +0000 (+0800) Subject: BaseTools: update SKUID value to support both integer and Hex number X-Git-Tag: edk2-stable201903~2554 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=e6b10112b3ee661595f81aec7e1948bb4e8e0153 BaseTools: update SKUID value to support both integer and Hex number This patch updated Skuid value to support both integer and hex value. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu Reviewed-by: Liming Gao --- diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index 4a87fd1762..60fabf656c 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -1,7 +1,7 @@ ## @file # This file is used to create a database used by build tool # -# Copyright (c) 2008 - 2017, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.
# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -582,13 +582,14 @@ class DscBuildData(PlatformBuildClassObject): EdkLogger.error('build', FORMAT_INVALID, 'No Sku ID name', File=self.MetaFile, Line=Record[-1]) Pattern = re.compile('^[1-9]\d*|0$') - if Pattern.match(Record[0]) == None: - EdkLogger.error('build', FORMAT_INVALID, "The format of the Sku ID number is invalid. The correct format is '{(0-9)} {(1-9)(0-9)+}'", + HexPattern = re.compile(r'0[xX][0-9a-fA-F]+$') + if Pattern.match(Record[0]) == None and HexPattern.match(Record[0]) == None: + EdkLogger.error('build', FORMAT_INVALID, "The format of the Sku ID number is invalid. It only support Integer and HexNumber", File=self.MetaFile, Line=Record[-1]) if not IsValidWord(Record[1]): EdkLogger.error('build', FORMAT_INVALID, "The format of the Sku ID name is invalid. The correct format is '(a-zA-Z0-9_)(a-zA-Z0-9_-.)*'", File=self.MetaFile, Line=Record[-1]) - self._SkuIds[Record[1].upper()] = (Record[0], Record[1].upper(), Record[2].upper()) + self._SkuIds[Record[1].upper()] = (str(self.ToInt(Record[0])), Record[1].upper(), Record[2].upper()) if 'DEFAULT' not in self._SkuIds: self._SkuIds['DEFAULT'] = ("0","DEFAULT","DEFAULT") if 'COMMON' not in self._SkuIds: diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py index b2b0e282eb..5ea14f8f10 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py @@ -1,7 +1,7 @@ ## @file # This file is used to parse meta files # -# Copyright (c) 2008 - 2017, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.
# (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -1098,7 +1098,7 @@ class DscParser(MetaFileParser): def _SkuIdParser(self): TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT) if len(TokenList) not in (2,3): - EdkLogger.error('Parser', FORMAT_INVALID, "Correct format is '|[|]'", + EdkLogger.error('Parser', FORMAT_INVALID, "Correct format is '|[|]'", ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) self._ValueList[0:len(TokenList)] = TokenList @ParseMacro