From af7fca3649779f0e55220a7acda9bd11bc660fc3 Mon Sep 17 00:00:00 2001 From: Jeff Fan Date: Mon, 16 Nov 2015 05:29:49 +0000 Subject: Update BaseTools from main trunk r18767. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan git-svn-id: https://svn.code.sf.net/p/edk2/code/branches/UDK2015@18784 6f19259b-4bc3-4df7-8a09-765794883524 --- BaseTools/Source/Python/AutoGen/AutoGen.py | 16 ++++++----- BaseTools/Source/Python/AutoGen/GenC.py | 27 ++++++++---------- BaseTools/Source/Python/AutoGen/GenMake.py | 4 +-- BaseTools/Source/Python/Common/EdkIIWorkspace.py | 3 +- BaseTools/Source/Python/Common/FdfParserLite.py | 6 ++-- .../Source/Python/Common/LongFilePathOsPath.py | 2 ++ BaseTools/Source/Python/Common/Misc.py | 7 ++++- BaseTools/Source/Python/Common/String.py | 8 +++++- BaseTools/Source/Python/Ecc/Check.py | 18 ++++++------ BaseTools/Source/Python/Ecc/Ecc.py | 8 +++++- BaseTools/Source/Python/Ecc/MetaDataParser.py | 5 ++-- BaseTools/Source/Python/Ecc/c.py | 16 +++++++---- BaseTools/Source/Python/GenFds/FfsInfStatement.py | 7 +++-- BaseTools/Source/Python/GenFds/GenFds.py | 13 ++++++--- .../Source/Python/GenFds/GenFdsGlobalVariable.py | 4 ++- BaseTools/Source/Python/GenFds/Region.py | 3 +- BaseTools/Source/Python/Makefile | 1 + .../Python/UPT/Core/DistributionPackageClass.py | 26 +++++++++++------- BaseTools/Source/Python/UPT/Core/PackageFile.py | 8 ++++-- BaseTools/Source/Python/UPT/Library/GlobalData.py | 3 +- BaseTools/Source/Python/UPT/Library/Misc.py | 7 ++++- .../Source/Python/UPT/Library/ParserValidate.py | 3 +- BaseTools/Source/Python/UPT/Library/Parsing.py | 32 ++++++++++++---------- BaseTools/Source/Python/UPT/MkPkg.py | 7 +++-- .../Python/UPT/PomAdapter/InfPomAlignment.py | 5 ++-- BaseTools/Source/Python/UPT/UPT.py | 3 +- .../Source/Python/Workspace/MetaFileParser.py | 11 ++++++-- .../Source/Python/Workspace/WorkspaceDatabase.py | 31 +++++++++++++++++---- 28 files changed, 183 insertions(+), 101 deletions(-) (limited to 'BaseTools/Source/Python') diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index 259abc519b..fe56574357 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -40,7 +40,7 @@ from GenPatchPcdTable.GenPatchPcdTable import parsePcdInfoFromMapFile import Common.VpdInfoFile as VpdInfoFile from GenPcdDb import CreatePcdDatabaseCode from Workspace.MetaFileCommentParser import UsageList - +from Common.MultipleWorkspace import MultipleWorkspace as mws import InfSectionParser ## Regular expression for splitting Dependency Expression string into tokens @@ -953,7 +953,7 @@ class PlatformAutoGen(AutoGen): self._GuidValue = {} FdfModuleList = [] for InfName in self._AsBuildInfList: - InfName = os.path.join(self.WorkspaceDir, InfName) + InfName = mws.join(self.WorkspaceDir, InfName) FdfModuleList.append(os.path.normpath(InfName)) for F in self.Platform.Modules.keys(): M = ModuleAutoGen(self.Workspace, F, self.BuildTarget, self.ToolChain, self.Arch, self.MetaFile) @@ -1288,7 +1288,7 @@ class PlatformAutoGen(AutoGen): def _GetFdfFile(self): if self._FdfFile == None: if self.Workspace.FdfFile != "": - self._FdfFile= path.join(self.WorkspaceDir, self.Workspace.FdfFile) + self._FdfFile= mws.join(self.WorkspaceDir, self.Workspace.FdfFile) else: self._FdfFile = '' return self._FdfFile @@ -2115,8 +2115,11 @@ class PlatformAutoGen(AutoGen): BuildOptions[Tool][Attr] = "" # check if override is indicated if Value.startswith('='): - BuildOptions[Tool][Attr] = Value[1:] + ToolPath = Value[1:] + ToolPath = mws.handleWsMacro(ToolPath) + BuildOptions[Tool][Attr] = ToolPath else: + Value = mws.handleWsMacro(Value) BuildOptions[Tool][Attr] += " " + Value if Module.AutoGenVersion < 0x00010005 and self.Workspace.UniFlag != None: # @@ -2193,8 +2196,7 @@ class ModuleAutoGen(AutoGen): return False self.SourceDir = self.MetaFile.SubDir - if self.SourceDir.upper().find(self.WorkspaceDir.upper()) == 0: - self.SourceDir = self.SourceDir[len(self.WorkspaceDir) + 1:] + self.SourceDir = mws.relpath(self.SourceDir, self.WorkspaceDir) self.SourceOverrideDir = None # use overrided path defined in DSC file @@ -3042,7 +3044,7 @@ class ModuleAutoGen(AutoGen): self._IncludePathList.append(self.DebugDir) for Package in self.Module.Packages: - PackageDir = path.join(self.WorkspaceDir, Package.MetaFile.Dir) + PackageDir = mws.join(self.WorkspaceDir, Package.MetaFile.Dir) if PackageDir not in self._IncludePathList: self._IncludePathList.append(PackageDir) for Inc in Package.Includes: diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Python/AutoGen/GenC.py index 77de1657f0..45fb9899f2 100644 --- a/BaseTools/Source/Python/AutoGen/GenC.py +++ b/BaseTools/Source/Python/AutoGen/GenC.py @@ -1384,22 +1384,21 @@ def CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH): # @param AutoGenH The TemplateString object for header file # def CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH): - if Info.IsLibrary: - return - if Info.ModuleType in ["USER_DEFINED", "BASE"]: GuidType = "GUID" else: GuidType = "EFI_GUID" if Info.GuidList: - AutoGenC.Append("\n// Guids\n") + if not Info.IsLibrary: + AutoGenC.Append("\n// Guids\n") AutoGenH.Append("\n// Guids\n") # # GUIDs # for Key in Info.GuidList: - AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s %s = %s;\n' % (GuidType, Key, Info.GuidList[Key])) + if not Info.IsLibrary: + AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s %s = %s;\n' % (GuidType, Key, Info.GuidList[Key])) AutoGenH.Append('extern %s %s;\n' % (GuidType, Key)) ## Create code for protocol @@ -1409,22 +1408,21 @@ def CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH): # @param AutoGenH The TemplateString object for header file # def CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH): - if Info.IsLibrary: - return - if Info.ModuleType in ["USER_DEFINED", "BASE"]: GuidType = "GUID" else: GuidType = "EFI_GUID" if Info.ProtocolList: - AutoGenC.Append("\n// Protocols\n") + if not Info.IsLibrary: + AutoGenC.Append("\n// Protocols\n") AutoGenH.Append("\n// Protocols\n") # # Protocol GUIDs # for Key in Info.ProtocolList: - AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s %s = %s;\n' % (GuidType, Key, Info.ProtocolList[Key])) + if not Info.IsLibrary: + AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s %s = %s;\n' % (GuidType, Key, Info.ProtocolList[Key])) AutoGenH.Append('extern %s %s;\n' % (GuidType, Key)) ## Create code for PPI @@ -1434,22 +1432,21 @@ def CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH): # @param AutoGenH The TemplateString object for header file # def CreatePpiDefinitionCode(Info, AutoGenC, AutoGenH): - if Info.IsLibrary: - return - if Info.ModuleType in ["USER_DEFINED", "BASE"]: GuidType = "GUID" else: GuidType = "EFI_GUID" if Info.PpiList: - AutoGenC.Append("\n// PPIs\n") + if not Info.IsLibrary: + AutoGenC.Append("\n// PPIs\n") AutoGenH.Append("\n// PPIs\n") # # PPI GUIDs # for Key in Info.PpiList: - AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s %s = %s;\n' % (GuidType, Key, Info.PpiList[Key])) + if not Info.IsLibrary: + AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s %s = %s;\n' % (GuidType, Key, Info.PpiList[Key])) AutoGenH.Append('extern %s %s;\n' % (GuidType, Key)) ## Create code for PCD diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py index 0342709a3a..d9b219e1c7 100644 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -19,7 +19,7 @@ import string import re import os.path as path from Common.LongFilePathSupport import OpenLongFilePath as open - +from Common.MultipleWorkspace import MultipleWorkspace as mws from Common.BuildToolError import * from Common.Misc import * from Common.String import * @@ -559,7 +559,7 @@ cleanlib: found = False while not found and os.sep in package_rel_dir: index = package_rel_dir.index(os.sep) - current_dir = os.path.join(current_dir, package_rel_dir[:index]) + current_dir = mws.join(current_dir, package_rel_dir[:index]) for fl in os.listdir(current_dir): if fl.endswith('.dec'): found = True diff --git a/BaseTools/Source/Python/Common/EdkIIWorkspace.py b/BaseTools/Source/Python/Common/EdkIIWorkspace.py index 84d89b6c2e..401efeef3c 100644 --- a/BaseTools/Source/Python/Common/EdkIIWorkspace.py +++ b/BaseTools/Source/Python/Common/EdkIIWorkspace.py @@ -17,6 +17,7 @@ import Common.LongFilePathOs as os, sys, time from DataType import * from Common.LongFilePathSupport import OpenLongFilePath as open +from Common.MultipleWorkspace import MultipleWorkspace as mws ## EdkIIWorkspace # @@ -112,7 +113,7 @@ class EdkIIWorkspace: # @retval string The full path filename # def WorkspaceFile(self, FileName): - return os.path.realpath(os.path.join(self.WorkspaceDir,FileName)) + return os.path.realpath(mws.join(self.WorkspaceDir,FileName)) ## Convert to a real path filename # diff --git a/BaseTools/Source/Python/Common/FdfParserLite.py b/BaseTools/Source/Python/Common/FdfParserLite.py index 54a60a7e8f..a0ee249748 100644 --- a/BaseTools/Source/Python/Common/FdfParserLite.py +++ b/BaseTools/Source/Python/Common/FdfParserLite.py @@ -20,6 +20,7 @@ import Common.LongFilePathOs as os import CommonDataClass.FdfClass from Common.LongFilePathSupport import OpenLongFilePath as open +from Common.MultipleWorkspace import MultipleWorkspace as mws ##define T_CHAR_SPACE ' ' ##define T_CHAR_NULL '\0' @@ -485,7 +486,8 @@ class FdfParser(object): IncFileName = self.__Token if not os.path.isabs(IncFileName): if IncFileName.startswith('$(WORKSPACE)'): - Str = IncFileName.replace('$(WORKSPACE)', os.environ.get('WORKSPACE')) + Str = mws.handleWsMacro(IncFileName) + Str = Str.replace('$(WORKSPACE)', os.environ.get('WORKSPACE')) if os.path.exists(Str): if not os.path.isabs(Str): Str = os.path.abspath(Str) @@ -494,7 +496,7 @@ class FdfParser(object): # file is in the same dir with FDF file FullFdf = self.FileName if not os.path.isabs(self.FileName): - FullFdf = os.path.join(os.environ.get('WORKSPACE'), self.FileName) + FullFdf = mws.join(os.environ.get('WORKSPACE'), self.FileName) IncFileName = os.path.join(os.path.dirname(FullFdf), IncFileName) diff --git a/BaseTools/Source/Python/Common/LongFilePathOsPath.py b/BaseTools/Source/Python/Common/LongFilePathOsPath.py index cb89b1b813..0bba446419 100644 --- a/BaseTools/Source/Python/Common/LongFilePathOsPath.py +++ b/BaseTools/Source/Python/Common/LongFilePathOsPath.py @@ -49,3 +49,5 @@ dirname = os.path.dirname islink = os.path.islink isabs = os.path.isabs realpath = os.path.realpath +relpath = os.path.relpath +pardir = os.path.pardir diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py index 8ba5819cc1..0eedddc861 100644 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -35,6 +35,7 @@ from BuildToolError import * from CommonDataClass.DataClass import * from Parsing import GetSplitValueList from Common.LongFilePathSupport import OpenLongFilePath as open +from Common.MultipleWorkspace import MultipleWorkspace as mws ## Regular expression used to find out place holders in string template gPlaceholderPattern = re.compile("\$\{([^$()\s]+)\}", re.MULTILINE|re.UNICODE) @@ -1728,6 +1729,7 @@ class PathClass(object): # Remove any '.' and '..' in path if self.Root: + self.Root = mws.getWs(self.Root, self.File) self.Path = os.path.normpath(os.path.join(self.Root, self.File)) self.Root = os.path.normpath(CommonPath([self.Root, self.Path])) # eliminate the side-effect of 'C:' @@ -1838,7 +1840,10 @@ class PathClass(object): RealFile = os.path.join(self.AlterRoot, self.File) elif self.Root: RealFile = os.path.join(self.Root, self.File) - return FILE_NOT_FOUND, os.path.join(self.AlterRoot, RealFile) + if len (mws.getPkgPath()) == 0: + return FILE_NOT_FOUND, os.path.join(self.AlterRoot, RealFile) + else: + return FILE_NOT_FOUND, "%s is not found in packages path:\n\t%s" % (self.File, '\n\t'.join(mws.getPkgPath())) ErrorCode = 0 ErrorInfo = '' diff --git a/BaseTools/Source/Python/Common/String.py b/BaseTools/Source/Python/Common/String.py index 6c9671d514..5c8d1e0ded 100644 --- a/BaseTools/Source/Python/Common/String.py +++ b/BaseTools/Source/Python/Common/String.py @@ -24,6 +24,7 @@ import GlobalData from BuildToolError import * from CommonDataClass.Exceptions import * from Common.LongFilePathSupport import OpenLongFilePath as open +from Common.MultipleWorkspace import MultipleWorkspace as mws gHexVerPatt = re.compile('0x[a-f0-9]{4}[a-f0-9]{4}$', re.IGNORECASE) gHumanReadableVerPatt = re.compile(r'([1-9][0-9]*|0)\.[0-9]{1,2}$') @@ -305,6 +306,11 @@ def NormPath(Path, Defines={}): # To local path format # Path = os.path.normpath(Path) + if Path.startswith(GlobalData.gWorkspace) 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) if IsRelativePath and Path[0] != '.': Path = os.path.join('.', Path) @@ -702,7 +708,7 @@ def RaiseParserError(Line, Section, File, Format='', LineNo= -1): # @retval string A full path # def WorkspaceFile(WorkspaceDir, Filename): - return os.path.join(NormPath(WorkspaceDir), NormPath(Filename)) + return mws.join(NormPath(WorkspaceDir), NormPath(Filename)) ## Split string # diff --git a/BaseTools/Source/Python/Ecc/Check.py b/BaseTools/Source/Python/Ecc/Check.py index 7932fb3394..5e5c8e72e4 100644 --- a/BaseTools/Source/Python/Ecc/Check.py +++ b/BaseTools/Source/Python/Ecc/Check.py @@ -19,6 +19,7 @@ from MetaDataParser import ParseHeaderCommentSection import EccGlobalData import c from Common.LongFilePathSupport import OpenLongFilePath as open +from Common.MultipleWorkspace import MultipleWorkspace as mws ## Check # @@ -380,9 +381,7 @@ class Check(object): for Key in RecordDict: if len(RecordDict[Key]) > 1: for Item in RecordDict[Key]: - Path = Item[1].replace(EccGlobalData.gWorkspace, '') - if Path.startswith('\\') or Path.startswith('/'): - Path = Path[1:] + Path = mws.relpath(Item[1], EccGlobalData.gWorkspace) if not EccGlobalData.gException.IsException(ERROR_INCLUDE_FILE_CHECK_NAME, Path): EccGlobalData.gDb.TblReport.Insert(ERROR_INCLUDE_FILE_CHECK_NAME, OtherMsg="The file name for [%s] is duplicate" % Path, BelongsToTable='File', BelongsToItem=Item[0]) @@ -653,7 +652,7 @@ class Check(object): if LibraryClass[1].upper() == 'NULL' or LibraryClass[1].startswith('!ifdef') or LibraryClass[1].startswith('!ifndef') or LibraryClass[1].endswith('!endif'): continue else: - LibraryIns = os.path.normpath(os.path.join(EccGlobalData.gWorkspace, LibraryClass[2])) + LibraryIns = os.path.normpath(mws.join(EccGlobalData.gWorkspace, LibraryClass[2])) SqlCommand = """select Value3 from Inf where BelongsToFile = (select ID from File where lower(FullPath) = lower('%s')) and Value2 = '%s'""" % (LibraryIns, 'LIBRARY_CLASS') @@ -729,7 +728,7 @@ class Check(object): for Record in RecordSet: FdfID = Record[0] FilePath = Record[1] - FilePath = os.path.normpath(os.path.join(EccGlobalData.gWorkspace, FilePath)) + FilePath = os.path.normpath(mws.join(EccGlobalData.gWorkspace, FilePath)) SqlCommand = """select ID from Inf where Model = %s and BelongsToFile = (select ID from File where FullPath like '%s') """ % (MODEL_EFI_SOURCE_FILE, FilePath) NewRecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand) @@ -913,9 +912,7 @@ class Check(object): RecordSet = Table.Exec(SqlCommand) Path = "" for Record in RecordSet: - Path = Record[0].replace(EccGlobalData.gWorkspace, '') - if Path.startswith('\\') or Path.startswith('/'): - Path = Path[1:] + Path = mws.relpath(Record[0], EccGlobalData.gWorkspace) return Path # Check whether two module INFs under one workspace has the same FILE_GUID value @@ -1223,7 +1220,10 @@ class Check(object): SqlCommand = """select ID, Name from %s where Model = %s""" % (FileTable, MODEL_IDENTIFIER_VARIABLE) RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand) for Record in RecordSet: - if not Pattern.match(Record[1]): + Var = Record[1] + if Var.startswith('CONST'): + Var = Var[5:].lstrip() + if not Pattern.match(Var): if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME, Record[1]): EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME, OtherMsg="The variable name [%s] does not follow the rules" % (Record[1]), BelongsToTable=FileTable, BelongsToItem=Record[0]) diff --git a/BaseTools/Source/Python/Ecc/Ecc.py b/BaseTools/Source/Python/Ecc/Ecc.py index ec8f6c22cf..c2ad4faff4 100644 --- a/BaseTools/Source/Python/Ecc/Ecc.py +++ b/BaseTools/Source/Python/Ecc/Ecc.py @@ -38,6 +38,7 @@ import c import re, string from Exception import * from Common.LongFilePathSupport import OpenLongFilePath as open +from Common.MultipleWorkspace import MultipleWorkspace as mws ## Ecc # @@ -70,8 +71,13 @@ class Ecc(object): # WorkspaceDir = os.path.normcase(os.path.normpath(os.environ["WORKSPACE"])) os.environ["WORKSPACE"] = WorkspaceDir + + # set multiple workspace + PackagesPath = os.getenv("PACKAGES_PATH") + mws.setWs(WorkspaceDir, PackagesPath) + 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: diff --git a/BaseTools/Source/Python/Ecc/MetaDataParser.py b/BaseTools/Source/Python/Ecc/MetaDataParser.py index d80a5cff5d..82ede3eb33 100644 --- a/BaseTools/Source/Python/Ecc/MetaDataParser.py +++ b/BaseTools/Source/Python/Ecc/MetaDataParser.py @@ -14,6 +14,7 @@ import Common.LongFilePathOs as os from CommonDataClass.DataClass import * from EccToolError import * +from Common.MultipleWorkspace import MultipleWorkspace as mws import EccGlobalData import re ## Get the inlcude path list for a source file @@ -33,8 +34,8 @@ def GetIncludeListOfFile(WorkSpace, Filepath, Db): % (MODEL_META_DATA_PACKAGE, MODEL_EFI_SOURCE_FILE, '\\', Filepath) RecordSet = Db.TblFile.Exec(SqlCommand) for Record in RecordSet: - DecFullPath = os.path.normpath(os.path.join(WorkSpace, Record[0])) - InfFullPath = os.path.normpath(os.path.join(WorkSpace, Record[1])) + DecFullPath = os.path.normpath(mws.join(WorkSpace, Record[0])) + InfFullPath = os.path.normpath(mws.join(WorkSpace, Record[1])) (DecPath, DecName) = os.path.split(DecFullPath) (InfPath, InfName) = os.path.split(InfFullPath) SqlCommand = """select Value1 from Dec where BelongsToFile = diff --git a/BaseTools/Source/Python/Ecc/c.py b/BaseTools/Source/Python/Ecc/c.py index dcb37e5632..256b9e021c 100644 --- a/BaseTools/Source/Python/Ecc/c.py +++ b/BaseTools/Source/Python/Ecc/c.py @@ -1271,7 +1271,10 @@ def CheckFuncLayoutReturnType(FullFileName): FuncName = Result[5] if EccGlobalData.gException.IsException(ERROR_C_FUNCTION_LAYOUT_CHECK_RETURN_TYPE, FuncName): continue - Index = Result[0].find(TypeStart) + Result0 = Result[0] + if Result0.upper().startswith('STATIC'): + Result0 = Result0[6:].strip() + Index = Result0.find(TypeStart) if Index != 0 or Result[3] != 0: PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_RETURN_TYPE, '[%s] Return Type should appear at the start of line' % FuncName, FileTable, Result[1]) @@ -1313,9 +1316,10 @@ def CheckFuncLayoutModifier(FullFileName): for Result in ResultSet: ReturnType = GetDataTypeFromModifier(Result[0]) TypeStart = ReturnType.split()[0] -# if len(ReturnType) == 0: -# continue - Index = Result[0].find(TypeStart) + Result0 = Result[0] + if Result0.upper().startswith('STATIC'): + Result0 = Result0[6:].strip() + Index = Result0.find(TypeStart) if Index != 0: PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_OPTIONAL_FUNCTIONAL_MODIFIER, '', FileTable, Result[1]) @@ -1327,8 +1331,6 @@ def CheckFuncLayoutModifier(FullFileName): for Result in ResultSet: ReturnType = GetDataTypeFromModifier(Result[0]) TypeStart = ReturnType.split()[0] -# if len(ReturnType) == 0: -# continue Result0 = Result[0] if Result0.upper().startswith('STATIC'): Result0 = Result0[6:].strip() @@ -1631,6 +1633,8 @@ def CheckMemberVariableFormat(Name, Value, FileTable, TdId, ModelId): Field = Field.strip() if Field == '': continue + if Field.startswith("#"): + continue # Enum could directly assign value to variable Field = Field.split('=')[0].strip() TokenList = Field.split() diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py b/BaseTools/Source/Python/GenFds/FfsInfStatement.py index 29dc75f433..ed767d3fa6 100644 --- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py +++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py @@ -28,6 +28,7 @@ import Section import RuleSimpleFile import RuleComplexFile from CommonDataClass.FdfClass import FfsInfStatementClassObject +from Common.MultipleWorkspace import MultipleWorkspace as mws from Common.String import * from Common.Misc import PathClass from Common.Misc import GuidStructureByteArrayToGuidString @@ -365,7 +366,7 @@ class FfsInfStatement(FfsInfStatementClassObject): # self.__InfParse__(Dict) - SrcFile = os.path.join( GenFdsGlobalVariable.WorkSpaceDir , self.InfFileName); + SrcFile = mws.join( GenFdsGlobalVariable.WorkSpaceDir , self.InfFileName); DestFile = os.path.join( self.OutputPath, self.ModuleGuid + '.ffs') SrcFileDir = "." @@ -511,7 +512,7 @@ class FfsInfStatement(FfsInfStatementClassObject): # def __GetPlatformArchList__(self): - InfFileKey = os.path.normpath(os.path.join(GenFdsGlobalVariable.WorkSpaceDir, self.InfFileName)) + InfFileKey = os.path.normpath(mws.join(GenFdsGlobalVariable.WorkSpaceDir, self.InfFileName)) DscArchList = [] PlatformDataBase = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'IA32', GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag] if PlatformDataBase != None: @@ -878,7 +879,7 @@ class FfsInfStatement(FfsInfStatementClassObject): if not HasGneratedFlag: UniVfrOffsetFileSection = "" - ModuleFileName = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, self.InfFileName) + ModuleFileName = mws.join(GenFdsGlobalVariable.WorkSpaceDir, self.InfFileName) InfData = GenFdsGlobalVariable.WorkSpace.BuildObject[PathClass(ModuleFileName), self.CurrentArch] # # Search the source list in InfData to find if there are .vfr file exist. diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Python/GenFds/GenFds.py index c2ad4e0e2a..a0beff0391 100644 --- a/BaseTools/Source/Python/GenFds/GenFds.py +++ b/BaseTools/Source/Python/GenFds/GenFds.py @@ -39,6 +39,7 @@ from Common.Misc import SaveFileOnChange from Common.Misc import ClearDuplicatedInf from Common.Misc import GuidStructureStringToGuidString from Common.BuildVersion import gBUILD_VERSION +from Common.MultipleWorkspace import MultipleWorkspace as mws ## Version and Copyright versionNumber = "1.0" + ' ' + gBUILD_VERSION @@ -94,6 +95,10 @@ def main(): if (Options.debug): GenFdsGlobalVariable.VerboseLogger( "Using Workspace:" + Workspace) os.chdir(GenFdsGlobalVariable.WorkSpaceDir) + + # set multiple workspace + PackagesPath = os.getenv("PACKAGES_PATH") + mws.setWs(GenFdsGlobalVariable.WorkSpaceDir, PackagesPath) if (Options.filename): FdfFilename = Options.filename @@ -102,7 +107,7 @@ def main(): if FdfFilename[0:2] == '..': FdfFilename = os.path.realpath(FdfFilename) if not os.path.isabs (FdfFilename): - FdfFilename = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, FdfFilename) + FdfFilename = mws.join(GenFdsGlobalVariable.WorkSpaceDir, FdfFilename) if not os.path.exists(FdfFilename): EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=FdfFilename) @@ -129,13 +134,13 @@ def main(): ActivePlatform = os.path.realpath(ActivePlatform) if not os.path.isabs (ActivePlatform): - ActivePlatform = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, ActivePlatform) + ActivePlatform = mws.join(GenFdsGlobalVariable.WorkSpaceDir, ActivePlatform) if not os.path.exists(ActivePlatform) : EdkLogger.error("GenFds", FILE_NOT_FOUND, "ActivePlatform doesn't exist!") if os.path.normcase (ActivePlatform).find(Workspace) == 0: - ActivePlatform = ActivePlatform[len(Workspace):] + ActivePlatform = mws.relpath(ActivePlatform, Workspace) if len(ActivePlatform) > 0 : if ActivePlatform[0] == '\\' or ActivePlatform[0] == '/': ActivePlatform = ActivePlatform[1:] @@ -159,7 +164,7 @@ def main(): ConfDirectoryPath = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, ConfDirectoryPath) else: # Get standard WORKSPACE/Conf, use the absolute path to the WORKSPACE/Conf - ConfDirectoryPath = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, 'Conf') + ConfDirectoryPath = mws.join(GenFdsGlobalVariable.WorkSpaceDir, 'Conf') GenFdsGlobalVariable.ConfDir = ConfDirectoryPath BuildConfigurationFile = os.path.normpath(os.path.join(ConfDirectoryPath, "target.txt")) if os.path.isfile(BuildConfigurationFile) == True: diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py index 04bbc300ce..5bdc1b8288 100644 --- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py +++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py @@ -31,6 +31,7 @@ from AutoGen.BuildEngine import BuildRule import Common.DataType as DataType from Common.Misc import PathClass from Common.LongFilePathSupport import OpenLongFilePath as open +from Common.MultipleWorkspace import MultipleWorkspace as mws ## Global variables # @@ -322,12 +323,13 @@ class GenFdsGlobalVariable: # @param String String that may contain macro # def ReplaceWorkspaceMacro(String): + String = mws.handleWsMacro(String) Str = String.replace('$(WORKSPACE)', GenFdsGlobalVariable.WorkSpaceDir) if os.path.exists(Str): if not os.path.isabs(Str): Str = os.path.abspath(Str) else: - Str = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, String) + Str = mws.join(GenFdsGlobalVariable.WorkSpaceDir, String) return os.path.normpath(Str) ## Check if the input files are newer than output files diff --git a/BaseTools/Source/Python/GenFds/Region.py b/BaseTools/Source/Python/GenFds/Region.py index 15b2ecba90..feb56cb60f 100644 --- a/BaseTools/Source/Python/GenFds/Region.py +++ b/BaseTools/Source/Python/GenFds/Region.py @@ -24,6 +24,7 @@ from stat import * from Common import EdkLogger from Common.BuildToolError import * from Common.LongFilePathSupport import OpenLongFilePath as open +from Common.MultipleWorkspace import MultipleWorkspace as mws ## generate Region # @@ -205,7 +206,7 @@ class Region(RegionClassObject): for RegionData in self.RegionDataList: RegionData = GenFdsGlobalVariable.MacroExtend(RegionData, MacroDict) if RegionData[1] != ':' : - RegionData = os.path.join (GenFdsGlobalVariable.WorkSpaceDir, RegionData) + RegionData = mws.join (GenFdsGlobalVariable.WorkSpaceDir, RegionData) if not os.path.exists(RegionData): EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=RegionData) # diff --git a/BaseTools/Source/Python/Makefile b/BaseTools/Source/Python/Makefile index 4044fcefeb..d3f1baa831 100644 --- a/BaseTools/Source/Python/Makefile +++ b/BaseTools/Source/Python/Makefile @@ -59,6 +59,7 @@ COMMON_PYTHON=$(BASE_TOOLS_PATH)\Source\Python\Common\BuildToolError.py \ $(BASE_TOOLS_PATH)\Source\Python\Common\ToolDefClassObject.py \ $(BASE_TOOLS_PATH)\Source\Python\Common\VpdInfoFile.py \ $(BASE_TOOLS_PATH)\Source\Python\Common\BuildVersion.py \ + $(BASE_TOOLS_PATH)\Source\Python\Common\MultipleWorkspace.py \ $(BASE_TOOLS_PATH)\Source\Python\CommonDataClass\CommonClass.py \ $(BASE_TOOLS_PATH)\Source\Python\CommonDataClass\DataClass.py \ $(BASE_TOOLS_PATH)\Source\Python\CommonDataClass\Exceptions.py \ diff --git a/BaseTools/Source/Python/UPT/Core/DistributionPackageClass.py b/BaseTools/Source/Python/UPT/Core/DistributionPackageClass.py index bfe6dcc70f..9c55e0ea88 100644 --- a/BaseTools/Source/Python/UPT/Core/DistributionPackageClass.py +++ b/BaseTools/Source/Python/UPT/Core/DistributionPackageClass.py @@ -32,6 +32,7 @@ from Logger.ToolError import EDK1_INF_ERROR from Object.POM.CommonObject import IdentificationObject from Object.POM.CommonObject import CommonHeaderObject from Object.POM.CommonObject import MiscFileObject +from Common.MultipleWorkspace import MultipleWorkspace as mws ## DistributionPackageHeaderClass # @@ -110,14 +111,17 @@ class DistributionPackageClass(object): # @param ModuleList: A list of all modules # def GetDistributionPackage(self, WorkspaceDir, PackageList, ModuleList): + # Backup WorkspaceDir + Root = WorkspaceDir + # # Get Packages # if PackageList: for PackageFile in PackageList: - PackageFileFullPath = \ - os.path.normpath(os.path.join(WorkspaceDir, PackageFile)) - DecObj = DecPomAlignment(PackageFileFullPath, WorkspaceDir, CheckMulDec = True) + PackageFileFullPath = mws.join(Root, PackageFile) + WorkspaceDir = mws.getWs(Root, PackageFile) + DecObj = DecPomAlignment(PackageFileFullPath, WorkspaceDir, CheckMulDec=True) PackageObj = DecObj # # Parser inf file one bye one @@ -140,8 +144,7 @@ class DistributionPackageClass(object): # Inf class in InfPomAlignment. # try: - ModuleObj = InfPomAlignment(Filename, WorkspaceDir, \ - PackageObj.GetPackagePath()) + ModuleObj = InfPomAlignment(Filename, WorkspaceDir, PackageObj.GetPackagePath()) # # Add module to package @@ -168,11 +171,11 @@ class DistributionPackageClass(object): # if ModuleList: for ModuleFile in ModuleList: - ModuleFileFullPath = \ - os.path.normpath(os.path.join(WorkspaceDir, ModuleFile)) + ModuleFileFullPath = mws.join(Root, ModuleFile) + WorkspaceDir = mws.getWs(Root, ModuleFile) + try: - ModuleObj = InfPomAlignment(ModuleFileFullPath, - WorkspaceDir) + ModuleObj = InfPomAlignment(ModuleFileFullPath, WorkspaceDir) ModuleKey = (ModuleObj.GetGuid(), ModuleObj.GetVersion(), ModuleObj.GetName(), @@ -185,7 +188,10 @@ class DistributionPackageClass(object): ST.WRN_EDK1_INF_FOUND%ModuleFileFullPath, ExtraData=ST.ERR_NOT_SUPPORTED_SA_MODULE) else: - raise + raise + + # Recover WorkspaceDir + WorkspaceDir = Root ## Get all files included for a distribution package, except tool/misc of # distribution level diff --git a/BaseTools/Source/Python/UPT/Core/PackageFile.py b/BaseTools/Source/Python/UPT/Core/PackageFile.py index 47ea0bc0a9..5fafd85bff 100644 --- a/BaseTools/Source/Python/UPT/Core/PackageFile.py +++ b/BaseTools/Source/Python/UPT/Core/PackageFile.py @@ -37,6 +37,7 @@ from Logger import StringTable as ST from Library.Misc import CreateDirectory from Library.Misc import RemoveDirectory from Core.FileHook import __FileHookOpen__ +from Common.MultipleWorkspace import MultipleWorkspace as mws class PackageFile: @@ -203,8 +204,11 @@ class PackageFile: # @param Files: the files to pack # def PackFiles(self, Files): - for File1 in Files: - self.PackFile(File1) + for File in Files: + Cwd = os.getcwd() + os.chdir(mws.getWs(mws.WORKSPACE, File)) + self.PackFile(File) + os.chdir(Cwd) ## Pack the file # diff --git a/BaseTools/Source/Python/UPT/Library/GlobalData.py b/BaseTools/Source/Python/UPT/Library/GlobalData.py index d478983c23..8f446d4888 100644 --- a/BaseTools/Source/Python/UPT/Library/GlobalData.py +++ b/BaseTools/Source/Python/UPT/Library/GlobalData.py @@ -19,6 +19,7 @@ GlobalData # The workspace directory # gWORKSPACE = '.' +gPACKAGE_PATH = None # # INF module directory @@ -107,4 +108,4 @@ gPackageDict = {} # Used by Library instance parser # {FilePath: FileObj} # -gLIBINSTANCEDICT = {} \ No newline at end of file +gLIBINSTANCEDICT = {} diff --git a/BaseTools/Source/Python/UPT/Library/Misc.py b/BaseTools/Source/Python/UPT/Library/Misc.py index bc9e0e172b..0d92cb3767 100644 --- a/BaseTools/Source/Python/UPT/Library/Misc.py +++ b/BaseTools/Source/Python/UPT/Library/Misc.py @@ -50,6 +50,7 @@ from Library.ParserValidate import IsValidHexVersion from Library.ParserValidate import IsValidPath from Object.POM.CommonObject import TextObject from Core.FileHook import __FileHookOpen__ +from Common.MultipleWorkspace import MultipleWorkspace as mws ## Convert GUID string in xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx style to C # structure style @@ -592,7 +593,11 @@ def GetWorkspace(): if WorkspaceDir[-1] == ':': WorkspaceDir += os.sep - return WorkspaceDir + + PackagesPath = os.environ.get("PACKAGES_PATH") + mws.setWs(WorkspaceDir, PackagesPath) + + return WorkspaceDir, mws.PACKAGES_PATH ## Get relative path # diff --git a/BaseTools/Source/Python/UPT/Library/ParserValidate.py b/BaseTools/Source/Python/UPT/Library/ParserValidate.py index e973227898..028cf9a54f 100644 --- a/BaseTools/Source/Python/UPT/Library/ParserValidate.py +++ b/BaseTools/Source/Python/UPT/Library/ParserValidate.py @@ -27,6 +27,7 @@ from Library.DataType import TAB_SPACE_SPLIT from Library.String import GetSplitValueList from Library.ExpressionValidate import IsValidBareCString from Library.ExpressionValidate import IsValidFeatureFlagExp +from Common.MultipleWorkspace import MultipleWorkspace as mws ## __HexDigit() method # @@ -236,7 +237,7 @@ def IsValidPath(Path, Root): Path = os.path.normpath(Path).replace('\\', '/') Root = os.path.normpath(Root).replace('\\', '/') - FullPath = os.path.normpath(os.path.join(Root, Path)).replace('\\', '/') + FullPath = mws.join(Root, Path) if not os.path.exists(FullPath): return False diff --git a/BaseTools/Source/Python/UPT/Library/Parsing.py b/BaseTools/Source/Python/UPT/Library/Parsing.py index ace3e0d118..c34e775144 100644 --- a/BaseTools/Source/Python/UPT/Library/Parsing.py +++ b/BaseTools/Source/Python/UPT/Library/Parsing.py @@ -827,21 +827,23 @@ def GetPkgInfoFromDec(Path): def GetWorkspacePackage(): DecFileList = [] WorkspaceDir = GlobalData.gWORKSPACE - for Root, Dirs, Files in os.walk(WorkspaceDir): - if 'CVS' in Dirs: - Dirs.remove('CVS') - if '.svn' in Dirs: - Dirs.remove('.svn') - for Dir in Dirs: - if Dir.startswith('.'): - Dirs.remove(Dir) - for FileSp in Files: - if FileSp.startswith('.'): - continue - Ext = os.path.splitext(FileSp)[1] - if Ext.lower() in ['.dec']: - DecFileList.append\ - (os.path.normpath(os.path.join(Root, FileSp))) + PackageDir = GlobalData.gPACKAGE_PATH + for PkgRoot in [WorkspaceDir] + PackageDir: + for Root, Dirs, Files in os.walk(PkgRoot): + if 'CVS' in Dirs: + Dirs.remove('CVS') + if '.svn' in Dirs: + Dirs.remove('.svn') + for Dir in Dirs: + if Dir.startswith('.'): + Dirs.remove(Dir) + for FileSp in Files: + if FileSp.startswith('.'): + continue + Ext = os.path.splitext(FileSp)[1] + if Ext.lower() in ['.dec']: + DecFileList.append\ + (os.path.normpath(os.path.join(Root, FileSp))) # # abstract package guid, version info from DecFile List # diff --git a/BaseTools/Source/Python/UPT/MkPkg.py b/BaseTools/Source/Python/UPT/MkPkg.py index 2eb84588bd..87c84f0cc2 100644 --- a/BaseTools/Source/Python/UPT/MkPkg.py +++ b/BaseTools/Source/Python/UPT/MkPkg.py @@ -50,6 +50,7 @@ from Library.ParserValidate import IsValidPath from Core.DistributionPackageClass import DistributionPackageClass from Core.PackageFile import PackageFile +from Common.MultipleWorkspace import MultipleWorkspace as mws ## CheckForExistingDp # @@ -136,7 +137,7 @@ def Main(Options = None): # write(). # FromFile = os.path.normpath(FileObject.GetURI()).encode('utf_8') - FileFullPath = os.path.normpath(os.path.join(WorkspaceDir, FromFile)) + FileFullPath = mws.join(WorkspaceDir, FromFile) if FileFullPath in RePkgDict: (DpGuid, DpVersion, DpName, Repackage) = RePkgDict[FileFullPath] if not Repackage: @@ -183,7 +184,7 @@ def Main(Options = None): DistPkg.Header.RePackage = True Cwd = getcwd() - chdir(WorkspaceDir) + chdir(WorkspaceDir) ContentFile.PackFiles(FileList) chdir(Cwd) @@ -264,7 +265,7 @@ def CheckFileList(QualifiedExt, FileList, ErrorStringExt, ErrorStringFullPath): ErrorStringExt % Item) Item = os.path.normpath(Item) - Path = os.path.normpath(os.path.join(WorkspaceDir, Item)) + Path = mws.join(WorkspaceDir, Item) if not os.path.exists(Path): Logger.Error("\nMkPkg", FILE_NOT_FOUND, ST.ERR_NOT_FOUND % Item) elif Item == Path: diff --git a/BaseTools/Source/Python/UPT/PomAdapter/InfPomAlignment.py b/BaseTools/Source/Python/UPT/PomAdapter/InfPomAlignment.py index 22e9ef5fc0..a151732853 100644 --- a/BaseTools/Source/Python/UPT/PomAdapter/InfPomAlignment.py +++ b/BaseTools/Source/Python/UPT/PomAdapter/InfPomAlignment.py @@ -51,7 +51,7 @@ from PomAdapter.InfPomAlignmentMisc import GenModuleHeaderUserExt from PomAdapter.InfPomAlignmentMisc import GenBinaryData from Parser import InfParser from PomAdapter.DecPomAlignment import DecPomAlignment - +from Common.MultipleWorkspace import MultipleWorkspace as mws ## InfPomAlignment # @@ -534,8 +534,7 @@ class InfPomAlignment(ModuleObject): PackageDependency.SetSupArchList(ConvertArchList(PackageItemObj.GetSupArchList())) PackageDependency.SetFeatureFlag(PackageItemObj.GetFeatureFlagExp()) - PkgInfo = GetPkgInfoFromDec(os.path.normpath(os.path.join(self.WorkSpace, - NormPath(PackageItemObj.GetPackageName())))) + PkgInfo = GetPkgInfoFromDec(mws.join(self.WorkSpace, NormPath(PackageItemObj.GetPackageName()))) if PkgInfo[1] and PkgInfo[2]: PackageDependency.SetGuid(PkgInfo[1]) PackageDependency.SetVersion(PkgInfo[2]) diff --git a/BaseTools/Source/Python/UPT/UPT.py b/BaseTools/Source/Python/UPT/UPT.py index e7b0a8f264..17decda5c3 100644 --- a/BaseTools/Source/Python/UPT/UPT.py +++ b/BaseTools/Source/Python/UPT/UPT.py @@ -39,6 +39,7 @@ from Logger.ToolError import FILE_TYPE_MISMATCH from Logger.ToolError import OPTION_CONFLICT from Logger.ToolError import FatalError from Logger.ToolError import UPT_ALREADY_INSTALLED_ERROR +from Common.MultipleWorkspace import MultipleWorkspace as mws import MkPkg import InstallPkg @@ -164,7 +165,7 @@ def Main(): setattr(Opt, Var[0], Var[1]) try: - GlobalData.gWORKSPACE = GetWorkspace() + GlobalData.gWORKSPACE, GlobalData.gPACKAGE_PATH = GetWorkspace() except FatalError, XExcept: if Logger.GetLevel() <= Logger.DEBUG_9: Logger.Quiet(ST.MSG_PYTHON_ON % (python_version(), platform) + format_exc()) diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py index fe1f7fd6f6..e7d6df6595 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py @@ -343,9 +343,14 @@ class MetaFileParser(object): Name, Value = self._ValueList[1], self._ValueList[2] # Sometimes, we need to make differences between EDK and EDK2 modules if Name == 'INF_VERSION': - try: - self._Version = int(Value, 0) - except: + if re.match(r'0[xX][\da-f-A-F]{5,8}', Value): + self._Version = int(Value, 0) + elif re.match(r'\d+\.\d+', Value): + ValueList = Value.split('.') + Major = '%04o' % int(ValueList[0], 0) + Minor = '%04o' % int(ValueList[1], 0) + self._Version = int('0x' + Major + Minor, 0) + else: EdkLogger.error('Parser', FORMAT_INVALID, "Invalid version number", ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) diff --git a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py index fd10c5dfb9..46eb5d3a8c 100644 --- a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py +++ b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py @@ -21,6 +21,7 @@ import uuid import Common.EdkLogger as EdkLogger import Common.GlobalData as GlobalData +from Common.MultipleWorkspace import MultipleWorkspace as mws from Common.String import * from Common.DataType import * @@ -166,7 +167,7 @@ class DscBuildData(PlatformBuildClassObject): ModuleFile = PathClass(NormPath(Record[0]), GlobalData.gWorkspace, Arch=self._Arch) RecordList = self._RawData[MODEL_META_DATA_COMPONENT_SOURCE_OVERRIDE_PATH, self._Arch, None, ModuleId] if RecordList != []: - SourceOverridePath = os.path.join(GlobalData.gWorkspace, NormPath(RecordList[0][0])) + SourceOverridePath = mws.join(GlobalData.gWorkspace, NormPath(RecordList[0][0])) # Check if the source override path exists if not os.path.isdir(SourceOverridePath): @@ -1954,7 +1955,13 @@ class InfBuildData(ModuleBuildClassObject): RecordList = self._RawData[MODEL_META_DATA_HEADER, self._Arch, self._Platform] for Record in RecordList: if Record[1] == TAB_INF_DEFINES_INF_VERSION: - self._AutoGenVersion = int(Record[2], 0) + if '.' in Record[2]: + ValueList = Record[2].split('.') + Major = '%04o' % int(ValueList[0], 0) + Minor = '%04o' % int(ValueList[1], 0) + self._AutoGenVersion = int('0x' + Major + Minor, 0) + else: + self._AutoGenVersion = int(Record[2], 0) break if self._AutoGenVersion == None: self._AutoGenVersion = 0x00010000 @@ -2179,8 +2186,11 @@ class InfBuildData(ModuleBuildClassObject): if self.AutoGenVersion < 0x00010005: Macros["EDK_SOURCE"] = GlobalData.gEcpSource Macros['PROCESSOR'] = self._Arch + SourceFile = NormPath(Record[0], Macros) + if SourceFile[0] == os.path.sep: + SourceFile = mws.join(GlobalData.gWorkspace, SourceFile[1:]) # old module source files (Edk) - File = PathClass(NormPath(Record[0], Macros), self._ModuleDir, self._SourceOverridePath, + File = PathClass(SourceFile, self._ModuleDir, self._SourceOverridePath, '', False, self._Arch, ToolChainFamily, '', TagName, ToolCode) # check the file validation ErrorCode, ErrorInfo = File.Validate(CaseSensitive=False) @@ -2343,10 +2353,21 @@ class InfBuildData(ModuleBuildClassObject): if File[0] == '.': File = os.path.join(self._ModuleDir, File) else: - File = os.path.join(GlobalData.gWorkspace, File) + File = mws.join(GlobalData.gWorkspace, File) File = RealPath(os.path.normpath(File)) if File: self._Includes.append(File) + if not File and Record[0].find('EFI_SOURCE') > -1: + # tricky to regard WorkSpace as EFI_SOURCE + Macros['EFI_SOURCE'] = GlobalData.gWorkspace + File = NormPath(Record[0], Macros) + if File[0] == '.': + File = os.path.join(self._ModuleDir, File) + else: + File = os.path.join(GlobalData.gWorkspace, File) + File = RealPath(os.path.normpath(File)) + if File: + self._Includes.append(File) return self._Includes ## Retrieve packages this module depends on @@ -2797,7 +2818,7 @@ class WorkspaceDatabase(object): def __init__(self, DbPath, RenewDb=False): self._DbClosedFlag = False if not DbPath: - DbPath = os.path.normpath(os.path.join(GlobalData.gWorkspace, 'Conf', GlobalData.gDatabasePath)) + DbPath = os.path.normpath(mws.join(GlobalData.gWorkspace, 'Conf', GlobalData.gDatabasePath)) # don't create necessary path for db in memory if DbPath != ':memory:': -- cgit v1.2.3