]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Fixed the mis-using strip() function issue.
authorFeng, Bob C <bob.c.feng@intel.com>
Sun, 21 Jul 2019 03:31:11 +0000 (11:31 +0800)
committerFeng, Bob C <bob.c.feng@intel.com>
Mon, 22 Jul 2019 04:06:03 +0000 (12:06 +0800)
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>
BaseTools/Source/Python/AutoGen/GenMake.py
BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py

index 212ca0fa7f9f16da1eeb8ecfd7aebb35537c9a33..10e67f7dbb16cc650247b5753b0b03358012c0fd 100644 (file)
@@ -1079,7 +1079,7 @@ cleanlib:
                         CmdTargetDict[CmdSign] = "%s %s" % (CmdTargetDict[CmdSign], SingleCommandList[-1])\r
                     Index = CommandList.index(Item)\r
                     CommandList.pop(Index)\r
-                    if SingleCommandList[-1].endswith("%s%s.c" % (TAB_SLASH, CmdSumDict[CmdSign.lstrip('/Fo').rsplit(TAB_SLASH, 1)[0]])):\r
+                    if SingleCommandList[-1].endswith("%s%s.c" % (TAB_SLASH, CmdSumDict[CmdSign[3:].rsplit(TAB_SLASH, 1)[0]])):\r
                         Cpplist = CmdCppDict[T.Target.SubDir]\r
                         Cpplist.insert(0, '$(OBJLIST_%d): $(COMMON_DEPS)' % list(self.ObjTargetDict.keys()).index(T.Target.SubDir))\r
                         T.Commands[Index] = '%s\n\t%s' % (' \\\n\t'.join(Cpplist), CmdTargetDict[CmdSign])\r
index c9c476cf615486f80cbbd0d2ccabe34999db00d4..f43743dff4d1cbac7bebda1b91fd171833d993db 100644 (file)
@@ -793,7 +793,10 @@ class GenFdsGlobalVariable:
     def GetPcdValue (PcdPattern):\r
         if PcdPattern is None:\r
             return None\r
-        PcdPair = PcdPattern.lstrip('PCD(').rstrip(')').strip().split('.')\r
+        if PcdPattern.startswith('PCD('):\r
+            PcdPair = PcdPattern[4:].rstrip(')').strip().split('.')\r
+        else:\r
+            PcdPair = PcdPattern.strip().split('.')\r
         TokenSpace = PcdPair[0]\r
         TokenCName = PcdPair[1]\r
 \r