summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BaseTools/Source/Python/UPT/Logger/StringTable.py2
-rw-r--r--BaseTools/Source/Python/UPT/Object/Parser/InfDefineObject.py17
-rw-r--r--BaseTools/Source/Python/UPT/Parser/DecParser.py4
3 files changed, 15 insertions, 8 deletions
diff --git a/BaseTools/Source/Python/UPT/Logger/StringTable.py b/BaseTools/Source/Python/UPT/Logger/StringTable.py
index f15ac7f0bc..a481c6785d 100644
--- a/BaseTools/Source/Python/UPT/Logger/StringTable.py
+++ b/BaseTools/Source/Python/UPT/Logger/StringTable.py
@@ -656,7 +656,7 @@ _("Wrong define section format, must be KEY = Value.")
ERR_DECPARSE_DEFINE_UNKNOWKEY = \
_("Unknown key [%s] in define section.")
ERR_DECPARSE_DEFINE_SPEC = \
-_("Specification value must be HEX numbers.")
+_("Specification value must be HEX numbers or decimal numbers.")
ERR_DECPARSE_DEFINE_PKGNAME = \
_("Package name must be AlphaNumeric characters.")
ERR_DECPARSE_DEFINE_PKGGUID = \
diff --git a/BaseTools/Source/Python/UPT/Object/Parser/InfDefineObject.py b/BaseTools/Source/Python/UPT/Object/Parser/InfDefineObject.py
index be9a0e196e..1d074ee638 100644
--- a/BaseTools/Source/Python/UPT/Object/Parser/InfDefineObject.py
+++ b/BaseTools/Source/Python/UPT/Object/Parser/InfDefineObject.py
@@ -340,16 +340,21 @@ class InfDefSection(InfDefSectionOptionRomInfo):
ErrorInInf(ST.ERR_INF_PARSER_NOT_SUPPORT_EDKI_INF,
ErrorCode=ToolError.EDK1_INF_ERROR,
LineInfo=self.CurrentLine)
-
- self.InfVersion = InfDefMember()
- self.InfVersion.SetValue(InfVersion)
- self.InfVersion.Comments = Comments
- return True
+ elif IsValidDecVersionVal(InfVersion):
+ if (InfVersion < 65541):
+ ErrorInInf(ST.ERR_INF_PARSER_NOT_SUPPORT_EDKI_INF,
+ ErrorCode=ToolError.EDK1_INF_ERROR,
+ LineInfo=self.CurrentLine)
else:
ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(InfVersion),
LineInfo=self.CurrentLine)
return False
+ self.InfVersion = InfDefMember()
+ self.InfVersion.SetValue(InfVersion)
+ self.InfVersion.Comments = Comments
+ return True
+
## GetInfVersion
#
def GetInfVersion(self):
@@ -1000,4 +1005,4 @@ class InfDefObject(InfSectionCommonDef):
def GetDefines(self):
return self.Defines
- \ No newline at end of file
+
diff --git a/BaseTools/Source/Python/UPT/Parser/DecParser.py b/BaseTools/Source/Python/UPT/Parser/DecParser.py
index 25407f9a2d..23d1ed4dbb 100644
--- a/BaseTools/Source/Python/UPT/Parser/DecParser.py
+++ b/BaseTools/Source/Python/UPT/Parser/DecParser.py
@@ -29,6 +29,7 @@ from Library.ParserValidate import IsValidIdString
from Library.ParserValidate import IsValidUserId
from Library.ParserValidate import IsValidArch
from Library.ParserValidate import IsValidWord
+from Library.ParserValidate import IsValidDecVersionVal
from Parser.DecParserMisc import TOOL_NAME
from Parser.DecParserMisc import CleanString
from Parser.DecParserMisc import IsValidPcdDatum
@@ -452,7 +453,8 @@ class _DecDefine(_DecBase):
if self.ItemObject.GetPackageSpecification():
self._LoggerError(ST.ERR_DECPARSE_DEFINE_DEFINED % DT.TAB_DEC_DEFINES_DEC_SPECIFICATION)
if not IsValidToken('0[xX][0-9a-fA-F]{8}', Token):
- self._LoggerError(ST.ERR_DECPARSE_DEFINE_SPEC)
+ if not IsValidDecVersionVal(Token):
+ self._LoggerError(ST.ERR_DECPARSE_DEFINE_SPEC)
self.ItemObject.SetPackageSpecification(Token)
def _SetPackageName(self, Token):