BaseTools: Add check for INF statement must be a .inf file

Per FDF spec, INF statement must use a .inf file, we add this error
check.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Yonghong Zhu 2018-02-07 14:41:11 +08:00
parent ffcec664ca
commit a87e79d9d6
1 changed files with 3 additions and 1 deletions

View File

@ -1,7 +1,7 @@
## @file ## @file
# parse FDF file # parse FDF file
# #
# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR> # Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2015, Hewlett Packard Enterprise Development, L.P.<BR> # Copyright (c) 2015, Hewlett Packard Enterprise Development, L.P.<BR>
# #
# This program and the accompanying materials # This program and the accompanying materials
@ -2486,6 +2486,8 @@ class FdfParser:
if not self.__GetNextToken(): if not self.__GetNextToken():
raise Warning("expected INF file path", self.FileName, self.CurrentLineNumber) raise Warning("expected INF file path", self.FileName, self.CurrentLineNumber)
ffsInf.InfFileName = self.__Token ffsInf.InfFileName = self.__Token
if not ffsInf.InfFileName.endswith('.inf'):
raise Warning("expected .inf file path", self.FileName, self.CurrentLineNumber)
ffsInf.CurrentLineNum = self.CurrentLineNumber ffsInf.CurrentLineNum = self.CurrentLineNumber
ffsInf.CurrentLineContent = self.__CurrentLine() ffsInf.CurrentLineContent = self.__CurrentLine()