summaryrefslogtreecommitdiff
path: root/BaseTools/Source/Python/build
diff options
context:
space:
mode:
authorMike Maslenkin <mike.maslenkin@gmail.com>2015-12-03 03:27:13 +0000
committervanjeff <vanjeff@Edk2>2015-12-03 03:27:13 +0000
commit183f7faabc138a8d47c6dd387ed2ad175e9f96fe (patch)
treeedf9b9f3b9a6392fe7b7763072065c0724a7a378 /BaseTools/Source/Python/build
parent37c2cf4fb85f7c79a15fc860dc5366f562d5f305 (diff)
downloadedk2-platforms-183f7faabc138a8d47c6dd387ed2ad175e9f96fe.tar.xz
BaseTools: sync BaseTools from main trunk r18579.
This patch fixes incomplete merge of multiple workspaces support. Without this patch build fails with error similar to: ~/sources/edk2> build -p MdePkg/MdePkg.dsc -t GCC48 -a X64 Build environment: Linux-3.16.7-24-desktop-x86_64-with-SuSE-13.2-x86_64 Build start time: 17:15:43, Dec.02 2015 WORKSPACE = /home/user/sources/edk2 ECP_SOURCE = /home/user/sources/edk2/EdkCompatibilityPkg EDK_SOURCE = /home/user/sources/edk2/EdkCompatibilityPkg EFI_SOURCE = /home/user/sources/edk2/EdkCompatibilityPkg EDK_TOOLS_PATH = /home/user/sources/edk2/BaseTools build.py... : error C0DE: Unknown fatal error when processing [/home/user/sources/edk2/MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf] (Please send email to edk2-devel@lists.sourceforge.net for help, attaching following call stack trace!) (Python 2.7.8 on linux2) Traceback (most recent call last): File "/home/user/sources/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 2033, in Main MyBuild.Launch() File "/home/user/sources/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 1788, in Launch self._MultiThreadBuildPlatform() File "/home/user/sources/edk2/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 1583, in _MultiThreadBuildPlatform self.Progress File "/home/user/sources/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py", line 175, in __new__ if not AutoGenObject._Init(Workspace, MetaFile, Target, Toolchain, Arch, *args, **kwargs): File "/home/user/sources/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py", line 355, in _Init Pkgs = list(PkgSet) + list(PGen.PackageList) File "/home/user/sources/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py", line 1484, in _GetPackageList for La in self.LibraryAutoGenList: File "/home/user/sources/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py", line 1594, in _GetLibraryAutoGenList self._GetAutoGenObjectList() File "/home/user/sources/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py", line 1575, in _GetAutoGenObjectList self.MetaFile File "/home/user/sources/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py", line 175, in __new__ if not AutoGenObject._Init(Workspace, MetaFile, Target, Toolchain, Arch, *args, **kwargs): File "/home/user/sources/edk2/BaseTools/Source/Python/AutoGen/AutoGen.py", line 2199, in _Init self.SourceDir = mws.relpath(self.SourceDir, self.WorkspaceDir) File "/home/user/sources/edk2/BaseTools/Source/Python/Common/MultipleWorkspace.py", line 94, in relpath for Pkg in cls.PACKAGES_PATH: TypeError: 'NoneType' object is not iterable - Failed - Build end time: 17:15:44, Dec.02 2015 Build total time: 00:00:01 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com> Cc: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Jeff Fan <jeff.fan@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/branches/UDK2015@19102 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/Python/build')
-rw-r--r--BaseTools/Source/Python/build/BuildReport.py16
-rw-r--r--BaseTools/Source/Python/build/build.py46
2 files changed, 39 insertions, 23 deletions
diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py
index d64c55d08b..38e55f3e07 100644
--- a/BaseTools/Source/Python/build/BuildReport.py
+++ b/BaseTools/Source/Python/build/BuildReport.py
@@ -41,6 +41,7 @@ from Common.DataType import TAB_BRG_PCD
from Common.DataType import TAB_BRG_LIBRARY
from Common.DataType import TAB_BACK_SLASH
from Common.LongFilePathSupport import OpenLongFilePath as open
+from Common.MultipleWorkspace import MultipleWorkspace as mws
## Pattern to extract contents in EDK DXS files
gDxsDependencyPattern = re.compile(r"DEPENDENCY_START(.+)DEPENDENCY_END", re.DOTALL)
@@ -1235,12 +1236,13 @@ class FdRegionReport(object):
DecDefaultValue = Package.Pcds[TokenCName, TokenSpaceGuidCName, DecType].DefaultValue
PlatformPcds[(TokenCName, TokenSpaceGuidCName)] = DecDefaultValue
#
- # Collect PCDs defined in DSC common section
+ # Collect PCDs defined in DSC file
#
- Platform = Wa.BuildDatabase[Wa.MetaFile, 'COMMON']
- for (TokenCName, TokenSpaceGuidCName) in Platform.Pcds:
- DscDefaultValue = Platform.Pcds[(TokenCName, TokenSpaceGuidCName)].DefaultValue
- PlatformPcds[(TokenCName, TokenSpaceGuidCName)] = DscDefaultValue
+ for arch in Wa.ArchList:
+ Platform = Wa.BuildDatabase[Wa.MetaFile, arch]
+ for (TokenCName, TokenSpaceGuidCName) in Platform.Pcds:
+ DscDefaultValue = Platform.Pcds[(TokenCName, TokenSpaceGuidCName)].DefaultValue
+ PlatformPcds[(TokenCName, TokenSpaceGuidCName)] = DscDefaultValue
#
# Add PEI and DXE a priori files GUIDs defined in PI specification.
@@ -1255,7 +1257,7 @@ class FdRegionReport(object):
for Pa in Wa.AutoGenObjectList:
for ModuleKey in Pa.Platform.Modules:
M = Pa.Platform.Modules[ModuleKey].M
- InfPath = os.path.join(Wa.WorkspaceDir, M.MetaFile.File)
+ InfPath = mws.join(Wa.WorkspaceDir, M.MetaFile.File)
self._GuidsDb[M.Guid.upper()] = "%s (%s)" % (M.Module.BaseName, InfPath)
#
@@ -1277,7 +1279,7 @@ class FdRegionReport(object):
Guid = GuidStructureByteArrayToGuidString(GuidValue).upper()
for Section in Ffs.SectionList:
try:
- ModuleSectFile = os.path.join(Wa.WorkspaceDir, Section.SectFileName)
+ ModuleSectFile = mws.join(Wa.WorkspaceDir, Section.SectFileName)
self._GuidsDb[Guid] = ModuleSectFile
except AttributeError:
pass
diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py
index 33b45ba267..6d83ac9701 100644
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -41,6 +41,7 @@ from Common.BuildVersion import gBUILD_VERSION
from AutoGen.AutoGen import *
from Common.BuildToolError import *
from Workspace.WorkspaceDatabase import *
+from Common.MultipleWorkspace import MultipleWorkspace as mws
from BuildReport import BuildReport
from GenPatchPcdTable.GenPatchPcdTable import *
@@ -104,12 +105,16 @@ def CheckEnvVariable():
EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "No space is allowed in WORKSPACE path",
ExtraData=WorkspaceDir)
os.environ["WORKSPACE"] = WorkspaceDir
+
+ # set multiple workspace
+ PackagesPath = os.getenv("PACKAGES_PATH")
+ mws.setWs(WorkspaceDir, PackagesPath)
#
# Check EFI_SOURCE (Edk build convention). EDK_SOURCE will always point to ECP
#
if "ECP_SOURCE" not in os.environ:
- os.environ["ECP_SOURCE"] = os.path.join(WorkspaceDir, GlobalData.gEdkCompatibilityPkg)
+ os.environ["ECP_SOURCE"] = mws.join(WorkspaceDir, GlobalData.gEdkCompatibilityPkg)
if "EFI_SOURCE" not in os.environ:
os.environ["EFI_SOURCE"] = os.environ["ECP_SOURCE"]
if "EDK_SOURCE" not in os.environ:
@@ -151,16 +156,18 @@ def CheckEnvVariable():
EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "No space is allowed in EFI_SOURCE path",
ExtraData=EfiSourceDir)
- # change absolute path to relative path to WORKSPACE
- if EfiSourceDir.upper().find(WorkspaceDir.upper()) != 0:
- EdkLogger.error("build", PARAMETER_INVALID, "EFI_SOURCE is not under WORKSPACE",
- ExtraData="WORKSPACE = %s\n EFI_SOURCE = %s" % (WorkspaceDir, EfiSourceDir))
- if EdkSourceDir.upper().find(WorkspaceDir.upper()) != 0:
- EdkLogger.error("build", PARAMETER_INVALID, "EDK_SOURCE is not under WORKSPACE",
- ExtraData="WORKSPACE = %s\n EDK_SOURCE = %s" % (WorkspaceDir, EdkSourceDir))
- if EcpSourceDir.upper().find(WorkspaceDir.upper()) != 0:
- EdkLogger.error("build", PARAMETER_INVALID, "ECP_SOURCE is not under WORKSPACE",
- ExtraData="WORKSPACE = %s\n ECP_SOURCE = %s" % (WorkspaceDir, EcpSourceDir))
+ # check those variables on single workspace case
+ if not PackagesPath:
+ # change absolute path to relative path to WORKSPACE
+ if EfiSourceDir.upper().find(WorkspaceDir.upper()) != 0:
+ EdkLogger.error("build", PARAMETER_INVALID, "EFI_SOURCE is not under WORKSPACE",
+ ExtraData="WORKSPACE = %s\n EFI_SOURCE = %s" % (WorkspaceDir, EfiSourceDir))
+ if EdkSourceDir.upper().find(WorkspaceDir.upper()) != 0:
+ EdkLogger.error("build", PARAMETER_INVALID, "EDK_SOURCE is not under WORKSPACE",
+ ExtraData="WORKSPACE = %s\n EDK_SOURCE = %s" % (WorkspaceDir, EdkSourceDir))
+ if EcpSourceDir.upper().find(WorkspaceDir.upper()) != 0:
+ EdkLogger.error("build", PARAMETER_INVALID, "ECP_SOURCE is not under WORKSPACE",
+ ExtraData="WORKSPACE = %s\n ECP_SOURCE = %s" % (WorkspaceDir, EcpSourceDir))
# check EDK_TOOLS_PATH
if "EDK_TOOLS_PATH" not in os.environ:
@@ -182,7 +189,7 @@ def CheckEnvVariable():
GlobalData.gGlobalDefines["EDK_SOURCE"] = EdkSourceDir
GlobalData.gGlobalDefines["ECP_SOURCE"] = EcpSourceDir
GlobalData.gGlobalDefines["EDK_TOOLS_PATH"] = os.environ["EDK_TOOLS_PATH"]
-
+
## Get normalized file path
#
# Convert the path to be local format, and remove the WORKSPACE path at the
@@ -198,7 +205,8 @@ def NormFile(FilePath, Workspace):
if os.path.isabs(FilePath):
FileFullPath = os.path.normpath(FilePath)
else:
- FileFullPath = os.path.normpath(os.path.join(Workspace, FilePath))
+ FileFullPath = os.path.normpath(mws.join(Workspace, FilePath))
+ Workspace = mws.getWs(Workspace, FilePath)
# check if the file path exists or not
if not os.path.isfile(FileFullPath):
@@ -748,10 +756,10 @@ class Build():
if not os.path.isabs(ConfDirectoryPath):
# Since alternate directory name is not absolute, the alternate directory is located within the WORKSPACE
# This also handles someone specifying the Conf directory in the workspace. Using --conf=Conf
- ConfDirectoryPath = os.path.join(self.WorkspaceDir, ConfDirectoryPath)
+ ConfDirectoryPath = mws.join(self.WorkspaceDir, ConfDirectoryPath)
else:
# Get standard WORKSPACE/Conf use the absolute path to the WORKSPACE/Conf
- ConfDirectoryPath = os.path.join(self.WorkspaceDir, 'Conf')
+ ConfDirectoryPath = mws.join(self.WorkspaceDir, 'Conf')
GlobalData.gConfDirectory = ConfDirectoryPath
GlobalData.gDatabasePath = os.path.normpath(os.path.join(ConfDirectoryPath, GlobalData.gDatabasePath))
@@ -772,10 +780,16 @@ class Build():
# print current build environment and configuration
EdkLogger.quiet("%-16s = %s" % ("WORKSPACE", os.environ["WORKSPACE"]))
+ if "PACKAGES_PATH" in os.environ:
+ # WORKSPACE env has been converted before. Print the same path style with WORKSPACE env.
+ EdkLogger.quiet("%-16s = %s" % ("PACKAGES_PATH", os.path.normcase(os.path.normpath(os.environ["PACKAGES_PATH"]))))
EdkLogger.quiet("%-16s = %s" % ("ECP_SOURCE", os.environ["ECP_SOURCE"]))
EdkLogger.quiet("%-16s = %s" % ("EDK_SOURCE", os.environ["EDK_SOURCE"]))
EdkLogger.quiet("%-16s = %s" % ("EFI_SOURCE", os.environ["EFI_SOURCE"]))
EdkLogger.quiet("%-16s = %s" % ("EDK_TOOLS_PATH", os.environ["EDK_TOOLS_PATH"]))
+ if "EDK_TOOLS_BIN" in os.environ:
+ # Print the same path style with WORKSPACE env.
+ EdkLogger.quiet("%-16s = %s" % ("EDK_TOOLS_BIN", os.path.normcase(os.path.normpath(os.environ["EDK_TOOLS_BIN"]))))
EdkLogger.info("")
@@ -796,7 +810,7 @@ class Build():
ToolDefinitionFile = self.TargetTxt.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_TOOL_CHAIN_CONF]
if ToolDefinitionFile == '':
ToolDefinitionFile = gToolsDefinition
- ToolDefinitionFile = os.path.normpath(os.path.join(self.WorkspaceDir, 'Conf', ToolDefinitionFile))
+ ToolDefinitionFile = os.path.normpath(mws.join(self.WorkspaceDir, 'Conf', ToolDefinitionFile))
if os.path.isfile(ToolDefinitionFile) == True:
StatusCode = self.ToolDef.LoadToolDefFile(ToolDefinitionFile)
else: