Skip to content

Commit

Permalink
BaseTools: Fixed the mis-using strip() function issue.
Browse files Browse the repository at this point in the history
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2003

lstrip(parameter) do the match based on the char
in parameter but not only the whole parameter string.

In GenMake line 1082,
CmdSign.lstrip('/Fo') will strip the '/' or
'F' or 'o' on the left of CmdSign. This is not expected.

This patch is going to fix such issue.

Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
  • Loading branch information
BobCF committed Jul 22, 2019
1 parent 5f89bcc commit bb824f6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion BaseTools/Source/Python/AutoGen/GenMake.py
Expand Up @@ -1079,7 +1079,7 @@ def ParserCCodeFile(self, T, Type, CmdSumDict, CmdTargetDict, CmdCppDict, Depend
CmdTargetDict[CmdSign] = "%s %s" % (CmdTargetDict[CmdSign], SingleCommandList[-1])
Index = CommandList.index(Item)
CommandList.pop(Index)
if SingleCommandList[-1].endswith("%s%s.c" % (TAB_SLASH, CmdSumDict[CmdSign.lstrip('/Fo').rsplit(TAB_SLASH, 1)[0]])):
if SingleCommandList[-1].endswith("%s%s.c" % (TAB_SLASH, CmdSumDict[CmdSign[3:].rsplit(TAB_SLASH, 1)[0]])):
Cpplist = CmdCppDict[T.Target.SubDir]
Cpplist.insert(0, '$(OBJLIST_%d): $(COMMON_DEPS)' % list(self.ObjTargetDict.keys()).index(T.Target.SubDir))
T.Commands[Index] = '%s\n\t%s' % (' \\\n\t'.join(Cpplist), CmdTargetDict[CmdSign])
Expand Down
5 changes: 4 additions & 1 deletion BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
Expand Up @@ -793,7 +793,10 @@ def MacroExtend (Str, MacroDict={}, Arch=DataType.TAB_COMMON):
def GetPcdValue (PcdPattern):
if PcdPattern is None:
return None
PcdPair = PcdPattern.lstrip('PCD(').rstrip(')').strip().split('.')
if PcdPattern.startswith('PCD('):
PcdPair = PcdPattern[4:].rstrip(')').strip().split('.')
else:
PcdPair = PcdPattern.strip().split('.')
TokenSpace = PcdPair[0]
TokenCName = PcdPair[1]

Expand Down

0 comments on commit bb824f6

Please sign in to comment.