]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Workspace/DscBuildData.py
BaseTools: update SKUID value to support both integer and Hex number
[mirror_edk2.git] / BaseTools / Source / Python / Workspace / DscBuildData.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