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(-)
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
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
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
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
© 2016 - 2025 Red Hat, Inc.