]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: update SKUID value to support both integer and Hex number
authorYonghong Zhu <yonghong.zhu@intel.com>
Mon, 22 Jan 2018 05:38:39 +0000 (13:38 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Tue, 23 Jan 2018 08:21:17 +0000 (16:21 +0800)
This patch updated Skuid value to support both integer and hex value.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
BaseTools/Source/Python/Workspace/DscBuildData.py
BaseTools/Source/Python/Workspace/MetaFileParser.py

index 4a87fd17629467fc0536ccf0a769943e053bafe3..60fabf656c260456f64b30101c966e086aad6183 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # This file is used to create a database used by build tool\r
 #\r
-# Copyright (c) 2008 - 2017, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>\r
 # (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
 # This program and the accompanying materials\r
 # are licensed and made available under the terms and conditions of the BSD License\r
@@ -582,13 +582,14 @@ class DscBuildData(PlatformBuildClassObject):
                     EdkLogger.error('build', FORMAT_INVALID, 'No Sku ID name',\r
                                     File=self.MetaFile, Line=Record[-1])\r
                 Pattern = re.compile('^[1-9]\d*|0$')\r
-                if Pattern.match(Record[0]) == None:\r
-                    EdkLogger.error('build', FORMAT_INVALID, "The format of the Sku ID number is invalid. The correct format is '{(0-9)} {(1-9)(0-9)+}'",\r
+                HexPattern = re.compile(r'0[xX][0-9a-fA-F]+$')\r
+                if Pattern.match(Record[0]) == None and HexPattern.match(Record[0]) == None:\r
+                    EdkLogger.error('build', FORMAT_INVALID, "The format of the Sku ID number is invalid. It only support Integer and HexNumber",\r
                                     File=self.MetaFile, Line=Record[-1])\r
                 if not IsValidWord(Record[1]):\r
                     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_-.)*'",\r
                                     File=self.MetaFile, Line=Record[-1])\r
-                self._SkuIds[Record[1].upper()] = (Record[0], Record[1].upper(), Record[2].upper())\r
+                self._SkuIds[Record[1].upper()] = (str(self.ToInt(Record[0])), Record[1].upper(), Record[2].upper())\r
             if 'DEFAULT' not in self._SkuIds:\r
                 self._SkuIds['DEFAULT'] = ("0","DEFAULT","DEFAULT")\r
             if 'COMMON' not in self._SkuIds:\r
index b2b0e282eb91098303837dcbe4e06e7b7dcd9267..5ea14f8f1069d4fc467e2fe27e2cef4b5ed69516 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # This file is used to parse meta files\r
 #\r
-# Copyright (c) 2008 - 2017, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>\r
 # (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>\r
 # This program and the accompanying materials\r
 # are licensed and made available under the terms and conditions of the BSD License\r
@@ -1098,7 +1098,7 @@ class DscParser(MetaFileParser):
     def _SkuIdParser(self):\r
         TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT)\r
         if len(TokenList) not in (2,3):\r
-            EdkLogger.error('Parser', FORMAT_INVALID, "Correct format is '<Integer>|<UiName>[|<UiName>]'",\r
+            EdkLogger.error('Parser', FORMAT_INVALID, "Correct format is '<Number>|<UiName>[|<UiName>]'",\r
                             ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)\r
         self._ValueList[0:len(TokenList)] = TokenList\r
     @ParseMacro\r