BaseTools/Ecc: Fix a bug when checking copyright format

Fix a bug to only checking the copyright listed in config.ini file.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: YangX Li <yangx.li@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17801 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Hess Chen 2015-07-02 06:05:26 +00:00 committed by hchen30
parent fa3a21569b
commit d77cc2063d
2 changed files with 9 additions and 1 deletions

View File

@ -275,6 +275,9 @@ class Configuration(object):
# A list for only scanned folders # A list for only scanned folders
self.ScanOnlyDirList = [] self.ScanOnlyDirList = []
# A list for Copyright format
self.Copyright = []
self.ParseConfig() self.ParseConfig()
def ParseConfig(self): def ParseConfig(self):
@ -302,6 +305,8 @@ class Configuration(object):
List[1] = GetSplitValueList(List[1], TAB_COMMA_SPLIT) List[1] = GetSplitValueList(List[1], TAB_COMMA_SPLIT)
if List[0] == 'BinaryExtList': if List[0] == 'BinaryExtList':
List[1] = GetSplitValueList(List[1], TAB_COMMA_SPLIT) List[1] = GetSplitValueList(List[1], TAB_COMMA_SPLIT)
if List[0] == 'Copyright':
List[1] = GetSplitValueList(List[1], TAB_COMMA_SPLIT)
self.__dict__[List[0]] = List[1] self.__dict__[List[0]] = List[1]
def ShowMe(self): def ShowMe(self):

View File

@ -2364,7 +2364,10 @@ def CheckFileHeaderDoxygenComments(FullFileName):
if CommentLine.startswith('Copyright'): if CommentLine.startswith('Copyright'):
NoCopyrightFlag = False NoCopyrightFlag = False
if CommentLine.find('All rights reserved') == -1: if CommentLine.find('All rights reserved') == -1:
for Copyright in EccGlobalData.gConfig.Copyright:
if CommentLine.find(Copyright) > -1:
PrintErrorMsg(ERROR_HEADER_CHECK_FILE, '""All rights reserved"" announcement should be following the ""Copyright"" at the same line', FileTable, ID) PrintErrorMsg(ERROR_HEADER_CHECK_FILE, '""All rights reserved"" announcement should be following the ""Copyright"" at the same line', FileTable, ID)
break
if CommentLine.endswith('<BR>') == -1: if CommentLine.endswith('<BR>') == -1:
PrintErrorMsg(ERROR_HEADER_CHECK_FILE, 'The ""<BR>"" at the end of the Copyright line is required', FileTable, ID) PrintErrorMsg(ERROR_HEADER_CHECK_FILE, 'The ""<BR>"" at the end of the Copyright line is required', FileTable, ID)
if NextLineIndex < len(CommentStrList) and CommentStrList[NextLineIndex].strip().startswith('Copyright') == False and CommentStrList[NextLineIndex].strip(): if NextLineIndex < len(CommentStrList) and CommentStrList[NextLineIndex].strip().startswith('Copyright') == False and CommentStrList[NextLineIndex].strip():