]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: fix the bug for [BuildOptions] of multiple workspace support
authorYonghong Zhu <yonghong.zhu@intel.com>
Wed, 13 Apr 2016 08:27:05 +0000 (16:27 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Thu, 14 Apr 2016 04:58:11 +0000 (12:58 +0800)
when enable Multiple workspace and there have other option(eg: -I) before
$(WORKSPACE), handleWsMacro cannot return correct which cause the
ArmVirtPkg build failure.
example:
[BuildOptions]
  *_*_AARCH64_PLATFORM_FLAGS == -I$(WORKSPACE)/ArmVirtPkg/Include

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
BaseTools/Source/Python/Common/MultipleWorkspace.py

index feb1f8d5ebe6e67706045c31b5c459d6936b1008..4e4c37ae131793783ac7d2cdb304c7f575b3638e 100644 (file)
@@ -4,7 +4,7 @@
 # This file is required to make Python interpreter treat the directory\r
 # as containing package.\r
 #\r
-# Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>\r
 # This program and the accompanying materials\r
 # are licensed and made available under the terms and conditions of the BSD License\r
 # which accompanies this distribution.  The full text of the license may be found at\r
@@ -128,12 +128,17 @@ class MultipleWorkspace(object):
     @classmethod\r
     def handleWsMacro(cls, PathStr):\r
         if TAB_WORKSPACE in PathStr:\r
-            Path = PathStr.replace(TAB_WORKSPACE, cls.WORKSPACE).strip()\r
-            if not os.path.exists(Path):\r
-                for Pkg in cls.PACKAGES_PATH:\r
-                    Path = PathStr.replace(TAB_WORKSPACE, Pkg).strip()\r
-                    if os.path.exists(Path):\r
-                        return Path\r
+            PathList = PathStr.split()\r
+            if PathList:\r
+                for i, str in enumerate(PathList):\r
+                    if str.find(TAB_WORKSPACE) != -1:\r
+                        MacroStartPos = str.find(TAB_WORKSPACE)\r
+                        MacroEndPos = str.find(')', MacroStartPos)\r
+                        Substr = str[MacroEndPos+1:]\r
+                        if Substr.startswith('/') or Substr.startswith('\\'):\r
+                            Substr = Substr[1:]\r
+                        PathList[i] = str[0:MacroStartPos] + os.path.normpath(cls.join(cls.WORKSPACE, Substr))\r
+            PathStr = ' '.join(PathList)\r
         return PathStr\r
     \r
     ## getPkgPath()\r