BaseTools/Source/Python/Workspace/DscBuildData.py | 7 ++++--- BaseTools/Source/Python/Workspace/MetaFileParser.py | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-)
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>
---
BaseTools/Source/Python/Workspace/DscBuildData.py | 7 ++++---
BaseTools/Source/Python/Workspace/MetaFileParser.py | 2 +-
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 4a87fd1..752fe05 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -580,17 +580,18 @@ class DscBuildData(PlatformBuildClassObject):
File=self.MetaFile, Line=Record[-1])
if Record[1] in [None, '']:
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:
self._SkuIds['COMMON'] = ("0","DEFAULT","DEFAULT")
return self._SkuIds
diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py
index b2b0e28..e236732 100644
--- a/BaseTools/Source/Python/Workspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py
@@ -1096,11 +1096,11 @@ class DscParser(MetaFileParser):
@ParseMacro
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 '<Integer>|<UiName>[|<UiName>]'",
+ EdkLogger.error('Parser', FORMAT_INVALID, "Correct format is '<Number>|<UiName>[|<UiName>]'",
ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
self._ValueList[0:len(TokenList)] = TokenList
@ParseMacro
def _DefaultStoresParser(self):
TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT)
--
2.6.1.windows.1
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Reviewed-by: Liming Gao <liming.gao@intel.com> > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Yonghong Zhu > Sent: Monday, January 22, 2018 1:40 PM > To: edk2-devel@lists.01.org > Subject: [edk2] [Patch] 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 <yonghong.zhu@intel.com> > --- > BaseTools/Source/Python/Workspace/DscBuildData.py | 7 ++++--- > BaseTools/Source/Python/Workspace/MetaFileParser.py | 2 +- > 2 files changed, 5 insertions(+), 4 deletions(-) > > diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py > index 4a87fd1..752fe05 100644 > --- a/BaseTools/Source/Python/Workspace/DscBuildData.py > +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py > @@ -580,17 +580,18 @@ class DscBuildData(PlatformBuildClassObject): > File=self.MetaFile, Line=Record[-1]) > if Record[1] in [None, '']: > 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: > self._SkuIds['COMMON'] = ("0","DEFAULT","DEFAULT") > return self._SkuIds > diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py > index b2b0e28..e236732 100644 > --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py > +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py > @@ -1096,11 +1096,11 @@ class DscParser(MetaFileParser): > > @ParseMacro > 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 '<Integer>|<UiName>[|<UiName>]'", > + EdkLogger.error('Parser', FORMAT_INVALID, "Correct format is '<Number>|<UiName>[|<UiName>]'", > ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) > self._ValueList[0:len(TokenList)] = TokenList > @ParseMacro > def _DefaultStoresParser(self): > TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT) > -- > 2.6.1.windows.1 > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
© 2016 - 2024 Red Hat, Inc.