public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] BaseTools: Fix a bug Build directory should relative to WORKSPACE
@ 2017-10-13  8:31 Yonghong Zhu
  2017-10-16  7:21 ` Gao, Liming
  0 siblings, 1 reply; 2+ messages in thread
From: Yonghong Zhu @ 2017-10-13  8:31 UTC (permalink / raw)
  To: edk2-devel; +Cc: Liming Gao

The bug is for build output files it still use mws.join function, it
cause maybe we will get the build output files in the PACKAGES_PATH
because mws.join will try WORKSPACE first, if the file doesn't exist
then try PACKAGES_PATH. But for build output, we expected it should
relative to WORKSPACE.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
---
 BaseTools/Source/Python/AutoGen/AutoGen.py   | 1 +
 BaseTools/Source/Python/Common/GlobalData.py | 1 +
 BaseTools/Source/Python/Common/String.py     | 2 +-
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py
index f2196fd..2fcd471 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -1796,10 +1796,11 @@ class PlatformAutoGen(AutoGen):
                 self._BuildDir = path.join(
                                             self.WorkspaceDir,
                                             self.OutputDir,
                                             self.BuildTarget + "_" + self.ToolChain,
                                             )
+            GlobalData.gBuildDirectory = self._BuildDir
         return self._BuildDir
 
     ## Return directory of platform makefile
     #
     #   @retval     string  Makefile directory
diff --git a/BaseTools/Source/Python/Common/GlobalData.py b/BaseTools/Source/Python/Common/GlobalData.py
index 45e7ea0..e348e9a 100644
--- a/BaseTools/Source/Python/Common/GlobalData.py
+++ b/BaseTools/Source/Python/Common/GlobalData.py
@@ -54,10 +54,11 @@ gAutoGenPhase = False
 #
 # The Conf dir outside the workspace dir
 #
 gConfDirectory = ''
 
+gBuildDirectory = ''
 #
 # The relative default database file path
 #
 gDatabasePath = ".cache/build.db"
 
diff --git a/BaseTools/Source/Python/Common/String.py b/BaseTools/Source/Python/Common/String.py
index 81c053d..4a8c03e 100644
--- a/BaseTools/Source/Python/Common/String.py
+++ b/BaseTools/Source/Python/Common/String.py
@@ -309,11 +309,11 @@ def NormPath(Path, Defines={}):
             Path = ReplaceMacro(Path, Defines)
         #
         # To local path format
         #
         Path = os.path.normpath(Path)
-        if Path.startswith(GlobalData.gWorkspace) and not os.path.exists(Path):
+        if Path.startswith(GlobalData.gWorkspace) and not Path.startswith(GlobalData.gBuildDirectory) and not os.path.exists(Path):
             Path = Path[len (GlobalData.gWorkspace):]
             if Path[0] == os.path.sep:
                 Path = Path[1:]
             Path = mws.join(GlobalData.gWorkspace, Path)
 
-- 
2.6.1.windows.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Patch] BaseTools: Fix a bug Build directory should relative to WORKSPACE
  2017-10-13  8:31 [Patch] BaseTools: Fix a bug Build directory should relative to WORKSPACE Yonghong Zhu
@ 2017-10-16  7:21 ` Gao, Liming
  0 siblings, 0 replies; 2+ messages in thread
From: Gao, Liming @ 2017-10-16  7:21 UTC (permalink / raw)
  To: Zhu, Yonghong, edk2-devel@lists.01.org

Reviewed-by: Liming Gao <liming.gao@intel.com>

>-----Original Message-----
>From: Zhu, Yonghong
>Sent: Friday, October 13, 2017 4:32 PM
>To: edk2-devel@lists.01.org
>Cc: Gao, Liming <liming.gao@intel.com>
>Subject: [Patch] BaseTools: Fix a bug Build directory should relative to
>WORKSPACE
>
>The bug is for build output files it still use mws.join function, it
>cause maybe we will get the build output files in the PACKAGES_PATH
>because mws.join will try WORKSPACE first, if the file doesn't exist
>then try PACKAGES_PATH. But for build output, we expected it should
>relative to WORKSPACE.
>
>Cc: Liming Gao <liming.gao@intel.com>
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
>---
> BaseTools/Source/Python/AutoGen/AutoGen.py   | 1 +
> BaseTools/Source/Python/Common/GlobalData.py | 1 +
> BaseTools/Source/Python/Common/String.py     | 2 +-
> 3 files changed, 3 insertions(+), 1 deletion(-)
>
>diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py
>b/BaseTools/Source/Python/AutoGen/AutoGen.py
>index f2196fd..2fcd471 100644
>--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
>+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
>@@ -1796,10 +1796,11 @@ class PlatformAutoGen(AutoGen):
>                 self._BuildDir = path.join(
>                                             self.WorkspaceDir,
>                                             self.OutputDir,
>                                             self.BuildTarget + "_" + self.ToolChain,
>                                             )
>+            GlobalData.gBuildDirectory = self._BuildDir
>         return self._BuildDir
>
>     ## Return directory of platform makefile
>     #
>     #   @retval     string  Makefile directory
>diff --git a/BaseTools/Source/Python/Common/GlobalData.py
>b/BaseTools/Source/Python/Common/GlobalData.py
>index 45e7ea0..e348e9a 100644
>--- a/BaseTools/Source/Python/Common/GlobalData.py
>+++ b/BaseTools/Source/Python/Common/GlobalData.py
>@@ -54,10 +54,11 @@ gAutoGenPhase = False
> #
> # The Conf dir outside the workspace dir
> #
> gConfDirectory = ''
>
>+gBuildDirectory = ''
> #
> # The relative default database file path
> #
> gDatabasePath = ".cache/build.db"
>
>diff --git a/BaseTools/Source/Python/Common/String.py
>b/BaseTools/Source/Python/Common/String.py
>index 81c053d..4a8c03e 100644
>--- a/BaseTools/Source/Python/Common/String.py
>+++ b/BaseTools/Source/Python/Common/String.py
>@@ -309,11 +309,11 @@ def NormPath(Path, Defines={}):
>             Path = ReplaceMacro(Path, Defines)
>         #
>         # To local path format
>         #
>         Path = os.path.normpath(Path)
>-        if Path.startswith(GlobalData.gWorkspace) and not os.path.exists(Path):
>+        if Path.startswith(GlobalData.gWorkspace) and not
>Path.startswith(GlobalData.gBuildDirectory) and not os.path.exists(Path):
>             Path = Path[len (GlobalData.gWorkspace):]
>             if Path[0] == os.path.sep:
>                 Path = Path[1:]
>             Path = mws.join(GlobalData.gWorkspace, Path)
>
>--
>2.6.1.windows.1



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-10-16  7:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-13  8:31 [Patch] BaseTools: Fix a bug Build directory should relative to WORKSPACE Yonghong Zhu
2017-10-16  7:21 ` Gao, Liming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox