public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Yonghong Zhu <yonghong.zhu@intel.com>
To: edk2-devel@lists.01.org
Cc: Liming Gao <liming.gao@intel.com>
Subject: [Patch] BaseTools: Fix a bug Build directory should relative to WORKSPACE
Date: Fri, 13 Oct 2017 16:31:52 +0800	[thread overview]
Message-ID: <1507883512-19936-1-git-send-email-yonghong.zhu@intel.com> (raw)

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



             reply	other threads:[~2017-10-13  8:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-13  8:31 Yonghong Zhu [this message]
2017-10-16  7:21 ` [Patch] BaseTools: Fix a bug Build directory should relative to WORKSPACE Gao, Liming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1507883512-19936-1-git-send-email-yonghong.zhu@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox