From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.65; helo=mga03.intel.com; envelope-from=yonghong.zhu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 26A9121F38842 for ; Fri, 13 Oct 2017 01:28:25 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Oct 2017 01:31:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,370,1503385200"; d="scan'208";a="1181545914" Received: from shwdeopenpsi168.ccr.corp.intel.com ([10.239.158.121]) by orsmga001.jf.intel.com with ESMTP; 13 Oct 2017 01:31:55 -0700 From: Yonghong Zhu To: edk2-devel@lists.01.org Cc: Liming Gao Date: Fri, 13 Oct 2017 16:31:52 +0800 Message-Id: <1507883512-19936-1-git-send-email-yonghong.zhu@intel.com> X-Mailer: git-send-email 2.6.1.windows.1 Subject: [Patch] BaseTools: Fix a bug Build directory should relative to WORKSPACE X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Oct 2017 08:28:25 -0000 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 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- 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