|
From: <js...@us...> - 2011-10-24 08:49:55
|
Revision: 2376
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2376&view=rev
Author: jsu1
Date: 2011-10-24 08:49:49 +0000 (Mon, 24 Oct 2011)
Log Message:
-----------
fix EDKI modules [nmake] section /DFLAG issue
Reviewed-by: gikidy
Reviewed-by: yingke
Signed-off-by: jsu1
Modified Paths:
--------------
trunk/BaseTools/Source/Python/Common/String.py
trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
Modified: trunk/BaseTools/Source/Python/Common/String.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/String.py 2011-10-24 06:11:20 UTC (rev 2375)
+++ trunk/BaseTools/Source/Python/Common/String.py 2011-10-24 08:49:49 UTC (rev 2376)
@@ -72,6 +72,21 @@
return ValueList
+## GetSplitList
+#
+# Get a value list from a string with multiple values splited with SplitString
+# The default SplitTag is DataType.TAB_VALUE_SPLIT
+# 'AAA|BBB|CCC' -> ['AAA', 'BBB', 'CCC']
+#
+# @param String: The input string to be splitted
+# @param SplitStr: The split key, default is DataType.TAB_VALUE_SPLIT
+# @param MaxSplit: The max number of split values, default is -1
+#
+# @retval list() A list for splitted string
+#
+def GetSplitList(String, SplitStr = DataType.TAB_VALUE_SPLIT, MaxSplit = -1):
+ return map(lambda l: l.strip(), String.split(SplitStr, MaxSplit))
+
## MergeArches
#
# Find a key's all arches in dict, add the new arch to the list
Modified: trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
===================================================================
--- trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py 2011-10-24 06:11:20 UTC (rev 2375)
+++ trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py 2011-10-24 08:49:49 UTC (rev 2376)
@@ -1542,7 +1542,7 @@
ToolChain = "*_*_*_%s_FLAGS" % Tool
ToolChainFamily = 'MSFT' # Edk.x only support MSFT tool chain
#ignore not replaced macros in value
- ValueList = GetSplitValueList(' ' + Value, '/D')
+ ValueList = GetSplitList(' ' + Value, '/D')
Dummy = ValueList[0]
for Index in range(1, len(ValueList)):
if ValueList[Index][-1] == '=' or ValueList[Index] == '':
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gi...@us...> - 2011-10-26 06:01:46
|
Revision: 2381
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2381&view=rev
Author: gikidy
Date: 2011-10-26 06:01:39 +0000 (Wed, 26 Oct 2011)
Log Message:
-----------
Not print trace stack while tool encounter build failure.
Signed-off-by: gikidy
Reviewed-by: lgao4
Modified Paths:
--------------
trunk/BaseTools/Source/Python/GenFds/GenFds.py
trunk/BaseTools/Source/Python/build/build.py
Modified: trunk/BaseTools/Source/Python/GenFds/GenFds.py
===================================================================
--- trunk/BaseTools/Source/Python/GenFds/GenFds.py 2011-10-26 05:55:35 UTC (rev 2380)
+++ trunk/BaseTools/Source/Python/GenFds/GenFds.py 2011-10-26 06:01:39 UTC (rev 2381)
@@ -278,7 +278,8 @@
ExtraData="Please send email to edk...@li... for help, attaching following call stack trace!\n",
RaiseError=False
)
- EdkLogger.quiet(traceback.format_exc())
+ if Options.debug != None:
+ EdkLogger.quiet(traceback.format_exc())
ReturnCode = CODE_ERROR
return ReturnCode
Modified: trunk/BaseTools/Source/Python/build/build.py
===================================================================
--- trunk/BaseTools/Source/Python/build/build.py 2011-10-26 05:55:35 UTC (rev 2380)
+++ trunk/BaseTools/Source/Python/build/build.py 2011-10-26 06:01:39 UTC (rev 2381)
@@ -1817,8 +1817,8 @@
if MyBuild != None:
# for multi-thread build exits safely
MyBuild.Relinquish()
- #if Option != None and Option.debug != None:
- EdkLogger.quiet("(Python %s on %s) " % (platform.python_version(), sys.platform) + traceback.format_exc())
+ if Option != None and Option.debug != None:
+ EdkLogger.quiet("(Python %s on %s) " % (platform.python_version(), sys.platform) + traceback.format_exc())
ReturnCode = X.args[0]
except Warning, X:
# error from Fdf parser
@@ -1853,7 +1853,8 @@
ExtraData="\n(Please send email to edk...@li... for help, attaching following call stack trace!)\n",
RaiseError=False
)
- EdkLogger.quiet("(Python %s on %s) " % (platform.python_version(), sys.platform) + traceback.format_exc())
+ if Option != None and Option.debug != None:
+ EdkLogger.quiet("(Python %s on %s) " % (platform.python_version(), sys.platform) + traceback.format_exc())
ReturnCode = CODE_ERROR
finally:
Utils.Progressor.Abort()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gi...@us...> - 2011-10-27 13:17:37
|
Revision: 2385
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2385&view=rev
Author: gikidy
Date: 2011-10-27 13:17:31 +0000 (Thu, 27 Oct 2011)
Log Message:
-----------
Update tools to support using TOOL_CHAIN_TAG in EDKI INF module.
Signed-off-by: gikidy
Reviewed-by: lgao4
Modified Paths:
--------------
trunk/BaseTools/Source/Python/AutoGen/AutoGen.py
trunk/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
trunk/BaseTools/Source/Python/build/build.py
Modified: trunk/BaseTools/Source/Python/AutoGen/AutoGen.py
===================================================================
--- trunk/BaseTools/Source/Python/AutoGen/AutoGen.py 2011-10-27 04:08:48 UTC (rev 2384)
+++ trunk/BaseTools/Source/Python/AutoGen/AutoGen.py 2011-10-27 13:17:31 UTC (rev 2385)
@@ -1946,6 +1946,7 @@
self._Macro["ARCH" ] = self.Arch
self._Macro["TOOLCHAIN" ] = self.ToolChain
self._Macro["TOOLCHAIN_TAG" ] = self.ToolChain
+ self._Macro["TOOL_CHAIN_TAG" ] = self.ToolChain
self._Macro["TARGET" ] = self.BuildTarget
self._Macro["BUILD_DIR" ] = self.PlatformInfo.BuildDir
Modified: trunk/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
===================================================================
--- trunk/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py 2011-10-27 04:08:48 UTC (rev 2384)
+++ trunk/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py 2011-10-27 13:17:31 UTC (rev 2385)
@@ -135,6 +135,7 @@
Macro["ARCH" ] = Arch
Macro["TOOLCHAIN" ] = GenFdsGlobalVariable.ToolChainTag
Macro["TOOLCHAIN_TAG" ] = GenFdsGlobalVariable.ToolChainTag
+ Macro["TOOL_CHAIN_TAG" ] = GenFdsGlobalVariable.ToolChainTag
Macro["TARGET" ] = GenFdsGlobalVariable.TargetName
Macro["BUILD_DIR" ] = GenFdsGlobalVariable.OutputDirDict[Arch]
Modified: trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
===================================================================
--- trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py 2011-10-27 04:08:48 UTC (rev 2384)
+++ trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py 2011-10-27 13:17:31 UTC (rev 2385)
@@ -1874,7 +1874,10 @@
self._Includes.append(self._SourceOverridePath)
Macros = self._Macros
- Macros['PROCESSOR'] = self._Arch
+ if 'PROCESSOR' in GlobalData.gEdkGlobal.keys():
+ Macros['PROCESSOR'] = GlobalData.gEdkGlobal['PROCESSOR']
+ else:
+ Macros['PROCESSOR'] = self._Arch
RecordList = self._RawData[MODEL_EFI_INCLUDE, self._Arch, self._Platform]
for Record in RecordList:
if Record[0].find('EDK_SOURCE') > -1:
Modified: trunk/BaseTools/Source/Python/build/build.py
===================================================================
--- trunk/BaseTools/Source/Python/build/build.py 2011-10-27 04:08:48 UTC (rev 2384)
+++ trunk/BaseTools/Source/Python/build/build.py 2011-10-27 13:17:31 UTC (rev 2385)
@@ -1226,6 +1226,7 @@
GlobalData.gGlobalDefines['TARGET'] = BuildTarget
for ToolChain in self.ToolChainList:
GlobalData.gGlobalDefines['TOOLCHAIN'] = ToolChain
+ GlobalData.gGlobalDefines['TOOL_CHAIN_TAG'] = ToolChain
Wa = WorkspaceAutoGen(
self.WorkspaceDir,
self.PlatformFile,
@@ -1296,6 +1297,7 @@
GlobalData.gGlobalDefines['TARGET'] = BuildTarget
for ToolChain in self.ToolChainList:
GlobalData.gGlobalDefines['TOOLCHAIN'] = ToolChain
+ GlobalData.gGlobalDefines['TOOL_CHAIN_TAG'] = ToolChain
#
# module build needs platform build information, so get platform
# AutoGen first
@@ -1384,6 +1386,7 @@
GlobalData.gGlobalDefines['TARGET'] = BuildTarget
for ToolChain in self.ToolChainList:
GlobalData.gGlobalDefines['TOOLCHAIN'] = ToolChain
+ GlobalData.gGlobalDefines['TOOL_CHAIN_TAG'] = ToolChain
Wa = WorkspaceAutoGen(
self.WorkspaceDir,
self.PlatformFile,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gi...@us...> - 2011-10-28 02:20:40
|
Revision: 2386
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2386&view=rev
Author: gikidy
Date: 2011-10-28 02:20:34 +0000 (Fri, 28 Oct 2011)
Log Message:
-----------
Fix a bug the FdfParser will check a file in OUTPUT_DIECTORY during AutoGen phase.
Signed-off-by: gikidy
Reviewed-by: lgao4
Modified Paths:
--------------
trunk/BaseTools/Source/Python/AutoGen/AutoGen.py
trunk/BaseTools/Source/Python/Common/GlobalData.py
trunk/BaseTools/Source/Python/GenFds/FdfParser.py
Modified: trunk/BaseTools/Source/Python/AutoGen/AutoGen.py
===================================================================
--- trunk/BaseTools/Source/Python/AutoGen/AutoGen.py 2011-10-27 13:17:31 UTC (rev 2385)
+++ trunk/BaseTools/Source/Python/AutoGen/AutoGen.py 2011-10-28 02:20:34 UTC (rev 2386)
@@ -238,8 +238,13 @@
EdkLogger.verbose("\nFLASH_DEFINITION = %s" % self.FdfFile)
if self.FdfFile:
+ #
+ # Mark now build in AutoGen Phase
+ #
+ GlobalData.gAutoGenPhase = True
Fdf = FdfParser(self.FdfFile.Path)
Fdf.ParseFile()
+ GlobalData.gAutoGenPhase = False
PcdSet = Fdf.Profile.PcdDict
ModuleList = Fdf.Profile.InfList
self.FdfProfile = Fdf.Profile
Modified: trunk/BaseTools/Source/Python/Common/GlobalData.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/GlobalData.py 2011-10-27 13:17:31 UTC (rev 2385)
+++ trunk/BaseTools/Source/Python/Common/GlobalData.py 2011-10-28 02:20:34 UTC (rev 2386)
@@ -40,4 +40,8 @@
gMacroNamePattern = re.compile("^[A-Z][A-Z0-9_]*$")
# C-style wide string pattern
gWideStringPattern = re.compile('(\W|\A)L"')
+#
+# A global variable for whether current build in AutoGen phase or not.
+#
+gAutoGenPhase = False
Modified: trunk/BaseTools/Source/Python/GenFds/FdfParser.py
===================================================================
--- trunk/BaseTools/Source/Python/GenFds/FdfParser.py 2011-10-27 13:17:31 UTC (rev 2385)
+++ trunk/BaseTools/Source/Python/GenFds/FdfParser.py 2011-10-28 02:20:34 UTC (rev 2386)
@@ -49,6 +49,7 @@
from Common.String import NormPath
import Common.GlobalData as GlobalData
from Common.Expression import *
+from Common import GlobalData
import re
import os
@@ -2390,11 +2391,22 @@
else:
FfsFileObj.FileName = self.__Token
if FfsFileObj.FileName.replace('$(WORKSPACE)', '').find('$') == -1:
- #do case sensitive check for file path
- ErrorCode, ErrorInfo = PathClass(NormPath(FfsFileObj.FileName), GenFdsGlobalVariable.WorkSpaceDir).Validate()
- if ErrorCode != 0:
- EdkLogger.error("GenFds", ErrorCode, ExtraData=ErrorInfo)
+ #
+ # For file in OUTPUT_DIRECTORY will not check whether it exist or not at AutoGen phase.
+ #
+ if not GlobalData.gAutoGenPhase:
+ #do case sensitive check for file path
+ ErrorCode, ErrorInfo = PathClass(NormPath(FfsFileObj.FileName), GenFdsGlobalVariable.WorkSpaceDir).Validate()
+ if ErrorCode != 0:
+ EdkLogger.error("GenFds", ErrorCode, ExtraData=ErrorInfo)
+ else:
+ if not InputMacroDict["OUTPUT_DIRECTORY"] in FfsFileObj.FileName:
+ #do case sensitive check for file path
+ ErrorCode, ErrorInfo = PathClass(NormPath(FfsFileObj.FileName), GenFdsGlobalVariable.WorkSpaceDir).Validate()
+ if ErrorCode != 0:
+ EdkLogger.error("GenFds", ErrorCode, ExtraData=ErrorInfo)
+
if not self.__IsToken( "}"):
raise Warning("expected '}'", self.FileName, self.CurrentLineNumber)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <hc...@us...> - 2011-11-07 07:52:20
|
Revision: 2396
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2396&view=rev
Author: hchen30
Date: 2011-11-07 07:52:12 +0000 (Mon, 07 Nov 2011)
Log Message:
-----------
1. The function " GetSplitValueList" is different between trunk and branch which cause parsing errors. Replace the GetSplitValueList with GetSplitList to split a keyword more than one char.
2. Fix some coding style issues.
Modified Paths:
--------------
trunk/BaseTools/Source/Python/Common/DecClassObject.py
trunk/BaseTools/Source/Python/Common/DecClassObjectLight.py
trunk/BaseTools/Source/Python/Common/DscClassObject.py
trunk/BaseTools/Source/Python/Common/InfClassObject.py
trunk/BaseTools/Source/Python/Common/InfClassObjectLight.py
trunk/BaseTools/Source/Python/Common/String.py
trunk/BaseTools/Source/Python/Eot/Parser.py
trunk/BaseTools/Source/Python/UPT/Library/String.py
Modified: trunk/BaseTools/Source/Python/Common/DecClassObject.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/DecClassObject.py 2011-11-07 05:24:26 UTC (rev 2395)
+++ trunk/BaseTools/Source/Python/Common/DecClassObject.py 2011-11-07 07:52:12 UTC (rev 2396)
@@ -82,14 +82,14 @@
# @var KeyList: To store value for KeyList, a list for all Keys used in Dec
#
class Dec(DecObject):
- def __init__(self, Filename = None, IsToDatabase = False, IsToPackage = False, WorkspaceDir = None, Database = None, SupArchList = DataType.ARCH_LIST):
+ def __init__(self, Filename=None, IsToDatabase=False, IsToPackage=False, WorkspaceDir=None, Database=None, SupArchList=DataType.ARCH_LIST):
self.Identification = Identification()
self.Package = PackageClass()
self.UserExtensions = ''
self.WorkspaceDir = WorkspaceDir
self.SupArchList = SupArchList
self.IsToDatabase = IsToDatabase
-
+
self.Cur = Database.Cur
self.TblFile = Database.TblFile
self.TblDec = Database.TblDec
@@ -104,26 +104,26 @@
# Upper all KEYs to ignore case sensitive when parsing
#
self.KeyList = map(lambda c: c.upper(), self.KeyList)
-
+
#
# Init RecordSet
#
- self.RecordSet = {}
+ self.RecordSet = {}
for Key in self.KeyList:
self.RecordSet[Section[Key]] = []
-
+
#
# Load Dec file if filename is not None
#
if Filename != None:
self.LoadDecFile(Filename)
-
+
#
# Transfer to Package Object if IsToPackage is True
#
if IsToPackage:
self.DecToPackage()
-
+
## Load Dec file
#
# Load the file if it exists
@@ -138,20 +138,20 @@
self.Identification.FileFullPath = Filename
(self.Identification.FileRelativePath, self.Identification.FileName) = os.path.split(Filename)
self.FileID = self.TblFile.InsertFile(Filename, MODEL_FILE_DEC)
-
+
#
# Init DecTable
#
#self.TblDec.Table = "Dec%s" % self.FileID
#self.TblDec.Create()
-
+
#
# Init common datas
#
IfDefList, SectionItemList, CurrentSection, ArchList, ThirdList, IncludeFiles = \
[], [], TAB_UNKNOWN, [], [], []
LineNo = 0
-
+
#
# Parse file content
#
@@ -163,10 +163,10 @@
# Remove comment block
#
if Line.find(TAB_COMMENT_EDK_START) > -1:
- ReservedLine = GetSplitValueList(Line, TAB_COMMENT_EDK_START, 1)[0]
+ ReservedLine = GetSplitList(Line, TAB_COMMENT_EDK_START, 1)[0]
IsFindBlockComment = True
if Line.find(TAB_COMMENT_EDK_END) > -1:
- Line = ReservedLine + GetSplitValueList(Line, TAB_COMMENT_EDK_END, 1)[1]
+ Line = ReservedLine + GetSplitList(Line, TAB_COMMENT_EDK_END, 1)[1]
ReservedLine = ''
IsFindBlockComment = False
if IsFindBlockComment:
@@ -178,7 +178,7 @@
Line = CleanString(Line)
if Line == '':
continue
-
+
#
# Find a new section tab
# First insert previous section items
@@ -197,7 +197,7 @@
SectionItemList = []
ArchList = []
ThirdList = []
-
+
CurrentSection = ''
LineList = GetSplitValueList(Line[len(TAB_SECTION_START):len(Line) - len(TAB_SECTION_END)], TAB_COMMA_SPLIT)
for Item in LineList:
@@ -206,7 +206,7 @@
CurrentSection = ItemList[0]
else:
if CurrentSection != ItemList[0]:
- EdkLogger.error("Parser", PARSER_ERROR, "Different section names '%s' and '%s' are found in one section definition, this is not allowed." % (CurrentSection, ItemList[0]), File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError)
+ EdkLogger.error("Parser", PARSER_ERROR, "Different section names '%s' and '%s' are found in one section definition, this is not allowed." % (CurrentSection, ItemList[0]), File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
if CurrentSection.upper() not in self.KeyList:
RaiseParserError(Line, CurrentSection, Filename, '', LineNo)
ItemList.append('')
@@ -215,18 +215,18 @@
RaiseParserError(Line, CurrentSection, Filename, '', LineNo)
else:
if ItemList[1] != '' and ItemList[1].upper() not in ARCH_LIST_FULL:
- EdkLogger.error("Parser", PARSER_ERROR, "Invalid Arch definition '%s' found" % ItemList[1], File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError)
+ EdkLogger.error("Parser", PARSER_ERROR, "Invalid Arch definition '%s' found" % ItemList[1], File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
ArchList.append(ItemList[1].upper())
ThirdList.append(ItemList[2])
continue
-
+
#
# Not in any defined section
#
if CurrentSection == TAB_UNKNOWN:
ErrorMsg = "%s is not in any defined section" % Line
- EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError)
+ EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
#
# Add a section item
@@ -234,13 +234,13 @@
SectionItemList.append([Line, LineNo])
# End of parse
#End of For
-
+
#
# Insert items data of last section
#
Model = Section[CurrentSection.upper()]
InsertSectionItemsIntoDatabase(self.TblDec, self.FileID, Filename, Model, CurrentSection, SectionItemList, ArchList, ThirdList, IfDefList, self.RecordSet)
-
+
#
# Replace all DEFINE macros with its actual values
#
@@ -255,12 +255,12 @@
# Init global information for the file
#
ContainerFile = self.Identification.FileFullPath
-
+
#
# Generate Package Header
#
self.GenPackageHeader(ContainerFile)
-
+
#
# Generate Includes
#
@@ -280,17 +280,17 @@
# Generate Ppis
#
self.GenGuidProtocolPpis(DataType.TAB_PPIS, ContainerFile)
-
+
#
# Generate LibraryClasses
#
self.GenLibraryClasses(ContainerFile)
-
+
#
# Generate Pcds
#
self.GenPcds(ContainerFile)
-
+
## Get Package Header
#
# Gen Package Header of Dec as <Key> = <Value>
@@ -311,22 +311,22 @@
SqlCommand = """update %s set Value1 = '%s', Value2 = '%s'
where ID = %s""" % (self.TblDec.Table, ConvertToSqlString2(Value1), ConvertToSqlString2(Value2), ID)
self.TblDec.Exec(SqlCommand)
-
+
#
# Get detailed information
#
for Arch in self.SupArchList:
PackageHeader = PackageHeaderClass()
-
+
PackageHeader.Name = QueryDefinesItem(self.TblDec, TAB_DEC_DEFINES_PACKAGE_NAME, Arch, self.FileID)[0]
PackageHeader.Guid = QueryDefinesItem(self.TblDec, TAB_DEC_DEFINES_PACKAGE_GUID, Arch, self.FileID)[0]
PackageHeader.Version = QueryDefinesItem(self.TblDec, TAB_DEC_DEFINES_PACKAGE_VERSION, Arch, self.FileID)[0]
PackageHeader.FileName = self.Identification.FileName
PackageHeader.FullPath = self.Identification.FileFullPath
PackageHeader.DecSpecification = QueryDefinesItem(self.TblDec, TAB_DEC_DEFINES_DEC_SPECIFICATION, Arch, self.FileID)[0]
-
+
self.Package.Header[Arch] = PackageHeader
-
+
## GenIncludes
#
# Gen Includes of Dec
@@ -341,7 +341,7 @@
# Get all Includes
#
RecordSet = self.RecordSet[MODEL_EFI_INCLUDE]
-
+
#
# Go through each arch
#
@@ -355,7 +355,7 @@
Include.FilePath = NormPath(Key)
Include.SupArchList = Includes[Key]
self.Package.Includes.append(Include)
-
+
## GenPpis
#
# Gen Ppis of Dec
@@ -370,7 +370,7 @@
# Get all Items
#
RecordSet = self.RecordSet[Section[Type.upper()]]
-
+
#
# Go through each arch
#
@@ -383,7 +383,7 @@
SqlCommand = """update %s set Value1 = '%s', Value2 = '%s'
where ID = %s""" % (self.TblDec.Table, ConvertToSqlString2(Name), ConvertToSqlString2(Value), Record[3])
self.TblDec.Exec(SqlCommand)
-
+
ListMember = None
if Type == TAB_GUIDS:
ListMember = self.Package.GuidDeclarations
@@ -391,15 +391,15 @@
ListMember = self.Package.ProtocolDeclarations
elif Type == TAB_PPIS:
ListMember = self.Package.PpiDeclarations
-
+
for Key in Lists.keys():
ListClass = GuidProtocolPpiCommonClass()
ListClass.CName = Key[0]
ListClass.Guid = Key[1]
ListClass.SupArchList = Lists[Key]
ListMember.append(ListClass)
-
-
+
+
## GenLibraryClasses
#
# Gen LibraryClasses of Dec
@@ -414,7 +414,7 @@
# Get all Guids
#
RecordSet = self.RecordSet[MODEL_EFI_LIBRARY_CLASS]
-
+
#
# Go through each arch
#
@@ -432,7 +432,7 @@
where ID = %s""" % (self.TblDec.Table, ConvertToSqlString2(List[0]), ConvertToSqlString2(List[1]), SUP_MODULE_LIST_STRING, Record[3])
self.TblDec.Exec(SqlCommand)
-
+
for Key in LibraryClasses.keys():
LibraryClass = LibraryClassClass()
LibraryClass.LibraryClass = Key[0]
@@ -440,7 +440,7 @@
LibraryClass.SupModuleList = SUP_MODULE_LIST
LibraryClass.SupArchList = LibraryClasses[Key]
self.Package.LibraryClassDeclarations.append(LibraryClass)
-
+
## GenPcds
#
# Gen Pcds of Dec
@@ -460,7 +460,7 @@
RecordSet3 = self.RecordSet[MODEL_PCD_FEATURE_FLAG]
RecordSet4 = self.RecordSet[MODEL_PCD_DYNAMIC_EX]
RecordSet5 = self.RecordSet[MODEL_PCD_DYNAMIC]
-
+
#
# Go through each arch
#
@@ -508,7 +508,7 @@
Pcd.ItemType = Key[5]
Pcd.SupArchList = Pcds[Key]
self.Package.PcdDeclarations.append(Pcd)
-
+
## Show detailed information of Package
#
# Print all members and their values of Package class
@@ -550,14 +550,14 @@
if __name__ == '__main__':
EdkLogger.Initialize()
EdkLogger.SetLevel(EdkLogger.DEBUG_0)
-
+
W = os.getenv('WORKSPACE')
F = os.path.join(W, 'Nt32Pkg/Nt32Pkg.dec')
Db = Database.Database('Dec.db')
Db.InitDatabase()
-
+
P = Dec(os.path.normpath(F), True, True, W, Db)
P.ShowPackage()
-
+
Db.Close()
Modified: trunk/BaseTools/Source/Python/Common/DecClassObjectLight.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/DecClassObjectLight.py 2011-11-07 05:24:26 UTC (rev 2395)
+++ trunk/BaseTools/Source/Python/Common/DecClassObjectLight.py 2011-11-07 07:52:12 UTC (rev 2396)
@@ -75,7 +75,7 @@
# @var KeyList: To store value for KeyList, a list for all Keys used in Dec
#
class Dec(DecObject):
- def __init__(self, Filename = None, IsToPackage = False, WorkspaceDir = None, AllGuidVersionDict = None, SupArchList = DataType.ARCH_LIST):
+ def __init__(self, Filename=None, IsToPackage=False, WorkspaceDir=None, AllGuidVersionDict=None, SupArchList=DataType.ARCH_LIST):
self.Identification = IdentificationClass()
self.Package = PackageClass()
self.UserExtensions = ''
@@ -92,23 +92,23 @@
]
# Upper all KEYs to ignore case sensitive when parsing
self.KeyList = map(lambda c: c.upper(), self.KeyList)
-
+
# Init RecordSet
- self.RecordSet = {}
+ self.RecordSet = {}
for Key in self.KeyList:
self.RecordSet[Section[Key]] = []
-
+
# Init Comment
self.SectionHeaderCommentDict = {}
-
+
# Load Dec file if filename is not None
if Filename != None:
self.LoadDecFile(Filename)
-
+
# Transfer to Package Object if IsToPackage is True
if IsToPackage:
self.DecToPackage()
-
+
## Load Dec file
#
# Load the file if it exists
@@ -121,13 +121,13 @@
self.Identification.FullPath = Filename
(self.Identification.RelaPath, self.Identification.FileName) = os.path.split(Filename)
if self.Identification.FullPath.find(self.WorkspaceDir) > -1:
- self.Identification.PackagePath = os.path.dirname(self.Identification.FullPath[len(self.WorkspaceDir) + 1:])
-
+ self.Identification.PackagePath = os.path.dirname(self.Identification.FullPath[len(self.WorkspaceDir) + 1:])
+
# Init common datas
IfDefList, SectionItemList, CurrentSection, ArchList, ThirdList, IncludeFiles = \
[], [], TAB_UNKNOWN, [], [], []
LineNo = 0
-
+
# Parse file content
IsFindBlockComment = False
ReservedLine = ''
@@ -136,7 +136,7 @@
LineNo = LineNo + 1
# Remove comment block
if Line.find(TAB_COMMENT_EDK_START) > -1:
- ReservedLine = GetSplitValueList(Line, TAB_COMMENT_EDK_START, 1)[0]
+ ReservedLine = GetSplitList(Line, TAB_COMMENT_EDK_START, 1)[0]
if ReservedLine.strip().startswith(TAB_COMMENT_SPLIT):
Comment = Comment + Line.strip() + '\n'
ReservedLine = ''
@@ -147,7 +147,7 @@
continue
if Line.find(TAB_COMMENT_EDK_END) > -1:
Comment = Comment + Line[:Line.find(TAB_COMMENT_EDK_END) + len(TAB_COMMENT_EDK_END)] + '\n'
- Line = ReservedLine + GetSplitValueList(Line, TAB_COMMENT_EDK_END, 1)[1]
+ Line = ReservedLine + GetSplitList(Line, TAB_COMMENT_EDK_END, 1)[1]
ReservedLine = ''
IsFindBlockComment = False
if IsFindBlockComment:
@@ -160,7 +160,7 @@
Line = CleanString(Line)
if Line == '':
continue
-
+
## Find a new section tab
# First insert previous section items
# And then parse the content of the new section
@@ -173,7 +173,7 @@
SectionItemList = []
ArchList = []
ThirdList = []
-
+
CurrentSection = ''
LineList = GetSplitValueList(Line[len(TAB_SECTION_START):len(Line) - len(TAB_SECTION_END)], TAB_COMMA_SPLIT)
for Item in LineList:
@@ -182,7 +182,7 @@
CurrentSection = ItemList[0]
else:
if CurrentSection != ItemList[0]:
- EdkLogger.error("Parser", PARSER_ERROR, "Different section names '%s' and '%s' are found in one section definition, this is not allowed." % (CurrentSection, ItemList[0]), File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError)
+ EdkLogger.error("Parser", PARSER_ERROR, "Different section names '%s' and '%s' are found in one section definition, this is not allowed." % (CurrentSection, ItemList[0]), File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
if CurrentSection.upper() not in self.KeyList:
RaiseParserError(Line, CurrentSection, Filename, '', LineNo)
ItemList.append('')
@@ -191,28 +191,28 @@
RaiseParserError(Line, CurrentSection, Filename, '', LineNo)
else:
if ItemList[1] != '' and ItemList[1].upper() not in ARCH_LIST_FULL:
- EdkLogger.error("Parser", PARSER_ERROR, "Invalid Arch definition '%s' found" % ItemList[1], File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError)
+ EdkLogger.error("Parser", PARSER_ERROR, "Invalid Arch definition '%s' found" % ItemList[1], File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
ArchList.append(ItemList[1].upper())
ThirdList.append(ItemList[2])
-
+
if Comment:
if Comment.endswith('\n'):
Comment = Comment[:len(Comment) - len('\n')]
self.SectionHeaderCommentDict[Section[CurrentSection.upper()]] = Comment
Comment = ''
continue
-
+
# Not in any defined section
if CurrentSection == TAB_UNKNOWN:
ErrorMsg = "%s is not in any defined section" % Line
- EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, File=Filename, Line=LineNo, RaiseError = EdkLogger.IsRaiseError)
+ EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
# Add a section item
SectionItemList.append([Line, LineNo, Comment])
Comment = ''
# End of parse
#End of For
-
+
#
# Insert items data of last section
#
@@ -229,7 +229,7 @@
SectionHeaderCommentDict = {}
if Package == None:
return Dec
-
+
PackageHeader = Package.PackageHeader
TmpList = []
if PackageHeader.Name:
@@ -243,30 +243,30 @@
if Package.UserExtensions != None:
for Item in Package.UserExtensions.Defines:
TmpList.append(Item)
- DecList['Defines'] =TmpList
+ DecList['Defines'] = TmpList
if PackageHeader.Description != '':
SectionHeaderCommentDict['Defines'] = PackageHeader.Description
-
+
for Item in Package.Includes:
Key = 'Includes.' + Item.SupArchList
Value = Item.FilePath
GenMetaDatSectionItem(Key, Value, DecList)
-
+
for Item in Package.GuidDeclarations:
Key = 'Guids.' + Item.SupArchList
Value = Item.CName + '=' + Item.Guid
GenMetaDatSectionItem(Key, Value, DecList)
-
+
for Item in Package.ProtocolDeclarations:
Key = 'Protocols.' + Item.SupArchList
Value = Item.CName + '=' + Item.Guid
GenMetaDatSectionItem(Key, Value, DecList)
-
+
for Item in Package.PpiDeclarations:
Key = 'Ppis.' + Item.SupArchList
Value = Item.CName + '=' + Item.Guid
GenMetaDatSectionItem(Key, Value, DecList)
-
+
for Item in Package.LibraryClassDeclarations:
Key = 'LibraryClasses.' + Item.SupArchList
Value = Item.LibraryClass + '|' + Item.RecommendedInstance
@@ -297,7 +297,7 @@
else:
Dec = Dec + ' ' + Value + '\n'
Dec = Dec + '\n'
-
+
return Dec
## Transfer to Package Object
@@ -307,10 +307,10 @@
def DecToPackage(self):
# Init global information for the file
ContainerFile = self.Identification.FullPath
-
+
# Generate Package Header
self.GenPackageHeader(ContainerFile)
-
+
# Generate Includes
# Only for Edk
self.GenIncludes(ContainerFile)
@@ -323,16 +323,16 @@
# Generate Ppis
self.GenGuidProtocolPpis(DataType.TAB_PPIS, ContainerFile)
-
+
# Generate LibraryClasses
self.GenLibraryClasses(ContainerFile)
-
+
# Generate Pcds
self.GenPcds(ContainerFile)
-
+
# Init MiscFiles
self.GenMiscFiles(ContainerFile)
-
+
## GenMiscFiles
#
def GenMiscFiles(self, ContainerFile):
@@ -343,7 +343,7 @@
File.Filename = Item
MiscFiles.Files.append(File)
self.Package.MiscFiles = MiscFiles
-
+
## Get Package Header
#
# Gen Package Header of Dec as <Key> = <Value>
@@ -375,23 +375,23 @@
PackageHeader.DecSpecification = Value
else:
OtherDefines.append(Record[0])
-
+
PackageHeader.FileName = self.Identification.FileName
PackageHeader.FullPath = self.Identification.FullPath
PackageHeader.RelaPath = self.Identification.RelaPath
PackageHeader.PackagePath = self.Identification.PackagePath
PackageHeader.ModulePath = self.Identification.ModulePath
PackageHeader.CombinePath = os.path.normpath(os.path.join(PackageHeader.PackagePath, PackageHeader.ModulePath, PackageHeader.FileName))
-
+
if MODEL_META_DATA_HEADER in self.SectionHeaderCommentDict:
PackageHeader.Description = self.SectionHeaderCommentDict[MODEL_META_DATA_HEADER]
-
+
self.Package.PackageHeader = PackageHeader
UE = UserExtensionsClass()
UE.Defines = OtherDefines
self.Package.UserExtensions = UE
-
-
+
+
## GenIncludes
#
# Gen Includes of Dec
@@ -403,7 +403,7 @@
Includes = {}
# Get all Includes
RecordSet = self.RecordSet[MODEL_EFI_INCLUDE]
-
+
# Go through each arch
for Record in RecordSet:
Arch = Record[1]
@@ -412,7 +412,7 @@
Include.FilePath = NormPath(Key)
Include.SupArchList = Arch
self.Package.Includes.append(Include)
-
+
## GenPpis
#
# Gen Ppis of Dec
@@ -425,12 +425,12 @@
Lists = {}
# Get all Items
RecordSet = self.RecordSet[Section[Type.upper()]]
-
+
# Go through each arch
for Record in RecordSet:
Arch = Record[1]
(Name, Value) = GetGuidsProtocolsPpisOfDec(Record[0], Type, ContainerFile, Record[2])
-
+
ListMember = None
if Type == TAB_GUIDS:
ListMember = self.Package.GuidDeclarations
@@ -438,13 +438,13 @@
ListMember = self.Package.ProtocolDeclarations
elif Type == TAB_PPIS:
ListMember = self.Package.PpiDeclarations
-
+
ListClass = GuidProtocolPpiCommonClass()
ListClass.CName = Name
ListClass.Guid = Value
ListClass.SupArchList = Arch
ListMember.append(ListClass)
-
+
## GenLibraryClasses
#
# Gen LibraryClasses of Dec
@@ -457,7 +457,7 @@
LibraryClasses = {}
# Get all Guids
RecordSet = self.RecordSet[MODEL_EFI_LIBRARY_CLASS]
-
+
# Go through each arch
for Record in RecordSet:
Arch = Record[1]
@@ -469,7 +469,7 @@
LibraryClass.RecommendedInstance = NormPath(List[1])
LibraryClass.SupArchList = Arch
self.Package.LibraryClassDeclarations.append(LibraryClass)
-
+
def AddPcd(self, CName, Token, TokenSpaceGuidCName, DatumType, DefaultValue, ItemType, Arch):
Pcd = CommonClass.PcdClass()
Pcd.CName = CName
@@ -480,7 +480,7 @@
Pcd.ItemType = ItemType
Pcd.SupArchList = Arch
self.Package.PcdDeclarations.append(Pcd)
-
+
## GenPcds
#
# Gen Pcds of Dec
@@ -498,7 +498,7 @@
RecordSet3 = self.RecordSet[MODEL_PCD_FEATURE_FLAG]
RecordSet4 = self.RecordSet[MODEL_PCD_DYNAMIC_EX]
RecordSet5 = self.RecordSet[MODEL_PCD_DYNAMIC]
-
+
# Go through each pcd
for Record in RecordSet1:
Arch = Record[1]
@@ -520,7 +520,7 @@
Arch = Record[1]
(TokenGuidCName, TokenName, DefaultValue, DatumType, Token, ItemType) = GetPcdOfDec(Record[0], TAB_PCDS_DYNAMIC, ContainerFile, Record[2])
self.AddPcd(TokenName, Token, TokenGuidCName, DatumType, DefaultValue, ItemType, Arch)
-
+
## Show detailed information of Package
#
# Print all members and their values of Package class
@@ -533,7 +533,7 @@
print 'PackagePath =', M.PackageHeader.PackagePath
print 'ModulePath =', M.PackageHeader.ModulePath
print 'CombinePath =', M.PackageHeader.CombinePath
-
+
print 'BaseName =', M.PackageHeader.Name
print 'Guid =', M.PackageHeader.Guid
print 'Version =', M.PackageHeader.Version
@@ -571,7 +571,7 @@
if __name__ == '__main__':
EdkLogger.Initialize()
EdkLogger.SetLevel(EdkLogger.QUIET)
-
+
W = os.getenv('WORKSPACE')
F = os.path.join(W, 'MdeModulePkg/MdeModulePkg.dec')
Modified: trunk/BaseTools/Source/Python/Common/DscClassObject.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/DscClassObject.py 2011-11-07 05:24:26 UTC (rev 2395)
+++ trunk/BaseTools/Source/Python/Common/DscClassObject.py 2011-11-07 07:52:12 UTC (rev 2396)
@@ -91,7 +91,7 @@
class Dsc(DscObject):
_NullClassIndex = 0
- def __init__(self, Filename = None, IsToDatabase = False, IsToPlatform = False, WorkspaceDir = None, Database = None):
+ def __init__(self, Filename=None, IsToDatabase=False, IsToPlatform=False, WorkspaceDir=None, Database=None):
self.Identification = Identification()
self.Platform = PlatformClass()
self.UserExtensions = ''
@@ -460,7 +460,7 @@
# @param Type: The type of Pcd
# @param ContainerFile: The file which describes the pcd, used for error report
#
- def GenPcds(self, Type = '', ContainerFile = ''):
+ def GenPcds(self, Type='', ContainerFile=''):
Pcds = {}
if Type == DataType.TAB_PCDS_PATCHABLE_IN_MODULE:
Model = MODEL_PCD_PATCHABLE_IN_MODULE
@@ -512,7 +512,7 @@
# @param Type: The type of Pcd
# @param ContainerFile: The file which describes the pcd, used for error report
#
- def GenFeatureFlagPcds(self, Type = '', ContainerFile = ''):
+ def GenFeatureFlagPcds(self, Type='', ContainerFile=''):
Pcds = {}
if Type == DataType.TAB_PCDS_FEATURE_FLAG:
Model = MODEL_PCD_FEATURE_FLAG
@@ -562,7 +562,7 @@
# @param Type: The type of Pcd
# @param ContainerFile: The file which describes the pcd, used for error report
#
- def GenDynamicDefaultPcds(self, Type = '', ContainerFile = ''):
+ def GenDynamicDefaultPcds(self, Type='', ContainerFile=''):
Pcds = {}
SkuInfoList = {}
if Type == DataType.TAB_PCDS_DYNAMIC_DEFAULT:
@@ -594,20 +594,20 @@
if CleanString(NewItem) == '':
continue
(K1, K2, K3, K4, K5, K6) = GetDynamicDefaultPcd(NewItem, Type, Filename, -1)
- MergeArches(Pcds, (K1, K2, K3, K4, K5, K6, IncludeFile[4]), Arch)
+ MergeArches(Pcds, (K1, K2, K3, K4, K5, K6, IncludeFile[4]), Arch)
self.PcdToken[Record[3]] = (K2, K1)
for Record in RecordSet:
if Record[1] == Arch or Record[1] == TAB_ARCH_COMMON.upper():
(K1, K2, K3, K4, K5, K6) = GetDynamicDefaultPcd(Record[0], Type, ContainerFile, Record[2])
- MergeArches(Pcds, (K1, K2, K3, K4, K5, K6, Record[4]), Arch)
+ MergeArches(Pcds, (K1, K2, K3, K4, K5, K6, Record[4]), Arch)
self.PcdToken[Record[3]] = (K2, K1)
for Key in Pcds:
(Status, SkuInfoList) = self.GenSkuInfoList(Key[6], self.Platform.SkuInfos.SkuInfoList, '', '', '', '', '', Key[2])
if Status == False:
ErrorMsg = "The SKUID '%s' used in section '%s' is not defined in section [SkuIds]" % (SkuInfoList, Type)
- EdkLogger.error("DSC File Parser", PARSER_ERROR, ErrorMsg, ContainerFile, RaiseError = EdkLogger.IsRaiseError)
+ EdkLogger.error("DSC File Parser", PARSER_ERROR, ErrorMsg, ContainerFile, RaiseError=EdkLogger.IsRaiseError)
Pcd = PcdClass(Key[0], '', Key[1], Key[3], Key[4], Key[2], Key[5], [], SkuInfoList, [])
Pcd.SupArchList = Pcds[Key]
self.Platform.DynamicPcdBuildDefinitions.append(Pcd)
@@ -619,7 +619,7 @@
# @param Type: The type of Pcd
# @...
[truncated message content] |
|
From: <js...@us...> - 2011-11-08 03:17:34
|
Revision: 2398
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2398&view=rev
Author: jsu1
Date: 2011-11-08 03:17:25 +0000 (Tue, 08 Nov 2011)
Log Message:
-----------
Remove obsolete files used by draft packaging tool from repository.
Reviewed-by: hchen30
Signed-off-by: jsu1
Modified Paths:
--------------
trunk/BaseTools/Source/Python/Makefile
Removed Paths:
-------------
trunk/BaseTools/Source/Python/Common/DecClassObjectLight.py
trunk/BaseTools/Source/Python/Common/InfClassObjectLight.py
trunk/BaseTools/Source/Python/Common/XmlParser.py
trunk/BaseTools/Source/Python/Common/XmlRoutines.py
trunk/BaseTools/Source/Python/CommonDataClass/DistributionPackageClass.py
Deleted: trunk/BaseTools/Source/Python/Common/DecClassObjectLight.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/DecClassObjectLight.py 2011-11-08 02:06:00 UTC (rev 2397)
+++ trunk/BaseTools/Source/Python/Common/DecClassObjectLight.py 2011-11-08 03:17:25 UTC (rev 2398)
@@ -1,580 +0,0 @@
-## @file
-# This file is used to define each component of DEC file in light mode
-#
-# Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-
-##
-# Import Modules
-#
-import os
-from Misc import GetFiles
-from String import *
-from DataType import *
-from CommonDataClass.PackageClass import *
-from CommonDataClass import CommonClass
-from BuildToolError import *
-from Parsing import *
-
-# Global variable
-Section = {TAB_UNKNOWN.upper() : MODEL_UNKNOWN,
- TAB_DEC_DEFINES.upper() : MODEL_META_DATA_HEADER,
- TAB_INCLUDES.upper() : MODEL_EFI_INCLUDE,
- TAB_LIBRARY_CLASSES.upper() : MODEL_EFI_LIBRARY_CLASS,
- TAB_COMPONENTS.upper() : MODEL_META_DATA_COMPONENT,
- TAB_GUIDS.upper() : MODEL_EFI_GUID,
- TAB_PROTOCOLS.upper() : MODEL_EFI_PROTOCOL,
- TAB_PPIS.upper() : MODEL_EFI_PPI,
- TAB_PCDS_FIXED_AT_BUILD_NULL.upper() : MODEL_PCD_FIXED_AT_BUILD,
- TAB_PCDS_PATCHABLE_IN_MODULE_NULL.upper() : MODEL_PCD_PATCHABLE_IN_MODULE,
- TAB_PCDS_FEATURE_FLAG_NULL.upper() : MODEL_PCD_FEATURE_FLAG,
- TAB_PCDS_DYNAMIC_EX_NULL.upper() : MODEL_PCD_DYNAMIC_EX,
- TAB_PCDS_DYNAMIC_NULL.upper() : MODEL_PCD_DYNAMIC,
- TAB_USER_EXTENSIONS.upper() : MODEL_META_DATA_USER_EXTENSION
- }
-
-## DecObject
-#
-# This class defined basic Dec object which is used by inheriting
-#
-# @param object: Inherited from object class
-#
-class DecObject(object):
- def __init__(self):
- object.__init__()
-
-## Dec
-#
-# This class defined the structure used in Dec object
-#
-# @param DecObject: Inherited from DecObject class
-# @param Filename: Input value for Filename of Dec file, default is None
-# @param IsMergeAllArches: Input value for IsMergeAllArches
-# True is to merge all arches
-# Fales is not to merge all arches
-# default is False
-# @param IsToPackage: Input value for IsToPackage
-# True is to transfer to PackageObject automatically
-# False is not to transfer to PackageObject automatically
-# default is False
-# @param WorkspaceDir: Input value for current workspace directory, default is None
-#
-# @var Identification: To store value for Identification, it is a structure as Identification
-# @var Defines: To store value for Defines, it is a structure as DecDefines
-# @var UserExtensions: To store value for UserExtensions
-# @var Package: To store value for Package, it is a structure as PackageClass
-# @var WorkspaceDir: To store value for WorkspaceDir
-# @var Contents: To store value for Contents, it is a structure as DecContents
-# @var KeyList: To store value for KeyList, a list for all Keys used in Dec
-#
-class Dec(DecObject):
- def __init__(self, Filename=None, IsToPackage=False, WorkspaceDir=None, AllGuidVersionDict=None, SupArchList=DataType.ARCH_LIST):
- self.Identification = IdentificationClass()
- self.Package = PackageClass()
- self.UserExtensions = ''
- self.WorkspaceDir = WorkspaceDir
- self.SupArchList = SupArchList
- self.AllGuidVersionDict = {}
- if AllGuidVersionDict:
- self.AllGuidVersionDict = AllGuidVersionDict
-
- self.KeyList = [
- TAB_INCLUDES, TAB_GUIDS, TAB_PROTOCOLS, TAB_PPIS, TAB_LIBRARY_CLASSES, \
- TAB_PCDS_FIXED_AT_BUILD_NULL, TAB_PCDS_PATCHABLE_IN_MODULE_NULL, TAB_PCDS_FEATURE_FLAG_NULL, \
- TAB_PCDS_DYNAMIC_NULL, TAB_PCDS_DYNAMIC_EX_NULL, TAB_DEC_DEFINES
- ]
- # Upper all KEYs to ignore case sensitive when parsing
- self.KeyList = map(lambda c: c.upper(), self.KeyList)
-
- # Init RecordSet
- self.RecordSet = {}
- for Key in self.KeyList:
- self.RecordSet[Section[Key]] = []
-
- # Init Comment
- self.SectionHeaderCommentDict = {}
-
- # Load Dec file if filename is not None
- if Filename != None:
- self.LoadDecFile(Filename)
-
- # Transfer to Package Object if IsToPackage is True
- if IsToPackage:
- self.DecToPackage()
-
- ## Load Dec file
- #
- # Load the file if it exists
- #
- # @param Filename: Input value for filename of Dec file
- #
- def LoadDecFile(self, Filename):
- # Insert a record for file
- Filename = NormPath(Filename)
- self.Identification.FullPath = Filename
- (self.Identification.RelaPath, self.Identification.FileName) = os.path.split(Filename)
- if self.Identification.FullPath.find(self.WorkspaceDir) > -1:
- self.Identification.PackagePath = os.path.dirname(self.Identification.FullPath[len(self.WorkspaceDir) + 1:])
-
- # Init common datas
- IfDefList, SectionItemList, CurrentSection, ArchList, ThirdList, IncludeFiles = \
- [], [], TAB_UNKNOWN, [], [], []
- LineNo = 0
-
- # Parse file content
- IsFindBlockComment = False
- ReservedLine = ''
- Comment = ''
- for Line in open(Filename, 'r'):
- LineNo = LineNo + 1
- # Remove comment block
- if Line.find(TAB_COMMENT_EDK_START) > -1:
- ReservedLine = GetSplitList(Line, TAB_COMMENT_EDK_START, 1)[0]
- if ReservedLine.strip().startswith(TAB_COMMENT_SPLIT):
- Comment = Comment + Line.strip() + '\n'
- ReservedLine = ''
- else:
- Comment = Comment + Line[len(ReservedLine):] + '\n'
- IsFindBlockComment = True
- if not ReservedLine:
- continue
- if Line.find(TAB_COMMENT_EDK_END) > -1:
- Comment = Comment + Line[:Line.find(TAB_COMMENT_EDK_END) + len(TAB_COMMENT_EDK_END)] + '\n'
- Line = ReservedLine + GetSplitList(Line, TAB_COMMENT_EDK_END, 1)[1]
- ReservedLine = ''
- IsFindBlockComment = False
- if IsFindBlockComment:
- Comment = Comment + Line.strip() + '\n'
- continue
-
- # Remove comments at tail and remove spaces again
- if Line.strip().startswith(TAB_COMMENT_SPLIT) or Line.strip().startswith('--/'):
- Comment = Comment + Line.strip() + '\n'
- Line = CleanString(Line)
- if Line == '':
- continue
-
- ## Find a new section tab
- # First insert previous section items
- # And then parse the content of the new section
- #
- if Line.startswith(TAB_SECTION_START) and Line.endswith(TAB_SECTION_END):
- # Insert items data of previous section
- Model = Section[CurrentSection.upper()]
- InsertSectionItems(Model, CurrentSection, SectionItemList, ArchList, ThirdList, self.RecordSet)
- # Parse the new section
- SectionItemList = []
- ArchList = []
- ThirdList = []
-
- CurrentSection = ''
- LineList = GetSplitValueList(Line[len(TAB_SECTION_START):len(Line) - len(TAB_SECTION_END)], TAB_COMMA_SPLIT)
- for Item in LineList:
- ItemList = GetSplitValueList(Item, TAB_SPLIT)
- if CurrentSection == '':
- CurrentSection = ItemList[0]
- else:
- if CurrentSection != ItemList[0]:
- EdkLogger.error("Parser", PARSER_ERROR, "Different section names '%s' and '%s' are found in one section definition, this is not allowed." % (CurrentSection, ItemList[0]), File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
- if CurrentSection.upper() not in self.KeyList:
- RaiseParserError(Line, CurrentSection, Filename, '', LineNo)
- ItemList.append('')
- ItemList.append('')
- if len(ItemList) > 5:
- RaiseParserError(Line, CurrentSection, Filename, '', LineNo)
- else:
- if ItemList[1] != '' and ItemList[1].upper() not in ARCH_LIST_FULL:
- EdkLogger.error("Parser", PARSER_ERROR, "Invalid Arch definition '%s' found" % ItemList[1], File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
- ArchList.append(ItemList[1].upper())
- ThirdList.append(ItemList[2])
-
- if Comment:
- if Comment.endswith('\n'):
- Comment = Comment[:len(Comment) - len('\n')]
- self.SectionHeaderCommentDict[Section[CurrentSection.upper()]] = Comment
- Comment = ''
- continue
-
- # Not in any defined section
- if CurrentSection == TAB_UNKNOWN:
- ErrorMsg = "%s is not in any defined section" % Line
- EdkLogger.error("Parser", PARSER_ERROR, ErrorMsg, File=Filename, Line=LineNo, RaiseError=EdkLogger.IsRaiseError)
-
- # Add a section item
- SectionItemList.append([Line, LineNo, Comment])
- Comment = ''
- # End of parse
- #End of For
-
- #
- # Insert items data of last section
- #
- Model = Section[CurrentSection.upper()]
- InsertSectionItems(Model, CurrentSection, SectionItemList, ArchList, ThirdList, self.RecordSet)
- if Comment != '':
- self.SectionHeaderCommentDict[Model] = Comment
- Comment = ''
-
- ## Package Object to DEC file
- def PackageToDec(self, Package):
- Dec = ''
- DecList = sdict()
- SectionHeaderCommentDict = {}
- if Package == None:
- return Dec
-
- PackageHeader = Package.PackageHeader
- TmpList = []
- if PackageHeader.Name:
- TmpList.append(TAB_DEC_DEFINES_PACKAGE_NAME + ' = ' + PackageHeader.Name)
- if PackageHeader.Guid:
- TmpList.append(TAB_DEC_DEFINES_PACKAGE_GUID + ' = ' + PackageHeader.Guid)
- if PackageHeader.Version:
- TmpList.append(TAB_DEC_DEFINES_PACKAGE_VERSION + ' = ' + PackageHeader.Version)
- if PackageHeader.DecSpecification:
- TmpList.append(TAB_DEC_DEFINES_DEC_SPECIFICATION + ' = ' + PackageHeader.DecSpecification)
- if Package.UserExtensions != None:
- for Item in Package.UserExtensions.Defines:
- TmpList.append(Item)
- DecList['Defines'] = TmpList
- if PackageHeader.Description != '':
- SectionHeaderCommentDict['Defines'] = PackageHeader.Description
-
- for Item in Package.Includes:
- Key = 'Includes.' + Item.SupArchList
- Value = Item.FilePath
- GenMetaDatSectionItem(Key, Value, DecList)
-
- for Item in Package.GuidDeclarations:
- Key = 'Guids.' + Item.SupArchList
- Value = Item.CName + '=' + Item.Guid
- GenMetaDatSectionItem(Key, Value, DecList)
-
- for Item in Package.ProtocolDeclarations:
- Key = 'Protocols.' + Item.SupArchList
- Value = Item.CName + '=' + Item.Guid
- GenMetaDatSectionItem(Key, Value, DecList)
-
- for Item in Package.PpiDeclarations:
- Key = 'Ppis.' + Item.SupArchList
- Value = Item.CName + '=' + Item.Guid
- GenMetaDatSectionItem(Key, Value, DecList)
-
- for Item in Package.LibraryClassDeclarations:
- Key = 'LibraryClasses.' + Item.SupArchList
- Value = Item.LibraryClass + '|' + Item.RecommendedInstance
- GenMetaDatSectionItem(Key, Value, DecList)
-
- for Item in Package.PcdDeclarations:
- Key = 'Pcds' + Item.ItemType + '.' + Item.SupArchList
- Value = Item.TokenSpaceGuidCName + '.' + Item.CName
- if Item.DefaultValue != '':
- Value = Value + '|' + Item.DefaultValue
- if Item.DatumType != '':
- Value = Value + '|' + Item.DatumType
- if Item.Token != '':
- Value = Value + '|' + Item.Token
- GenMetaDatSectionItem(Key, Value, DecList)
-
- # Transfer Package to Inf
- for Key in DecList:
- if Key in SectionHeaderCommentDict:
- List = SectionHeaderCommentDict[Key].split('\r')
- for Item in List:
- Dec = Dec + Item + '\n'
- Dec = Dec + '[' + Key + ']' + '\n'
- for Value in DecList[Key]:
- if type(Value) == type([]):
- for SubValue in Value:
- Dec = Dec + ' ' + SubValue + '\n'
- else:
- Dec = Dec + ' ' + Value + '\n'
- Dec = Dec + '\n'
-
- return Dec
-
- ## Transfer to Package Object
- #
- # Transfer all contents of a Dec file to a standard Package Object
- #
- def DecToPackage(self):
- # Init global information for the file
- ContainerFile = self.Identification.FullPath
-
- # Generate Package Header
- self.GenPackageHeader(ContainerFile)
-
- # Generate Includes
- # Only for Edk
- self.GenIncludes(ContainerFile)
-
- # Generate Guids
- self.GenGuidProtocolPpis(DataType.TAB_GUIDS, ContainerFile)
-
- # Generate Protocols
- self.GenGuidProtocolPpis(DataType.TAB_PROTOCOLS, ContainerFile)
-
- # Generate Ppis
- self.GenGuidProtocolPpis(DataType.TAB_PPIS, ContainerFile)
-
- # Generate LibraryClasses
- self.GenLibraryClasses(ContainerFile)
-
- # Generate Pcds
- self.GenPcds(ContainerFile)
-
- # Init MiscFiles
- self.GenMiscFiles(ContainerFile)
-
- ## GenMiscFiles
- #
- def GenMiscFiles(self, ContainerFile):
- MiscFiles = MiscFileClass()
- MiscFiles.Name = 'ModuleFiles'
- for Item in GetFiles(os.path.dirname(ContainerFile), ['CVS', '.svn'], False):
- File = CommonClass.FileClass()
- File.Filename = Item
- MiscFiles.Files.append(File)
- self.Package.MiscFiles = MiscFiles
-
- ## Get Package Header
- #
- # Gen Package Header of Dec as <Key> = <Value>
- #
- # @param ContainerFile: The Dec file full path
- #
- def GenPackageHeader(self, ContainerFile):
- EdkLogger.debug(2, "Generate PackageHeader ...")
- #
- # Update all defines item in database
- #
- RecordSet = self.RecordSet[MODEL_META_DATA_HEADER]
- PackageHeader = PackageHeaderClass()
- OtherDefines = []
- for Record in RecordSet:
- ValueList = GetSplitValueList(Record[0], TAB_EQUAL_SPLIT)
- if len(ValueList) != 2:
- OtherDefines.append(Record[0])
- else:
- Name = ValueList[0]
- Value = ValueList[1]
- if Name == TAB_DEC_DEFINES_PACKAGE_NAME:
- PackageHeader.Name = Value
- elif Name == TAB_DEC_DEFINES_PACKAGE_GUID:
- PackageHeader.Guid = Value
- elif Name == TAB_DEC_DEFINES_PACKAGE_VERSION:
- PackageHeader.Version = Value
- elif Name == TAB_DEC_DEFINES_DEC_SPECIFICATION:
- PackageHeader.DecSpecification = Value
- else:
- OtherDefines.append(Record[0])
-
- PackageHeader.FileName = self.Identification.FileName
- PackageHeader.FullPath = self.Identification.FullPath
- PackageHeader.RelaPath = self.Identification.RelaPath
- PackageHeader.PackagePath = self.Identification.PackagePath
- PackageHeader.ModulePath = self.Identification.ModulePath
- PackageHeader.CombinePath = os.path.normpath(os.path.join(PackageHeader.PackagePath, PackageHeader.ModulePath, PackageHeader.FileName))
-
- if MODEL_META_DATA_HEADER in self.SectionHeaderCommentDict:
- PackageHeader.Description = self.SectionHeaderCommentDict[MODEL_META_DATA_HEADER]
-
- self.Package.PackageHeader = PackageHeader
- UE = UserExtensionsClass()
- UE.Defines = OtherDefines
- self.Package.UserExtensions = UE
-
-
- ## GenIncludes
- #
- # Gen Includes of Dec
- #
- # @param ContainerFile: The Dec file full path
- #
- def GenIncludes(self, ContainerFile):
- EdkLogger.debug(2, "Generate %s ..." % TAB_INCLUDES)
- Includes = {}
- # Get all Includes
- RecordSet = self.RecordSet[MODEL_EFI_INCLUDE]
-
- # Go through each arch
- for Record in RecordSet:
- Arch = Record[1]
- Key = Record[0]
- Include = IncludeClass()
- Include.FilePath = NormPath(Key)
- Include.SupArchList = Arch
- self.Package.Includes.append(Include)
-
- ## GenPpis
- #
- # Gen Ppis of Dec
- # <CName>=<GuidValue>
- #
- # @param ContainerFile: The Dec file full path
- #
- def GenGuidProtocolPpis(self, Type, ContainerFile):
- EdkLogger.debug(2, "Generate %s ..." % Type)
- Lists = {}
- # Get all Items
- RecordSet = self.RecordSet[Section[Type.upper()]]
-
- # Go through each arch
- for Record in RecordSet:
- Arch = Record[1]
- (Name, Value) = GetGuidsProtocolsPpisOfDec(Record[0], Type, ContainerFile, Record[2])
-
- ListMember = None
- if Type == TAB_GUIDS:
- ListMember = self.Package.GuidDeclarations
- elif Type == TAB_PROTOCOLS:
- ListMember = self.Package.ProtocolDeclarations
- elif Type == TAB_PPIS:
- ListMember = self.Package.PpiDeclarations
-
- ListClass = GuidProtocolPpiCommonClass()
- ListClass.CName = Name
- ListClass.Guid = Value
- ListClass.SupArchList = Arch
- ListMember.append(ListClass)
-
- ## GenLibraryClasses
- #
- # Gen LibraryClasses of Dec
- # <CName>=<GuidValue>
- #
- # @param ContainerFile: The Dec file full path
- #
- def GenLibraryClasses(self, ContainerFile):
- EdkLogger.debug(2, "Generate %s ..." % TAB_LIBRARY_CLASSES)
- LibraryClasses = {}
- # Get all Guids
- RecordSet = self.RecordSet[MODEL_EFI_LIBRARY_CLASS]
-
- # Go through each arch
- for Record in RecordSet:
- Arch = Record[1]
- List = GetSplitValueList(Record[0], DataType.TAB_VALUE_SPLIT)
- if len(List) != 2:
- continue
- LibraryClass = LibraryClassClass()
- LibraryClass.LibraryClass = List[0]
- LibraryClass.RecommendedInstance = NormPath(List[1])
- LibraryClass.SupArchList = Arch
- self.Package.LibraryClassDeclarations.append(LibraryClass)
-
- def AddPcd(self, CName, Token, TokenSpaceGuidCName, DatumType, DefaultValue, ItemType, Arch):
- Pcd = CommonClass.PcdClass()
- Pcd.CName = CName
- Pcd.Token = Token
- Pcd.TokenSpaceGuidCName = TokenSpaceGuidCName
- Pcd.DatumType = DatumType
- Pcd.DefaultValue = DefaultValue
- Pcd.ItemType = ItemType
- Pcd.SupArchList = Arch
- self.Package.PcdDeclarations.append(Pcd)
-
- ## GenPcds
- #
- # Gen Pcds of Dec
- # <TokenSpcCName>.<TokenCName>|<Value>|<DatumType>|<Token>
- #
- # @param ContainerFile: The Dec file full path
- #
- def GenPcds(self, ContainerFile):
- EdkLogger.debug(2, "Generate %s ..." % TAB_PCDS)
- Pcds = {}
- PcdToken = {}
- # Get all Pcds
- RecordSet1 = self.RecordSet[MODEL_PCD_FIXED_AT_BUILD]
- RecordSet2 = self.RecordSet[MODEL_PCD_PATCHABLE_IN_MODULE]
- RecordSet3 = self.RecordSet[MODEL_PCD_FEATURE_FLAG]
- RecordSet4 = self.RecordSet[MODEL_PCD_DYNAMIC_EX]
- RecordSet5 = self.RecordSet[MODEL_PCD_DYNAMIC]
-
- # Go through each pcd
- for Record in RecordSet1:
- Arch = Record[1]
- (TokenGuidCName, TokenName, DefaultValue, DatumType, Token, ItemType) = GetPcdOfDec(Record[0], TAB_PCDS_FIXED_AT_BUILD, ContainerFile, Record[2])
- self.AddPcd(TokenName, Token, TokenGuidCName, DatumType, DefaultValue, ItemType, Arch)
- for Record in RecordSet2:
- Arch = Record[1]
- (TokenGuidCName, TokenName, DefaultValue, DatumType, Token, ItemType) = GetPcdOfDec(Record[0], TAB_PCDS_PATCHABLE_IN_MODULE, ContainerFile, Record[2])
- self.AddPcd(TokenName, Token, TokenGuidCName, DatumType, DefaultValue, ItemType, Arch)
- for Record in RecordSet3:
- Arch = Record[1]
- (TokenGuidCName, TokenName, DefaultValue, DatumType, Token, ItemType) = GetPcdOfDec(Record[0], TAB_PCDS_FEATURE_FLAG, ContainerFile, Record[2])
- self.AddPcd(TokenName, Token, TokenGuidCName, DatumType, DefaultValue, ItemType, Arch)
- for Record in RecordSet4:
- Arch = Record[1]
- (TokenGuidCName, TokenName, DefaultValue, DatumType, Token, ItemType) = GetPcdOfDec(Record[0], TAB_PCDS_DYNAMIC_EX, ContainerFile, Record[2])
- self.AddPcd(TokenName, Token, TokenGuidCName, DatumType, DefaultValue, ItemType, Arch)
- for Record in RecordSet5:
- Arch = Record[1]
- (TokenGuidCName, TokenName, DefaultValue, DatumType, Token, ItemType) = GetPcdOfDec(Record[0], TAB_PCDS_DYNAMIC, ContainerFile, Record[2])
- self.AddPcd(TokenName, Token, TokenGuidCName, DatumType, DefaultValue, ItemType, Arch)
-
- ## Show detailed information of Package
- #
- # Print all members and their values of Package class
- #
- def ShowPackage(self):
- M = self.Package
- print 'Filename =', M.PackageHeader.FileName
- print 'FullPath =', M.PackageHeader.FullPath
- print 'RelaPath =', M.PackageHeader.RelaPath
- print 'PackagePath =', M.PackageHeader.PackagePath
- print 'ModulePath =', M.PackageHeader.ModulePath
- print 'CombinePath =', M.PackageHeader.CombinePath
-
- print 'BaseName =', M.PackageHeader.Name
- print 'Guid =', M.PackageHeader.Guid
- print 'Version =', M.PackageHeader.Version
- print 'DecSpecification =', M.PackageHeader.DecSpecification
-
- print '\nIncludes ='#, M.Includes
- for Item in M.Includes:
- print Item.FilePath, Item.SupArchList
- print '\nGuids ='#, M.GuidDeclarations
- for Item in M.GuidDeclarations:
- print Item.CName, Item.Guid, Item.SupArchList
- print '\nProtocols ='#, M.ProtocolDeclarations
- for Item in M.ProtocolDeclarations:
- print Item.CName, Item.Guid, Item.SupArchList
- print '\nPpis ='#, M.PpiDeclarations
- for Item in M.PpiDeclarations:
- print Item.CName, Item.Guid, Item.SupArchList
- print '\nLibraryClasses ='#, M.LibraryClassDeclarations
- for Item in M.LibraryClassDeclarations:
- print Item.LibraryClass, Item.RecommendedInstance, Item.SupModuleList, Item.SupArchList
- print '\nPcds ='#, M.PcdDeclarations
- for Item in M.PcdDeclarations:
- print 'CName=', Item.CName, 'TokenSpaceGuidCName=', Item.TokenSpaceGuidCName, 'DefaultValue=', Item.DefaultValue, 'ItemType=', Item.ItemType, 'Token=', Item.Token, 'DatumType=', Item.DatumType, Item.SupArchList
- print '\nUserExtensions =', M.UserExtensions.Defines
- print '\n*** FileList ***'
- for Item in M.MiscFiles.Files:
- print Item.Filename
- print '****************\n'
-
-##
-#
-# This acts like the main() function for the script, unless it is 'import'ed into another
-# script.
-#
-if __name__ == '__main__':
- EdkLogger.Initialize()
- EdkLogger.SetLevel(EdkLogger.QUIET)
-
- W = os.getenv('WORKSPACE')
- F = os.path.join(W, 'MdeModulePkg/MdeModulePkg.dec')
-
- P = Dec(os.path.normpath(F), True, W)
- P.ShowPackage()
- print P.PackageToDec(P.Package)
Deleted: trunk/BaseTools/Source/Python/Common/InfClassObjectLight.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/InfClassObjectLight.py 2011-11-08 02:06:00 UTC (rev 2397)
+++ trunk/BaseTools/Source/Python/Common/InfClassObjectLight.py 2011-11-08 03:17:25 UTC (rev 2398)
@@ -1,877 +0,0 @@
-## @file
-# This file is used to define each component of INF file
-#
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-
-##
-# Import Modules
-#
-import os
-import re
-import EdkLogger
-
-from CommonDataClass.ModuleClass import *
-from CommonDataClass import CommonClass
-from String import *
-from DataType import *
-from BuildToolError import *
-from Misc import sdict
-from Misc import GetFiles
-from Parsing import *
-
-# Global variable
-Section = {TAB_UNKNOWN.upper() : MODEL_UNKNOWN,
- TAB_INF_DEFINES.upper() : MODEL_META_DATA_HEADER,
- TAB_BUILD_OPTIONS.upper() : MODEL_META_DATA_BUILD_OPTION,
- TAB_INCLUDES.upper() : MODEL_EFI_INCLUDE,
- TAB_LIBRARIES.upper() : MODEL_EFI_LIBRARY_INSTANCE,
- TAB_LIBRARY_CLASSES.upper() : MODEL_EFI_LIBRARY_CLASS,
- TAB_PACKAGES.upper() : MODEL_META_DATA_PACKAGE,
- TAB_NMAKE.upper() : MODEL_META_DATA_NMAKE,
- TAB_INF_FIXED_PCD.upper() : MODEL_PCD_FIXED_AT_BUILD,
- TAB_INF_PATCH_PCD.upper() : MODEL_PCD_PATCHABLE_IN_MODULE,
- TAB_INF_FEATURE_PCD.upper() : MODEL_PCD_FEATURE_FLAG,
- TAB_INF_PCD_EX.upper() : MODEL_PCD_DYNAMIC_EX,
- TAB_INF_PCD.upper() : MODEL_PCD_DYNAMIC,
- TAB_SOURCES.upper() : MODEL_EFI_SOURCE_FILE,
- TAB_GUIDS.upper() : MODEL_EFI_GUID,
- TAB_PROTOCOLS.upper() : MODEL_EFI_PROTOCOL,
- TAB_PPIS.upper() : MODEL_EFI_PPI,
- TAB_DEPEX.upper() : MODEL_EFI_DEPEX,
- TAB_BINARIES.upper() : MODEL_EFI_BINARY_FILE,
- TAB_USER_EXTENSIONS.upper() : MODEL_META_DATA_USER_EXTENSION
- }
-
-gComponentType2ModuleType = {
- "LIBRARY" : "BASE",
- "SECURITY_CORE" : "SEC",
- "PEI_CORE" : "PEI_CORE",
- "COMBINED_PEIM_DRIVER" : "PEIM",
- "PIC_PEIM" : "PEIM",
- "RELOCATABLE_PEIM" : "PEIM",
- "PE32_PEIM" : "PEIM",
- "BS_DRIVER" : "DXE_DRIVER",
- "RT_DRIVER" : "DXE_RUNTIME_DRIVER",
- "SAL_RT_DRIVER" : "DXE_SAL_DRIVER",
- "APPLICATION" : "UEFI_APPLICATION",
- "LOGO" : "BASE",
-}
-
-class InfHeader(ModuleHeaderClass):
- _Mapping_ = {
- # Required Fields
- TAB_INF_DEFINES_BASE_NAME : "Name",
- TAB_INF_DEFINES_FILE_GUID : "Guid",
- TAB_INF_DEFINES_MODULE_TYPE : "ModuleType",
- TAB_INF_DEFINES_EFI_SPECIFICATION_VERSION : "UefiSpecificationVersion",
- TAB_INF_DEFINES_UEFI_SPECIFICATION_VERSION : "UefiSpecificationVersion",
- TAB_INF_DEFINES_EDK_RELEASE_VERSION : "EdkReleaseVersion",
-
- # Optional Fields
- TAB_INF_DEFINES_INF_VERSION : "InfVersion",
- TAB_INF_DEFINES_BINARY_MODULE : "BinaryModule",
- TAB_INF_DEFINES_COMPONENT_TYPE : "ComponentType",
- TAB_INF_DEFINES_MAKEFILE_NAME : "MakefileName",
- TAB_INF_DEFINES_BUILD_NUMBER : "BuildNumber",
- TAB_INF_DEFINES_BUILD_TYPE : "BuildType",
- TAB_INF_DEFINES_FFS_EXT : "FfsExt",
- TAB_INF_DEFINES_FV_EXT : "FvExt",
- TAB_INF_DEFINES_SOURCE_FV : "SourceFv",
- TAB_INF_DEFINES_VERSION_NUMBER : "VersionNumber",
- TAB_INF_DEFINES_VERSION_STRING : "VersionString",
- TAB_INF_DEFINES_VERSION : "Version",
- TAB_INF_DEFINES_PCD_IS_DRIVER : "PcdIsDriver",
- TAB_INF_DEFINES_TIANO_EDK_...
[truncated message content] |
|
From: <gi...@us...> - 2011-11-09 07:45:35
|
Revision: 2403
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2403&view=rev
Author: gikidy
Date: 2011-11-09 07:45:29 +0000 (Wed, 09 Nov 2011)
Log Message:
-----------
Update code to support using global defined MACROs in path after !include.
During check whether include file exist, will check both at directory under WORKSPACE and directory same with DSC file. If two copies exist both in WORKSPACE directory and directory same with DSC file, will use the later one.
For !include used in FDF file, will search include file first from the directory same with FDF file and then from the directory same with DSC file, at last will search include file under WORKSPACE directory.
Signed-off-by: gikidy
Reviewed-by: jsu1
Reviewed-by:djboyer
Modified Paths:
--------------
trunk/BaseTools/Source/Python/GenFds/FdfParser.py
trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py
Modified: trunk/BaseTools/Source/Python/GenFds/FdfParser.py
===================================================================
--- trunk/BaseTools/Source/Python/GenFds/FdfParser.py 2011-11-09 05:13:43 UTC (rev 2402)
+++ trunk/BaseTools/Source/Python/GenFds/FdfParser.py 2011-11-09 07:45:29 UTC (rev 2403)
@@ -50,6 +50,7 @@
import Common.GlobalData as GlobalData
from Common.Expression import *
from Common import GlobalData
+from Common.String import ReplaceMacro
import re
import os
@@ -528,26 +529,36 @@
if not self.__GetNextToken():
raise Warning("expected include file name", self.FileName, self.CurrentLineNumber)
IncFileName = self.__Token
- if not os.path.isabs(IncFileName):
- if IncFileName.startswith('$(WORKSPACE)'):
- Str = IncFileName.replace('$(WORKSPACE)', os.environ.get('WORKSPACE'))
- if os.path.exists(Str):
- if not os.path.isabs(Str):
- Str = os.path.abspath(Str)
- IncFileName = Str
- else:
- # 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)
+ __IncludeMacros = {}
+ __IncludeMacros['WORKSPACE'] = InputMacroDict['WORKSPACE']
+ __IncludeMacros['ECP_SOURCE'] = InputMacroDict['ECP_SOURCE']
+ __IncludeMacros['EFI_SOURCE'] = InputMacroDict['EFI_SOURCE']
+ __IncludeMacros['EDK_SOURCE'] = InputMacroDict['EDK_SOURCE']
+
+ IncludedFile = NormPath(ReplaceMacro(IncFileName, __IncludeMacros, RaiseError=True))
+ #
+ # First search the include file under the same directory as FDF file
+ #
+ IncludedFile1 = PathClass(IncludedFile, os.path.dirname(self.FileName))
+ ErrorCode = IncludedFile1.Validate()[0]
+ if ErrorCode != 0:
+ #
+ # Then search the include file under the same directory as DSC file
+ #
+ IncludedFile1 = PathClass(IncludedFile, GenFdsGlobalVariable.ActivePlatform.Dir)
+ ErrorCode = IncludedFile1.Validate()[0]
+ if ErrorCode != 0:
+ #
+ # Also search file under the WORKSPACE directory
+ #
+ IncludedFile1 = PathClass(IncludedFile, GlobalData.gWorkspace)
+ ErrorCode = IncludedFile1.Validate()[0]
+ if ErrorCode != 0:
+ raise Warning("The include file does not exist under below directories: \n%s\n%s\n%s\n"%(os.path.dirname(self.FileName), GenFdsGlobalVariable.ActivePlatform.Dir, GlobalData.gWorkspace),
+ self.FileName, self.CurrentLineNumber)
- IncFileName = os.path.join(os.path.dirname(FullFdf), IncFileName)
+ IncFileProfile = IncludeFileProfile(IncludedFile1.Path)
- if not os.path.exists(os.path.normpath(IncFileName)):
- raise Warning("Include file not exists", self.FileName, self.CurrentLineNumber)
-
- IncFileProfile = IncludeFileProfile(os.path.normpath(IncFileName))
-
CurrentLine = self.CurrentLineNumber
CurrentOffset = self.CurrentOffsetWithinLine
# list index of the insertion, note that line number is 'CurrentLine + 1'
Modified: trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py
===================================================================
--- trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py 2011-11-09 05:13:43 UTC (rev 2402)
+++ trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py 2011-11-09 07:45:29 UTC (rev 2403)
@@ -1247,19 +1247,41 @@
MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF]:
break
elif self._ItemType == MODEL_META_DATA_INCLUDE:
- # The included file must be relative to workspace
- IncludedFile = NormPath(ReplaceMacro(self._ValueList[1], self._Macros, RaiseError=True))
- IncludedFile = PathClass(IncludedFile, GlobalData.gWorkspace)
- ErrorCode, ErrorInfo = IncludedFile.Validate()
+ # The included file must be relative to workspace or same directory as DSC file
+ __IncludeMacros = {}
+ #
+ # Allow using system environment variables in path after !include
+ #
+ __IncludeMacros['WORKSPACE'] = GlobalData.gGlobalDefines['WORKSPACE']
+ __IncludeMacros['ECP_SOURCE'] = GlobalData.gGlobalDefines['ECP_SOURCE']
+ __IncludeMacros['EFI_SOURCE'] = GlobalData.gGlobalDefines['EFI_SOURCE']
+ __IncludeMacros['EDK_SOURCE'] = GlobalData.gGlobalDefines['EDK_SOURCE']
+ #
+ # Allow using MACROs comes from [Defines] section to keep compatible.
+ #
+ __IncludeMacros.update(self._Macros)
+
+ IncludedFile = NormPath(ReplaceMacro(self._ValueList[1], __IncludeMacros, RaiseError=True))
+ #
+ # First search the include file under the same directory as DSC file
+ #
+ IncludedFile1 = PathClass(IncludedFile, self.MetaFile.Dir)
+ ErrorCode, ErrorInfo1 = IncludedFile1.Validate()
if ErrorCode != 0:
- EdkLogger.error('parser', ErrorCode, File=self._FileWithError,
- Line=self._LineIndex+1, ExtraData=ErrorInfo)
+ #
+ # Also search file under the WORKSPACE directory
+ #
+ IncludedFile1 = PathClass(IncludedFile, GlobalData.gWorkspace)
+ ErrorCode, ErrorInfo2 = IncludedFile1.Validate()
+ if ErrorCode != 0:
+ EdkLogger.error('parser', ErrorCode, File=self._FileWithError,
+ Line=self._LineIndex+1, ExtraData=ErrorInfo1 + "\n"+ ErrorInfo2)
- self._FileWithError = IncludedFile
+ self._FileWithError = IncludedFile1
- IncludedFileTable = MetaFileStorage(self._Table.Cur, IncludedFile, MODEL_FILE_DSC, False)
+ IncludedFileTable = MetaFileStorage(self._Table.Cur, IncludedFile1, MODEL_FILE_DSC, False)
Owner = self._Content[self._ContentIndex-1][0]
- Parser = DscParser(IncludedFile, self._FileType, IncludedFileTable,
+ Parser = DscParser(IncludedFile1, self._FileType, IncludedFileTable,
Owner=Owner, From=Owner)
# set the parser status with current status
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <xf...@us...> - 2011-11-17 07:28:20
|
Revision: 2412
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2412&view=rev
Author: xfzyr
Date: 2011-11-17 07:28:13 +0000 (Thu, 17 Nov 2011)
Log Message:
-----------
Update UPT to resolve No module named Common.BuildVersion in UPT Tool.
Reviewed-by:hchen30
Signed-off-by:yzeng15
Modified Paths:
--------------
trunk/BaseTools/Source/Python/Makefile
trunk/BaseTools/Source/Python/UPT/Makefile
trunk/BaseTools/Source/Python/UPT/UPT.py
Added Paths:
-----------
trunk/BaseTools/Source/Python/UPT/BuildVersion.py
Modified: trunk/BaseTools/Source/Python/Makefile
===================================================================
--- trunk/BaseTools/Source/Python/Makefile 2011-11-17 06:53:01 UTC (rev 2411)
+++ trunk/BaseTools/Source/Python/Makefile 2011-11-17 07:28:13 UTC (rev 2412)
@@ -61,6 +61,7 @@
$(BASE_TOOLS_PATH)\Source\Python\Autogen\UniClassObject.py \
$(BASE_TOOLS_PATH)\Source\Python\Autogen\__init__.py
+UPT_BUILDVERSION_PYTHON=$(BASE_TOOLS_PATH)\Source\Python\UPT\BuildVersion.py
all: SetPythonPath $(APPLICATIONS)
@@ -100,7 +101,7 @@
$(BIN_DIR)\BPDG.exe: $(BASE_TOOLS_PATH)\Source\Python\BPDG\BPDG.py $(COMMON_PYTHON)
@pushd . & @cd BPDG & @$(FREEZE) --include-modules=$(MODULES) --install-dir=$(BIN_DIR) BPDG.py & @popd
-$(BIN_DIR)\UPT.exe: $(BASE_TOOLS_PATH)\Source\Python\UPT\UPT.py $(BASE_TOOLS_PATH)\Source\Python\UPT\UPT.py $(COMMON_PYTHON)
+$(BIN_DIR)\UPT.exe: $(BASE_TOOLS_PATH)\Source\Python\UPT\UPT.py $(UPT_BUILDVERSION_PYTHON)
@pushd . & @cd UPT & @$(FREEZE) --include-modules=$(MODULES) --install-dir=$(BIN_DIR) UPT.py & @popd
clean:
Added: trunk/BaseTools/Source/Python/UPT/BuildVersion.py
===================================================================
--- trunk/BaseTools/Source/Python/UPT/BuildVersion.py (rev 0)
+++ trunk/BaseTools/Source/Python/UPT/BuildVersion.py 2011-11-17 07:28:13 UTC (rev 2412)
@@ -0,0 +1,3 @@
+#This file is for build version number auto generation
+#
+gBUILD_VERSION = ""
Modified: trunk/BaseTools/Source/Python/UPT/Makefile
===================================================================
--- trunk/BaseTools/Source/Python/UPT/Makefile 2011-11-17 06:53:01 UTC (rev 2411)
+++ trunk/BaseTools/Source/Python/UPT/Makefile 2011-11-17 07:28:13 UTC (rev 2412)
@@ -24,14 +24,14 @@
APPLICATIONS=$(BIN_DIR)\UPT.exe
-COMMON_PYTHON=$(SOURCES_PATH)\UPT.py
+UPT_BUILDVERSION_PYTHON=$(SOURCES_PATH)\BuildVersion.py
all: SetPythonPath $(APPLICATIONS)
SetPythonPath:
set PYTHONPATH= $(SOURCES_PATH)
-$(BIN_DIR)\UPT.exe: $(SOURCES_PATH)\UPT.py $(COMMON_PYTHON)
+$(BIN_DIR)\UPT.exe: $(SOURCES_PATH)\UPT.py $(UPT_BUILDVERSION_PYTHON)
@pushd . & @cd build & @$(FREEZE) --include-modules=$(MODULES) --install-dir=$(BIN_DIR) UPT.py & @popd
@pushd . & @copy .\Dll\sqlite3.dll .\Bin\Sqlite3.dll & @popd
clean:
Modified: trunk/BaseTools/Source/Python/UPT/UPT.py
===================================================================
--- trunk/BaseTools/Source/Python/UPT/UPT.py 2011-11-17 06:53:01 UTC (rev 2411)
+++ trunk/BaseTools/Source/Python/UPT/UPT.py 2011-11-17 07:28:13 UTC (rev 2412)
@@ -43,7 +43,7 @@
from Library.Misc import CheckEnvVariable
from Library import GlobalData
from Core.IpiDb import IpiDatabase
-from Common.BuildVersion import gBUILD_VERSION
+from BuildVersion import gBUILD_VERSION
##
# Version and Copyright
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gi...@us...> - 2011-11-24 08:16:41
|
Revision: 2431
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2431&view=rev
Author: gikidy
Date: 2011-11-24 08:16:34 +0000 (Thu, 24 Nov 2011)
Log Message:
-----------
Support use expression as DSC file PCD value.
Signed-off-by: gikidy
Reviewed-by: lgao4
Reviewed-by: jsu1
Reviewed-by: yingke
Modified Paths:
--------------
trunk/BaseTools/Source/Python/AutoGen/GenC.py
trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py
Modified: trunk/BaseTools/Source/Python/AutoGen/GenC.py
===================================================================
--- trunk/BaseTools/Source/Python/AutoGen/GenC.py 2011-11-24 08:13:23 UTC (rev 2430)
+++ trunk/BaseTools/Source/Python/AutoGen/GenC.py 2011-11-24 08:16:34 UTC (rev 2431)
@@ -971,9 +971,9 @@
if Pcd.DatumType == 'BOOLEAN':
BoolValue = Value.upper()
- if BoolValue == 'TRUE':
+ if BoolValue == 'TRUE' or BoolValue == '1':
Value = '1U'
- elif BoolValue == 'FALSE':
+ elif BoolValue == 'FALSE' or BoolValue == '0':
Value = '0U'
if Pcd.DatumType in ['UINT64', 'UINT32', 'UINT16', 'UINT8']:
Modified: trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py
===================================================================
--- trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py 2011-11-24 08:13:23 UTC (rev 2430)
+++ trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py 2011-11-24 08:16:34 UTC (rev 2431)
@@ -1332,12 +1332,26 @@
def __ProcessPcd(self):
ValueList = GetSplitValueList(self._ValueList[2])
+ #
+ # PCD value can be an expression
+ #
if len(ValueList) > 1 and ValueList[1] == 'VOID*':
- PcdValue = ValueList[0]
- ValueList[0] = ReplaceMacro(PcdValue, self._Macros)
+ PcdValue = ValueList[0]
+ try:
+ ValueList[0] = ValueExpression(PcdValue, self._Macros)(True)
+ except WrnExpression, Value:
+ ValueList[0] = Value.result
else:
PcdValue = ValueList[-1]
- ValueList[-1] = ReplaceMacro(PcdValue, self._Macros)
+ try:
+ ValueList[-1] = ValueExpression(PcdValue, self._Macros)(True)
+ except WrnExpression, Value:
+ ValueList[-1] = Value.result
+
+ if ValueList[-1] == 'True':
+ ValueList[-1] = '1'
+ if ValueList[-1] == 'False':
+ ValueList[-1] = '0'
self._ValueList[2] = '|'.join(ValueList)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gi...@us...> - 2011-11-28 10:25:14
|
Revision: 2439
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2439&view=rev
Author: gikidy
Date: 2011-11-28 10:25:03 +0000 (Mon, 28 Nov 2011)
Log Message:
-----------
Fix a bug if there is VPD type PCD exist in platform build will break during generate VPD data file.
Signed-off-by: gikidy
Reviewed-by: yingke
Reviewed-by: jsu1
Modified Paths:
--------------
trunk/BaseTools/Source/Python/AutoGen/AutoGen.py
trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py
Modified: trunk/BaseTools/Source/Python/AutoGen/AutoGen.py
===================================================================
--- trunk/BaseTools/Source/Python/AutoGen/AutoGen.py 2011-11-28 08:28:12 UTC (rev 2438)
+++ trunk/BaseTools/Source/Python/AutoGen/AutoGen.py 2011-11-28 10:25:03 UTC (rev 2439)
@@ -960,8 +960,7 @@
"Fail to get FLASH_DEFINITION definition in DSC file %s which is required when DSC contains VPD PCD." % str(self.Platform.MetaFile))
if VpdFile.GetCount() != 0:
- WorkspaceDb = self.BuildDatabase.WorkspaceDb
- DscTimeStamp = WorkspaceDb.GetTimeStamp(WorkspaceDb.GetFileId(str(self.Platform.MetaFile)))
+ DscTimeStamp = self.Platform.MetaFile.TimeStamp
FvPath = os.path.join(self.BuildDir, "FV")
if not os.path.exists(FvPath):
try:
Modified: trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py
===================================================================
--- trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py 2011-11-28 08:28:12 UTC (rev 2438)
+++ trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py 2011-11-28 10:25:03 UTC (rev 2439)
@@ -1321,6 +1321,7 @@
self._ValueList[1] = ReplaceMacro(self._ValueList[1], self._Macros, RaiseError=True)
def __ProcessPcd(self):
+ PcdValue = None
ValueList = GetSplitValueList(self._ValueList[2])
#
# PCD value can be an expression
@@ -1332,16 +1333,31 @@
except WrnExpression, Value:
ValueList[0] = Value.result
else:
- PcdValue = ValueList[-1]
- try:
- ValueList[-1] = ValueExpression(PcdValue, self._Macros)(True)
- except WrnExpression, Value:
- ValueList[-1] = Value.result
-
- if ValueList[-1] == 'True':
- ValueList[-1] = '1'
- if ValueList[-1] == 'False':
- ValueList[-1] = '0'
+ #
+ # Int*/Boolean VPD PCD
+ # TokenSpace | PcdCName | Offset | [Value]
+ #
+ # VOID* VPD PCD
+ # TokenSpace | PcdCName | Offset | [Size] | [Value]
+ #
+ if self._ItemType == MODEL_PCD_DYNAMIC_VPD:
+ if len(ValueList) >= 4:
+ PcdValue = ValueList[-1]
+ else:
+ PcdValue = ValueList[-1]
+ #
+ # For the VPD PCD, there may not have PcdValue data in DSC file
+ #
+ if PcdValue:
+ try:
+ ValueList[-1] = ValueExpression(PcdValue, self._Macros)(True)
+ except WrnExpression, Value:
+ ValueList[-1] = Value.result
+
+ if ValueList[-1] == 'True':
+ ValueList[-1] = '1'
+ if ValueList[-1] == 'False':
+ ValueList[-1] = '0'
self._ValueList[2] = '|'.join(ValueList)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <yi...@us...> - 2011-11-29 03:23:21
|
Revision: 2440
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2440&view=rev
Author: yingke
Date: 2011-11-29 03:23:15 +0000 (Tue, 29 Nov 2011)
Log Message:
-----------
Fix bug to make sure the FD name is correct in report file.
Signed-off-by: yingke
Reviewed-by: jsu1
Modified Paths:
--------------
trunk/BaseTools/Source/Python/AutoGen/AutoGen.py
trunk/BaseTools/Source/Python/Common/GlobalData.py
trunk/BaseTools/Source/Python/GenFds/FdfParser.py
Modified: trunk/BaseTools/Source/Python/AutoGen/AutoGen.py
===================================================================
--- trunk/BaseTools/Source/Python/AutoGen/AutoGen.py 2011-11-28 10:25:03 UTC (rev 2439)
+++ trunk/BaseTools/Source/Python/AutoGen/AutoGen.py 2011-11-29 03:23:15 UTC (rev 2440)
@@ -184,6 +184,7 @@
self.MetaFile = ActivePlatform
self.WorkspaceDir = WorkspaceDir
self.Platform = self.BuildDatabase[self.MetaFile, 'COMMON', Target, Toolchain]
+ GlobalData.gPlatformName = self.Platform.PlatformName
self.BuildTarget = Target
self.ToolChain = Toolchain
self.ArchList = ArchList
Modified: trunk/BaseTools/Source/Python/Common/GlobalData.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/GlobalData.py 2011-11-28 10:25:03 UTC (rev 2439)
+++ trunk/BaseTools/Source/Python/Common/GlobalData.py 2011-11-29 03:23:15 UTC (rev 2440)
@@ -26,6 +26,7 @@
gGlobalDefines = {}
gPlatformDefines = {}
+gPlatformName = ''
gCommandLineDefines = {}
gEdkGlobal = {}
gOverrideDir = {}
Modified: trunk/BaseTools/Source/Python/GenFds/FdfParser.py
===================================================================
--- trunk/BaseTools/Source/Python/GenFds/FdfParser.py 2011-11-28 10:25:03 UTC (rev 2439)
+++ trunk/BaseTools/Source/Python/GenFds/FdfParser.py 2011-11-29 03:23:15 UTC (rev 2440)
@@ -1359,6 +1359,8 @@
if FdName == "":
if len (self.Profile.FdDict) == 0:
FdName = GenFdsGlobalVariable.PlatformName
+ if FdName == "":
+ FdName = GlobalData.gPlatformName
self.Profile.FdNameNotSet = True
else:
raise Warning("expected FdName in [FD.] section", self.FileName, self.CurrentLineNumber)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <yi...@us...> - 2011-12-01 06:14:31
|
Revision: 2450
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2450&view=rev
Author: yingke
Date: 2011-12-01 06:14:24 +0000 (Thu, 01 Dec 2011)
Log Message:
-----------
Fix FDF include directive bugs.
Signed-off-by: yingke
Reviewed-by: jsu1
Modified Paths:
--------------
trunk/BaseTools/Source/Python/AutoGen/AutoGen.py
trunk/BaseTools/Source/Python/Common/GlobalData.py
trunk/BaseTools/Source/Python/GenFds/FdfParser.py
Modified: trunk/BaseTools/Source/Python/AutoGen/AutoGen.py
===================================================================
--- trunk/BaseTools/Source/Python/AutoGen/AutoGen.py 2011-12-01 01:21:56 UTC (rev 2449)
+++ trunk/BaseTools/Source/Python/AutoGen/AutoGen.py 2011-12-01 06:14:24 UTC (rev 2450)
@@ -184,7 +184,7 @@
self.MetaFile = ActivePlatform
self.WorkspaceDir = WorkspaceDir
self.Platform = self.BuildDatabase[self.MetaFile, 'COMMON', Target, Toolchain]
- GlobalData.gPlatformName = self.Platform.PlatformName
+ GlobalData.gActivePlatform = self.Platform
self.BuildTarget = Target
self.ToolChain = Toolchain
self.ArchList = ArchList
Modified: trunk/BaseTools/Source/Python/Common/GlobalData.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/GlobalData.py 2011-12-01 01:21:56 UTC (rev 2449)
+++ trunk/BaseTools/Source/Python/Common/GlobalData.py 2011-12-01 06:14:24 UTC (rev 2450)
@@ -26,7 +26,7 @@
gGlobalDefines = {}
gPlatformDefines = {}
-gPlatformName = ''
+gActivePlatform = None
gCommandLineDefines = {}
gEdkGlobal = {}
gOverrideDir = {}
Modified: trunk/BaseTools/Source/Python/GenFds/FdfParser.py
===================================================================
--- trunk/BaseTools/Source/Python/GenFds/FdfParser.py 2011-12-01 01:21:56 UTC (rev 2449)
+++ trunk/BaseTools/Source/Python/GenFds/FdfParser.py 2011-12-01 06:14:24 UTC (rev 2450)
@@ -567,12 +567,17 @@
raise Warning("expected include file name", self.FileName, self.CurrentLineNumber)
IncFileName = self.__Token
__IncludeMacros = {}
- __IncludeMacros['WORKSPACE'] = self.__GetMacroValue('WORKSPACE')
- __IncludeMacros['ECP_SOURCE'] = self.__GetMacroValue('ECP_SOURCE')
- __IncludeMacros['EFI_SOURCE'] = self.__GetMacroValue('EFI_SOURCE')
- __IncludeMacros['EDK_SOURCE'] = self.__GetMacroValue('EDK_SOURCE')
-
- IncludedFile = NormPath(ReplaceMacro(IncFileName, __IncludeMacros, RaiseError=True))
+ for Macro in ['WORKSPACE', 'ECP_SOURCE', 'EFI_SOURCE', 'EDK_SOURCE']:
+ MacroVal = self.__GetMacroValue(Macro)
+ if MacroVal:
+ __IncludeMacros[Macro] = MacroVal
+
+ try:
+ IncludedFile = NormPath(ReplaceMacro(IncFileName, __IncludeMacros, RaiseError=True))
+ except:
+ raise Warning("only these system environment variables are permitted to start the path of the included file: "
+ "$(WORKSPACE), $(ECP_SOURCE), $(EFI_SOURCE), $(EDK_SOURCE)",
+ self.FileName, self.CurrentLineNumber)
#
# First search the include file under the same directory as FDF file
#
@@ -582,7 +587,12 @@
#
# Then search the include file under the same directory as DSC file
#
- IncludedFile1 = PathClass(IncludedFile, GenFdsGlobalVariable.ActivePlatform.Dir)
+ PlatformDir = ''
+ if GenFdsGlobalVariable.ActivePlatform:
+ PlatformDir = GenFdsGlobalVariable.ActivePlatform.Dir
+ elif GlobalData.gActivePlatform:
+ PlatformDir = GlobalData.gActivePlatform.MetaFile.Dir
+ IncludedFile1 = PathClass(IncludedFile, PlatformDir)
ErrorCode = IncludedFile1.Validate()[0]
if ErrorCode != 0:
#
@@ -591,7 +601,7 @@
IncludedFile1 = PathClass(IncludedFile, GlobalData.gWorkspace)
ErrorCode = IncludedFile1.Validate()[0]
if ErrorCode != 0:
- raise Warning("The include file does not exist under below directories: \n%s\n%s\n%s\n"%(os.path.dirname(self.FileName), GenFdsGlobalVariable.ActivePlatform.Dir, GlobalData.gWorkspace),
+ raise Warning("The include file does not exist under below directories: \n%s\n%s\n%s\n"%(os.path.dirname(self.FileName), PlatformDir, GlobalData.gWorkspace),
self.FileName, self.CurrentLineNumber)
IncFileProfile = IncludeFileProfile(IncludedFile1.Path)
@@ -660,9 +670,9 @@
continue
# Replace macros except in RULE section or out of section
elif self.__CurSection and ReplacedLine != self.CurrentLineNumber:
+ ReplacedLine = self.CurrentLineNumber
self.__UndoToken()
- ReplacedLine = self.CurrentLineNumber
- CurLine = self.Profile.FileLinesList[self.CurrentLineNumber - 1]
+ CurLine = self.Profile.FileLinesList[ReplacedLine - 1]
PreIndex = 0
StartPos = CurLine.find('$(', PreIndex)
EndPos = CurLine.find(')', StartPos+2)
@@ -679,7 +689,7 @@
PreIndex = EndPos + 1
StartPos = CurLine.find('$(', PreIndex)
EndPos = CurLine.find(')', StartPos+2)
- self.Profile.FileLinesList[self.CurrentLineNumber - 1] = CurLine
+ self.Profile.FileLinesList[ReplacedLine - 1] = CurLine
continue
if self.__Token == 'DEFINE':
@@ -947,7 +957,7 @@
# Record the token start position, the position of the first non-space char.
StartPos = self.CurrentOffsetWithinLine
StartLine = self.CurrentLineNumber
- while not self.__EndOfLine():
+ while StartLine == self.CurrentLineNumber:
TempChar = self.__CurrentChar()
# Try to find the end char that is not a space and not in seperator tuple.
# That is, when we got a space or any char in the tuple, we got the end of token.
@@ -1359,8 +1369,8 @@
if FdName == "":
if len (self.Profile.FdDict) == 0:
FdName = GenFdsGlobalVariable.PlatformName
- if FdName == "":
- FdName = GlobalData.gPlatformName
+ if FdName == "" and GlobalData.gActivePlatform:
+ FdName = GlobalData.gActivePlatform.PlatformName
self.Profile.FdNameNotSet = True
else:
raise Warning("expected FdName in [FD.] section", self.FileName, self.CurrentLineNumber)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <xf...@us...> - 2011-12-02 08:09:15
|
Revision: 2452
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2452&view=rev
Author: xfzyr
Date: 2011-12-02 08:09:03 +0000 (Fri, 02 Dec 2011)
Log Message:
-----------
1. Add Macro support feature for ECC.
2. Enhance the checkpoint for Library Class name must be specified in INF file.
Signed-off-by: yzeng15
Reviewed-by: hchen30
Modified Paths:
--------------
trunk/BaseTools/Source/Python/Common/Misc.py
trunk/BaseTools/Source/Python/Ecc/Check.py
trunk/BaseTools/Source/Python/Ecc/Database.py
trunk/BaseTools/Source/Python/Ecc/Ecc.py
trunk/BaseTools/Source/Python/GenFds/FdfParser.py
trunk/BaseTools/Source/Python/Table/TableFdf.py
trunk/BaseTools/Source/Python/Table/TableFile.py
Added Paths:
-----------
trunk/BaseTools/Source/Python/Ecc/MetaFileWorkspace/
trunk/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaDataTable.py
trunk/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
trunk/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileTable.py
trunk/BaseTools/Source/Python/Ecc/MetaFileWorkspace/__init__.py
Modified: trunk/BaseTools/Source/Python/Common/Misc.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/Misc.py 2011-12-02 02:52:33 UTC (rev 2451)
+++ trunk/BaseTools/Source/Python/Common/Misc.py 2011-12-02 08:09:03 UTC (rev 2452)
@@ -445,8 +445,10 @@
return NewFile[len(OverrideDir):], NewFile[0:len(OverrideDir)]
else:
return NewFile[len(OverrideDir)+1:], NewFile[0:len(OverrideDir)]
-
- NewFile = GlobalData.gAllFiles[os.path.normpath(os.path.join(Dir, File))]
+ if GlobalData.gAllFiles:
+ NewFile = GlobalData.gAllFiles[os.path.normpath(os.path.join(Dir, File))]
+ else:
+ NewFile = os.path.normpath(os.path.join(Dir, File))
if NewFile:
if Dir:
if Dir[-1] == os.path.sep:
Modified: trunk/BaseTools/Source/Python/Ecc/Check.py
===================================================================
--- trunk/BaseTools/Source/Python/Ecc/Check.py 2011-12-02 02:52:33 UTC (rev 2451)
+++ trunk/BaseTools/Source/Python/Ecc/Check.py 2011-12-02 08:09:03 UTC (rev 2452)
@@ -49,7 +49,7 @@
if EccGlobalData.gConfig.GeneralCheckNonAcsii == '1' or EccGlobalData.gConfig.GeneralCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
EdkLogger.quiet("Checking Non-ACSII char in file ...")
SqlCommand = """select ID, FullPath, ExtName from File"""
- RecordSet = EccGlobalData.gDb.TblInf.Exec(SqlCommand)
+ RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
for Record in RecordSet:
if Record[2].upper() not in EccGlobalData.gConfig.BinaryExtList:
op = open(Record[1]).readlines()
@@ -573,9 +573,9 @@
def MetaDataFileCheckLibraryInstance(self):
if EccGlobalData.gConfig.MetaDataFileCheckLibraryInstance == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
EdkLogger.quiet("Checking for library instance type issue ...")
- SqlCommand = """select A.ID, A.Value2, B.Value2 from Inf as A left join Inf as B
- where A.Value1 = 'LIBRARY_CLASS' and A.Model = %s
- and B.Value1 = 'MODULE_TYPE' and B.Model = %s and A.BelongsToFile = B.BelongsToFile
+ SqlCommand = """select A.ID, A.Value3, B.Value3 from Inf as A left join Inf as B
+ where A.Value2 = 'LIBRARY_CLASS' and A.Model = %s
+ and B.Value2 = 'MODULE_TYPE' and B.Model = %s and A.BelongsToFile = B.BelongsToFile
group by A.BelongsToFile""" % (MODEL_META_DATA_HEADER, MODEL_META_DATA_HEADER)
RecordSet = EccGlobalData.gDb.TblInf.Exec(SqlCommand)
LibraryClasses = {}
@@ -597,8 +597,8 @@
if Record[2] != 'BASE' and Record[2] not in SupModType:
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_INSTANCE_2, OtherMsg="The Library Class '%s' does not specify its supported module types" % (List[0]), BelongsToTable='Inf', BelongsToItem=Record[0])
- SqlCommand = """select A.ID, A.Value1, B.Value2 from Inf as A left join Inf as B
- where A.Model = %s and B.Value1 = '%s' and B.Model = %s
+ SqlCommand = """select A.ID, A.Value1, B.Value3 from Inf as A left join Inf as B
+ where A.Model = %s and B.Value2 = '%s' and B.Model = %s
and B.BelongsToFile = A.BelongsToFile""" \
% (MODEL_EFI_LIBRARY_CLASS, 'MODULE_TYPE', MODEL_META_DATA_HEADER)
RecordSet = EccGlobalData.gDb.TblInf.Exec(SqlCommand)
@@ -627,11 +627,13 @@
SqlCommand = """select ID, Value1, Value2 from Dsc where Model = %s""" % MODEL_EFI_LIBRARY_CLASS
LibraryClasses = EccGlobalData.gDb.TblDsc.Exec(SqlCommand)
for LibraryClass in LibraryClasses:
- if LibraryClass[1].upper() != 'NULL':
+ 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]))
- SqlCommand = """select Value2 from Inf where BelongsToFile =
+ SqlCommand = """select Value3 from Inf where BelongsToFile =
(select ID from File where lower(FullPath) = lower('%s'))
- and Value1 = '%s'""" % (LibraryIns, 'LIBRARY_CLASS')
+ and Value2 = '%s'""" % (LibraryIns, 'LIBRARY_CLASS')
RecordSet = EccGlobalData.gDb.TblInf.Exec(SqlCommand)
IsFound = False
for Record in RecordSet:
@@ -660,8 +662,8 @@
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_LIBRARY_NO_USE, OtherMsg="The Library Class [%s] is not used in any platform" % (Record[1]), BelongsToTable='Inf', BelongsToItem=Record[0])
SqlCommand = """
select A.ID, A.Value1, A.BelongsToFile, A.StartLine, B.StartLine from Dsc as A left join Dsc as B
- where A.Model = %s and B.Model = %s and A.Value3 = B.Value3 and A.Arch = B.Arch and A.ID <> B.ID
- and A.Value1 = B.Value1 and A.Value2 <> B.Value2 and A.StartLine <> B.StartLine and B.BelongsToFile = A.BelongsToFile""" \
+ where A.Model = %s and B.Model = %s and A.Scope1 = B.Scope1 and A.Scope2 = B.Scope2 and A.ID <> B.ID
+ and A.Value1 = B.Value1 and A.Value2 <> B.Value2 and A.BelongsToItem = -1 and B.BelongsToItem = -1 and A.StartLine <> B.StartLine and B.BelongsToFile = A.BelongsToFile""" \
% (MODEL_EFI_LIBRARY_CLASS, MODEL_EFI_LIBRARY_CLASS)
RecordSet = EccGlobalData.gDb.TblDsc.Exec(SqlCommand)
for Record in RecordSet:
@@ -700,9 +702,10 @@
if EccGlobalData.gConfig.MetaDataFileCheckPcdDuplicate == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
EdkLogger.quiet("Checking for duplicate PCDs defined in both DSC and FDF files ...")
SqlCommand = """
- select A.ID, A.Value2, A.BelongsToFile, B.ID, B.Value2, B.BelongsToFile from Dsc as A, Fdf as B
+ select A.ID, A.Value1, A.Value2, A.BelongsToFile, B.ID, B.Value1, B.Value2, B.BelongsToFile from Dsc as A, Fdf as B
where A.Model >= %s and A.Model < %s
and B.Model >= %s and B.Model < %s
+ and A.Value1 = B.Value1
and A.Value2 = B.Value2
and A.Enabled > -1
and B.Enabled > -1
@@ -710,71 +713,74 @@
""" % (MODEL_PCD, MODEL_META_DATA_HEADER, MODEL_PCD, MODEL_META_DATA_HEADER)
RecordSet = EccGlobalData.gDb.TblDsc.Exec(SqlCommand)
for Record in RecordSet:
- SqlCommand1 = """select Name from File where ID = %s""" % Record[2]
- SqlCommand2 = """select Name from File where ID = %s""" % Record[5]
+ SqlCommand1 = """select Name from File where ID = %s""" % Record[3]
+ SqlCommand2 = """select Name from File where ID = %s""" % Record[7]
DscFileName = os.path.splitext(EccGlobalData.gDb.TblDsc.Exec(SqlCommand1)[0][0])[0]
FdfFileName = os.path.splitext(EccGlobalData.gDb.TblDsc.Exec(SqlCommand2)[0][0])[0]
if DscFileName != FdfFileName:
continue
- if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, Record[1]):
- EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, OtherMsg="The PCD [%s] is defined in both FDF file and DSC file" % (Record[1]), BelongsToTable='Dsc', BelongsToItem=Record[0])
- if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, Record[3]):
- EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, OtherMsg="The PCD [%s] is defined in both FDF file and DSC file" % (Record[4]), BelongsToTable='Fdf', BelongsToItem=Record[3])
+ if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, Record[1] + '.' + Record[2]):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, OtherMsg="The PCD [%s] is defined in both FDF file and DSC file" % (Record[1] + '.' + Record[2]), BelongsToTable='Dsc', BelongsToItem=Record[0])
+ if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, Record[5] + '.' + Record[6]):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, OtherMsg="The PCD [%s] is defined in both FDF file and DSC file" % (Record[5] + '.' + Record[6]), BelongsToTable='Fdf', BelongsToItem=Record[4])
EdkLogger.quiet("Checking for duplicate PCDs defined in DEC files ...")
SqlCommand = """
- select A.ID, A.Value2 from Dec as A, Dec as B
+ select A.ID, A.Value1, A.Value2, A.Model, B.Model from Dec as A left join Dec as B
where A.Model >= %s and A.Model < %s
and B.Model >= %s and B.Model < %s
+ and A.Value1 = B.Value1
and A.Value2 = B.Value2
- and ((A.Arch = B.Arch) and (A.Arch != 'COMMON' or B.Arch != 'COMMON'))
- and A.ID != B.ID
+ and A.Scope1 = B.Scope1
+ and A.ID <> B.ID
+ and A.Model = B.Model
and A.Enabled > -1
and B.Enabled > -1
and A.BelongsToFile = B.BelongsToFile
group by A.ID
""" % (MODEL_PCD, MODEL_META_DATA_HEADER, MODEL_PCD, MODEL_META_DATA_HEADER)
- RecordSet = EccGlobalData.gDb.TblDsc.Exec(SqlCommand)
+ RecordSet = EccGlobalData.gDb.TblDec.Exec(SqlCommand)
for Record in RecordSet:
- if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, Record[1]):
- EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, OtherMsg="The PCD [%s] is defined duplicated in DEC file" % (Record[1]), BelongsToTable='Dec', BelongsToItem=Record[0])
+ RecordCat = Record[1] + '.' + Record[2]
+ if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, RecordCat):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, OtherMsg="The PCD [%s] is defined duplicated in DEC file" % RecordCat, BelongsToTable='Dec', BelongsToItem=Record[0])
# Check whether PCD settings in the FDF file can only be related to flash.
def MetaDataFileCheckPcdFlash(self):
if EccGlobalData.gConfig.MetaDataFileCheckPcdFlash == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
EdkLogger.quiet("Checking only Flash related PCDs are used in FDF ...")
SqlCommand = """
- select ID, Value2, BelongsToFile from Fdf as A
+ select ID, Value1, Value2, BelongsToFile from Fdf as A
where A.Model >= %s and Model < %s
and A.Enabled > -1
and A.Value2 not like '%%Flash%%'
""" % (MODEL_PCD, MODEL_META_DATA_HEADER)
RecordSet = EccGlobalData.gDb.TblFdf.Exec(SqlCommand)
for Record in RecordSet:
- if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_FLASH, Record[1]):
- EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_FLASH, OtherMsg="The PCD [%s] defined in FDF file is not related to Flash" % (Record[1]), BelongsToTable='Fdf', BelongsToItem=Record[0])
+ if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_FLASH, Record[1] + '.' + Record[2]):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_FLASH, OtherMsg="The PCD [%s] defined in FDF file is not related to Flash" % (Record[1] + '.' + Record[2]), BelongsToTable='Fdf', BelongsToItem=Record[0])
# Check whether PCDs used in Inf files but not specified in Dsc or FDF files
def MetaDataFileCheckPcdNoUse(self):
if EccGlobalData.gConfig.MetaDataFileCheckPcdNoUse == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
EdkLogger.quiet("Checking for non-specified PCDs ...")
SqlCommand = """
- select ID, Value2, BelongsToFile from Inf as A
+ select ID, Value1, Value2, BelongsToFile from Inf as A
where A.Model >= %s and Model < %s
and A.Enabled > -1
- and A.Value2 not in
- (select Value2 from Dsc as B
+ and (A.Value1, A.Value2) not in
+ (select Value1, Value2 from Dsc as B
where B.Model >= %s and B.Model < %s
and B.Enabled > -1)
- and A.Value2 not in
- (select Value2 from Fdf as C
+ and (A.Value1, A.Value2) not in
+ (select Value1, Value2 from Fdf as C
where C.Model >= %s and C.Model < %s
and C.Enabled > -1)
""" % (MODEL_PCD, MODEL_META_DATA_HEADER, MODEL_PCD, MODEL_META_DATA_HEADER, MODEL_PCD, MODEL_META_DATA_HEADER)
RecordSet = EccGlobalData.gDb.TblInf.Exec(SqlCommand)
for Record in RecordSet:
- if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_NO_USE, Record[1]):
- EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_NO_USE, OtherMsg="The PCD [%s] defined in INF file is not specified in either DSC or FDF files" % (Record[1]), BelongsToTable='Inf', BelongsToItem=Record[0])
+ if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_NO_USE, Record[1] + '.' + Record[2]):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_NO_USE, OtherMsg="The PCD [%s] defined in INF file is not specified in either DSC or FDF files" % (Record[1] + '.' + Record[2]), BelongsToTable='Inf', BelongsToItem=Record[0])
# Check whether having duplicate guids defined for Guid/Protocol/Ppi
def MetaDataFileCheckGuidDuplicate(self):
@@ -798,7 +804,7 @@
if EccGlobalData.gConfig.MetaDataFileCheckModuleFileNoUse == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
EdkLogger.quiet("Checking for no used module files ...")
SqlCommand = """
- select upper(Path) from File where ID in (select BelongsToFile from INF where BelongsToFile != -1)
+ select upper(Path) from File where ID in (select BelongsToFile from Inf where BelongsToFile != -1)
"""
InfPathSet = EccGlobalData.gDb.TblInf.Exec(SqlCommand)
InfPathList = []
@@ -825,15 +831,15 @@
if EccGlobalData.gConfig.MetaDataFileCheckPcdType == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
EdkLogger.quiet("Checking for pcd type in c code function usage ...")
SqlCommand = """
- select ID, Model, Value1, BelongsToFile from INF where Model > %s and Model < %s
+ select ID, Model, Value1, Value2, BelongsToFile from INF where Model > %s and Model < %s
""" % (MODEL_PCD, MODEL_META_DATA_HEADER)
PcdSet = EccGlobalData.gDb.TblInf.Exec(SqlCommand)
for Pcd in PcdSet:
Model = Pcd[1]
PcdName = Pcd[2]
- if len(Pcd[2].split(".")) > 1:
- PcdName = Pcd[2].split(".")[1]
- BelongsToFile = Pcd[3]
+ if Pcd[3]:
+ PcdName = Pcd[3]
+ BelongsToFile = Pcd[4]
SqlCommand = """
select ID from File where FullPath in
(select B.Path || '\\' || A.Value1 from INF as A, File as B where A.Model = %s and A.BelongsToFile = %s
@@ -878,9 +884,9 @@
EdkLogger.quiet("Checking for pcd type in c code function usage ...")
Table = EccGlobalData.gDb.TblInf
SqlCommand = """
- select A.ID, A.Value2, A.BelongsToFile, B.BelongsToFile from %s as A, %s as B
- where A.Value1 = 'FILE_GUID' and B.Value1 = 'FILE_GUID' and
- A.Value2 = B.Value2 and A.ID <> B.ID group by A.ID
+ select A.ID, A.Value3, A.BelongsToFile, B.BelongsToFile from %s as A, %s as B
+ where A.Value2 = 'FILE_GUID' and B.Value2 = 'FILE_GUID' and
+ A.Value3 = B.Value3 and A.ID <> B.ID group by A.ID
""" % (Table.Table, Table.Table)
RecordSet = Table.Exec(SqlCommand)
for Record in RecordSet:
@@ -905,7 +911,7 @@
select A.ID, A.Value1 from %s as A, %s as B
where A.Model = %s and B.Model = %s
and A.Value1 = B.Value1 and A.ID <> B.ID
- and A.Arch = B.Arch
+ and A.Scope1 = B.Scope1
and A.Enabled > -1
and B.Enabled > -1
group by A.ID
@@ -929,7 +935,7 @@
select A.ID, A.Value2 from %s as A, %s as B
where A.Model = %s and B.Model = %s
and A.Value2 = B.Value2 and A.ID <> B.ID
- and A.Arch = B.Arch
+ and A.Scope1 = B.Scope1
group by A.ID
""" % (Table.Table, Table.Table, Model, Model)
RecordSet = Table.Exec(SqlCommand)
Modified: trunk/BaseTools/Source/Python/Ecc/Database.py
===================================================================
--- trunk/BaseTools/Source/Python/Ecc/Database.py 2011-12-02 02:52:33 UTC (rev 2451)
+++ trunk/BaseTools/Source/Python/Ecc/Database.py 2011-12-02 08:09:03 UTC (rev 2452)
@@ -26,9 +26,9 @@
from Table.TablePcd import TablePcd
from Table.TableIdentifier import TableIdentifier
from Table.TableReport import TableReport
-from Table.TableInf import TableInf
-from Table.TableDec import TableDec
-from Table.TableDsc import TableDsc
+from MetaFileWorkspace.MetaFileTable import ModuleTable
+from MetaFileWorkspace.MetaFileTable import PackageTable
+from MetaFileWorkspace.MetaFileTable import PlatformTable
from Table.TableFdf import TableFdf
##
@@ -92,9 +92,9 @@
self.TblIdentifier = TableIdentifier(self.Cur)
self.TblPcd = TablePcd(self.Cur)
self.TblReport = TableReport(self.Cur)
- self.TblInf = TableInf(self.Cur)
- self.TblDec = TableDec(self.Cur)
- self.TblDsc = TableDsc(self.Cur)
+ self.TblInf = ModuleTable(self.Cur)
+ self.TblDec = PackageTable(self.Cur)
+ self.TblDsc = PlatformTable(self.Cur)
self.TblFdf = TableFdf(self.Cur)
#
Modified: trunk/BaseTools/Source/Python/Ecc/Ecc.py
===================================================================
--- trunk/BaseTools/Source/Python/Ecc/Ecc.py 2011-12-02 02:52:33 UTC (rev 2451)
+++ trunk/BaseTools/Source/Python/Ecc/Ecc.py 2011-12-02 08:09:03 UTC (rev 2452)
@@ -22,13 +22,17 @@
from optparse import OptionParser
from Configuration import Configuration
from Check import Check
-from Common.InfClassObject import Inf
-from Common.DecClassObject import Dec
-from Common.DscClassObject import Dsc
-from Common.FdfClassObject import Fdf
+
+
from Common.String import NormPath
from Common.BuildVersion import gBUILD_VERSION
from Common import BuildToolError
+
+from MetaFileWorkspace.MetaFileParser import DscParser
+from MetaFileWorkspace.MetaFileParser import DecParser
+from MetaFileWorkspace.MetaFileParser import InfParser
+from MetaFileWorkspace.MetaFileParser import Fdf
+from MetaFileWorkspace.MetaFileTable import MetaFileStorage
import c
import re, string
from Exception import *
@@ -53,6 +57,7 @@
self.IsInit = True
self.ScanSourceCode = True
self.ScanMetaData = True
+ self.MetaFile = ''
# Parse the options and args
self.ParseOption()
@@ -124,7 +129,6 @@
for Root, Dirs, Files in os.walk(EccGlobalData.gTarget):
if p.match(Root.upper()):
continue
-
for Dir in Dirs:
Dirname = os.path.join(Root, Dir)
if os.path.islink(Dirname):
@@ -139,19 +143,28 @@
Filename = os.path.normpath(os.path.join(Root, File))
EdkLogger.quiet("Parsing %s" % Filename)
Op.write("%s\r" % Filename)
- Dec(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
+ #Dec(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
+ self.MetaFile = DecParser(Filename, MODEL_FILE_DEC, EccGlobalData.gDb.TblDec)
+ self.MetaFile.Start()
continue
if len(File) > 4 and File[-4:].upper() == ".DSC":
Filename = os.path.normpath(os.path.join(Root, File))
EdkLogger.quiet("Parsing %s" % Filename)
Op.write("%s\r" % Filename)
- Dsc(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
+ #Dsc(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
+ self.MetaFile = DscParser(Filename, MODEL_FILE_DSC, MetaFileStorage(EccGlobalData.gDb.TblDsc.Cur, Filename, MODEL_FILE_DSC, True))
+ # alwasy do post-process, in case of macros change
+ self.MetaFile.DoPostProcess()
+ self.MetaFile.Start()
+ self.MetaFile._PostProcess()
continue
if len(File) > 4 and File[-4:].upper() == ".INF":
Filename = os.path.normpath(os.path.join(Root, File))
EdkLogger.quiet("Parsing %s" % Filename)
Op.write("%s\r" % Filename)
- Inf(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
+ #Inf(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
+ self.MetaFile = InfParser(Filename, MODEL_FILE_INF, EccGlobalData.gDb.TblInf)
+ self.MetaFile.Start()
continue
if len(File) > 4 and File[-4:].upper() == ".FDF":
Filename = os.path.normpath(os.path.join(Root, File))
Added: trunk/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaDataTable.py
===================================================================
--- trunk/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaDataTable.py (rev 0)
+++ trunk/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaDataTable.py 2011-12-02 08:09:03 UTC (rev 2452)
@@ -0,0 +1,215 @@
+## @file
+# This file is used to create/update/query/erase table for files
+#
+# Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>
+# This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution. The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+
+##
+# Import Modules
+#
+import os
+
+import Common.EdkLogger as EdkLogger
+from CommonDataClass import DataClass
+from CommonDataClass.DataClass import FileClass
+
+## Convert to SQL required string format
+def ConvertToSqlString(StringList):
+ return map(lambda s: "'" + s.replace("'", "''") + "'", StringList)
+
+## TableFile
+#
+# This class defined a common table
+#
+# @param object: Inherited from object class
+#
+# @param Cursor: Cursor of the database
+# @param TableName: Name of the table
+#
+class Table(object):
+ _COLUMN_ = ''
+ _ID_STEP_ = 1
+ _ID_MAX_ = 0x80000000
+ _DUMMY_ = 0
+
+ def __init__(self, Cursor, Name='', IdBase=0, Temporary=False):
+ self.Cur = Cursor
+ self.Table = Name
+ self.IdBase = int(IdBase)
+ self.ID = int(IdBase)
+ self.Temporary = Temporary
+
+ def __str__(self):
+ return self.Table
+
+ ## Create table
+ #
+ # Create a table
+ #
+ def Create(self, NewTable=True):
+ if NewTable:
+ self.Drop()
+
+ if self.Temporary:
+ SqlCommand = """create temp table IF NOT EXISTS %s (%s)""" % (self.Table, self._COLUMN_)
+ else:
+ SqlCommand = """create table IF NOT EXISTS %s (%s)""" % (self.Table, self._COLUMN_)
+ EdkLogger.debug(EdkLogger.DEBUG_8, SqlCommand)
+ self.Cur.execute(SqlCommand)
+ self.ID = self.GetId()
+
+ ## Insert table
+ #
+ # Insert a record into a table
+ #
+ def Insert(self, *Args):
+ self.ID = self.ID + self._ID_STEP_
+ if self.ID >= (self.IdBase + self._ID_MAX_):
+ self.ID = self.IdBase + self._ID_STEP_
+ Values = ", ".join([str(Arg) for Arg in Args])
+ SqlCommand = "insert into %s values(%s, %s)" % (self.Table, self.ID, Values)
+ EdkLogger.debug(EdkLogger.DEBUG_5, SqlCommand)
+ self.Cur.execute(SqlCommand)
+ return self.ID
+
+ ## Query table
+ #
+ # Query all records of the table
+ #
+ def Query(self):
+ SqlCommand = """select * from %s""" % self.Table
+ self.Cur.execute(SqlCommand)
+ for Rs in self.Cur:
+ EdkLogger.verbose(str(Rs))
+ TotalCount = self.GetId()
+
+ ## Drop a table
+ #
+ # Drop the table
+ #
+ def Drop(self):
+ SqlCommand = """drop table IF EXISTS %s""" % self.Table
+ self.Cur.execute(SqlCommand)
+
+ ## Get count
+ #
+ # Get a count of all records of the table
+ #
+ # @retval Count: Total count of all records
+ #
+ def GetCount(self):
+ SqlCommand = """select count(ID) from %s""" % self.Table
+ Record = self.Cur.execute(SqlCommand).fetchall()
+ return Record[0][0]
+
+ def GetId(self):
+ SqlCommand = """select max(ID) from %s""" % self.Table
+ Record = self.Cur.execute(SqlCommand).fetchall()
+ Id = Record[0][0]
+ if Id == None:
+ Id = self.IdBase
+ return Id
+
+ ## Init the ID of the table
+ #
+ # Init the ID of the table
+ #
+ def InitID(self):
+ self.ID = self.GetId()
+
+ ## Exec
+ #
+ # Exec Sql Command, return result
+ #
+ # @param SqlCommand: The SqlCommand to be executed
+ #
+ # @retval RecordSet: The result after executed
+ #
+ def Exec(self, SqlCommand):
+ EdkLogger.debug(EdkLogger.DEBUG_5, SqlCommand)
+ self.Cur.execute(SqlCommand)
+ RecordSet = self.Cur.fetchall()
+ return RecordSet
+
+ def SetEndFlag(self):
+ pass
+
+ def IsIntegral(self):
+ Result = self.Exec("select min(ID) from %s" % (self.Table))
+ if Result[0][0] != -1:
+ return False
+ return True
+
+ def GetAll(self):
+ return self.Exec("select * from %s where ID > 0 order by ID" % (self.Table))
+
+
+## TableDataModel
+#
+# This class defined a table used for data model
+#
+# @param object: Inherited from object class
+#
+#
+class TableDataModel(Table):
+ _COLUMN_ = """
+ ID INTEGER PRIMARY KEY,
+ CrossIndex INTEGER NOT NULL,
+ Name VARCHAR NOT NULL,
+ Description VARCHAR
+ """
+ def __init__(self, Cursor):
+ Table.__init__(self, Cursor, 'DataModel')
+
+ ## Insert table
+ #
+ # Insert a record into table DataModel
+ #
+ # @param ID: ID of a M...
[truncated message content] |
|
From: <yi...@us...> - 2011-12-02 08:41:45
|
Revision: 2454
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2454&view=rev
Author: yingke
Date: 2011-12-02 08:41:39 +0000 (Fri, 02 Dec 2011)
Log Message:
-----------
Print stack trace if an unknown error is raised.
Signed-off-by: yingke
Reviewed-by: gikidy
Modified Paths:
--------------
trunk/BaseTools/Source/Python/GenFds/GenFds.py
trunk/BaseTools/Source/Python/build/build.py
Modified: trunk/BaseTools/Source/Python/GenFds/GenFds.py
===================================================================
--- trunk/BaseTools/Source/Python/GenFds/GenFds.py 2011-12-02 08:41:10 UTC (rev 2453)
+++ trunk/BaseTools/Source/Python/GenFds/GenFds.py 2011-12-02 08:41:39 UTC (rev 2454)
@@ -278,8 +278,7 @@
ExtraData="Please send email to edk...@li... for help, attaching following call stack trace!\n",
RaiseError=False
)
- if Options.debug != None:
- EdkLogger.quiet(traceback.format_exc())
+ EdkLogger.quiet(traceback.format_exc())
ReturnCode = CODE_ERROR
return ReturnCode
Modified: trunk/BaseTools/Source/Python/build/build.py
===================================================================
--- trunk/BaseTools/Source/Python/build/build.py 2011-12-02 08:41:10 UTC (rev 2453)
+++ trunk/BaseTools/Source/Python/build/build.py 2011-12-02 08:41:39 UTC (rev 2454)
@@ -1856,8 +1856,7 @@
ExtraData="\n(Please send email to edk...@li... for help, attaching following call stack trace!)\n",
RaiseError=False
)
- if Option != None and Option.debug != None:
- EdkLogger.quiet("(Python %s on %s) " % (platform.python_version(), sys.platform) + traceback.format_exc())
+ EdkLogger.quiet("(Python %s on %s) " % (platform.python_version(), sys.platform) + traceback.format_exc())
ReturnCode = CODE_ERROR
finally:
Utils.Progressor.Abort()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gi...@us...> - 2011-12-13 08:53:13
|
Revision: 2467
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2467&view=rev
Author: gikidy
Date: 2011-12-13 08:53:07 +0000 (Tue, 13 Dec 2011)
Log Message:
-----------
Fix an issue of help information on build arch is not accurate.
Signed-off-by: gikidy
Reviewed-by: lgao4
Modified Paths:
--------------
trunk/BaseTools/Source/Python/AutoGen/AutoGen.py
trunk/BaseTools/Source/Python/build/build.py
Modified: trunk/BaseTools/Source/Python/AutoGen/AutoGen.py
===================================================================
--- trunk/BaseTools/Source/Python/AutoGen/AutoGen.py 2011-12-13 05:47:26 UTC (rev 2466)
+++ trunk/BaseTools/Source/Python/AutoGen/AutoGen.py 2011-12-13 08:53:07 UTC (rev 2467)
@@ -173,7 +173,8 @@
# @param SkuId SKU id from command line
#
def _Init(self, WorkspaceDir, ActivePlatform, Target, Toolchain, ArchList, MetaFileDb,
- BuildConfig, ToolDefinition, FlashDefinitionFile='', Fds=None, Fvs=None, Caps=None, SkuId='', UniFlag=None):
+ BuildConfig, ToolDefinition, FlashDefinitionFile='', Fds=None, Fvs=None, Caps=None, SkuId='', UniFlag=None,
+ Progress=None, BuildModule=None):
if Fds is None:
Fds = []
if Fvs is None:
@@ -236,8 +237,25 @@
# parse FDF file to get PCDs in it, if any
if not self.FdfFile:
self.FdfFile = self.Platform.FlashDefinition
+
+ EdkLogger.info("")
+ if self.ArchList:
+ EdkLogger.info('%-16s = %s' % ("Architecture(s)", ' '.join(self.ArchList)))
+ EdkLogger.info('%-16s = %s' % ("Build target", self.BuildTarget))
+ EdkLogger.info('%-16s = %s' % ("Toolchain",self.ToolChain))
+
+ EdkLogger.info('\n%-24s = %s' % ("Active Platform", self.Platform))
+ if BuildModule:
+ EdkLogger.info('%-24s = %s' % ("Active Module", BuildModule))
+
+ if self.FdfFile:
+ EdkLogger.info('%-24s = %s' % ("Flash Image Definition", self.FdfFile))
+
EdkLogger.verbose("\nFLASH_DEFINITION = %s" % self.FdfFile)
-
+
+ if Progress:
+ Progress.Start("\nProcessing meta-data")
+
if self.FdfFile:
#
# Mark now build in AutoGen Phase
Modified: trunk/BaseTools/Source/Python/build/build.py
===================================================================
--- trunk/BaseTools/Source/Python/build/build.py 2011-12-13 05:47:26 UTC (rev 2466)
+++ trunk/BaseTools/Source/Python/build/build.py 2011-12-13 08:53:07 UTC (rev 2467)
@@ -745,17 +745,8 @@
EdkLogger.quiet("%-16s = %s" % ("EDK_TOOLS_PATH", os.environ["EDK_TOOLS_PATH"]))
EdkLogger.info("")
- if self.ArchList:
- EdkLogger.info('%-16s = %s' % ("Architecture(s)", ' '.join(self.ArchList)))
- EdkLogger.info('%-16s = %s' % ("Build target", ' '.join(self.BuildTargetList)))
- EdkLogger.info('%-16s = %s' % ("Toolchain", ' '.join(self.ToolChainList)))
- EdkLogger.info('\n%-16s = %s' % ("Active Platform", self.PlatformFile))
- if self.ModuleFile:
- EdkLogger.info('%-16s = %s' % ("Active Module", self.ModuleFile))
-
os.chdir(self.WorkspaceDir)
- self.Progress.Start("\nProcessing meta-data")
## Load configuration
#
@@ -1241,7 +1232,8 @@
self.FvList,
self.CapList,
self.SkuId,
- self.UniFlag
+ self.UniFlag,
+ self.Progress
)
self.Fdf = Wa.FdfFile
self.LoadFixAddress = Wa.Platform.LoadFixAddress
@@ -1316,7 +1308,9 @@
self.FvList,
self.CapList,
self.SkuId,
- self.UniFlag
+ self.UniFlag,
+ self.Progress,
+ self.ModuleFile
)
self.Fdf = Wa.FdfFile
self.LoadFixAddress = Wa.Platform.LoadFixAddress
@@ -1401,7 +1395,8 @@
self.FvList,
self.CapList,
self.SkuId,
- self.UniFlag
+ self.UniFlag,
+ self.Progress
)
self.Fdf = Wa.FdfFile
self.LoadFixAddress = Wa.Platform.LoadFixAddress
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <yi...@us...> - 2012-02-23 04:22:00
|
Revision: 2487
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2487&view=rev
Author: yingke
Date: 2012-02-23 04:21:54 +0000 (Thu, 23 Feb 2012)
Log Message:
-----------
FeatureFlag and FixAtBuild Pcds in DSC can be used for conditional statements in FDF.
Reviewed-by: jsu1
Signed-off-by: yingke
Modified Paths:
--------------
trunk/BaseTools/Source/Python/Common/GlobalData.py
trunk/BaseTools/Source/Python/GenFds/FdfParser.py
trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py
Modified: trunk/BaseTools/Source/Python/Common/GlobalData.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/GlobalData.py 2012-02-23 03:39:06 UTC (rev 2486)
+++ trunk/BaseTools/Source/Python/Common/GlobalData.py 2012-02-23 04:21:54 UTC (rev 2487)
@@ -26,6 +26,7 @@
gGlobalDefines = {}
gPlatformDefines = {}
+gPlatformPcds = {}
gActivePlatform = None
gCommandLineDefines = {}
gEdkGlobal = {}
Modified: trunk/BaseTools/Source/Python/GenFds/FdfParser.py
===================================================================
--- trunk/BaseTools/Source/Python/GenFds/FdfParser.py 2012-02-23 03:39:06 UTC (rev 2486)
+++ trunk/BaseTools/Source/Python/GenFds/FdfParser.py 2012-02-23 04:21:54 UTC (rev 2487)
@@ -807,6 +807,7 @@
MacroDict = {}
# PCD macro
+ MacroDict.update(GlobalData.gPlatformPcds)
MacroDict.update(self.__PcdDict)
# Lowest priority
Modified: trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py
===================================================================
--- trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py 2012-02-23 03:39:06 UTC (rev 2486)
+++ trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py 2012-02-23 04:21:54 UTC (rev 2487)
@@ -1386,7 +1386,8 @@
try:
ValueList[0] = ValueExpression(PcdValue, self._Macros)(True)
except WrnExpression, Value:
- ValueList[0] = Value.result
+ ValueList[0] = Value.result
+ PcdValue = ValueList[0]
else:
#
# Int*/Boolean VPD PCD
@@ -1412,8 +1413,10 @@
if ValueList[-1] == 'True':
ValueList[-1] = '1'
if ValueList[-1] == 'False':
- ValueList[-1] = '0'
-
+ ValueList[-1] = '0'
+ PcdValue = ValueList[-1]
+ if PcdValue and self._ItemType in [MODEL_PCD_FEATURE_FLAG, MODEL_PCD_FIXED_AT_BUILD]:
+ GlobalData.gPlatformPcds[TAB_SPLIT.join(self._ValueList[0:2])] = PcdValue
self._ValueList[2] = '|'.join(ValueList)
def __ProcessComponent(self):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2012-03-02 06:18:46
|
Revision: 2494
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2494&view=rev
Author: jsu1
Date: 2012-03-02 06:18:40 +0000 (Fri, 02 Mar 2012)
Log Message:
-----------
Remove hard-coded build target from build tool
Reviewed-by: yingke
Signed-off-by: jsu1
Modified Paths:
--------------
trunk/BaseTools/Source/Python/GenFds/GenFds.py
trunk/BaseTools/Source/Python/build/build.py
Modified: trunk/BaseTools/Source/Python/GenFds/GenFds.py
===================================================================
--- trunk/BaseTools/Source/Python/GenFds/GenFds.py 2012-03-02 00:57:02 UTC (rev 2493)
+++ trunk/BaseTools/Source/Python/GenFds/GenFds.py 2012-03-02 06:18:40 UTC (rev 2494)
@@ -314,8 +314,8 @@
Parser.add_option("-r", "--rom_image", dest="uiFdName", help="Build the image using the [FD] section named by FdUiName.")
Parser.add_option("-i", "--FvImage", dest="uiFvName", help="Build the FV image using the [FV] section named by UiFvName")
Parser.add_option("-C", "--CapsuleImage", dest="uiCapName", help="Build the Capsule image using the [Capsule] section named by UiCapName")
- Parser.add_option("-b", "--buildtarget", type="choice", choices=['DEBUG','RELEASE', 'NOOPT'], dest="BuildTarget", help="Build TARGET is one of list: DEBUG, RELEASE, NOOPT.",
- action="callback", callback=SingleCheckCallback)
+ Parser.add_option("-b", "--buildtarget", type="string", dest="BuildTarget", help="Set the build TARGET, overrides target.txt TARGET setting.",
+ action="append")
Parser.add_option("-t", "--tagname", type="string", dest="ToolChain", help="Using the tools: TOOL_CHAIN_TAG name to build the platform.",
action="callback", callback=SingleCheckCallback)
Parser.add_option("-D", "--define", action="append", type="string", dest="Macros", help="Macro: \"Name [= Value]\".")
Modified: trunk/BaseTools/Source/Python/build/build.py
===================================================================
--- trunk/BaseTools/Source/Python/build/build.py 2012-03-02 00:57:02 UTC (rev 2493)
+++ trunk/BaseTools/Source/Python/build/build.py 2012-03-02 06:18:40 UTC (rev 2494)
@@ -1662,8 +1662,8 @@
help="Build the platform specified by the DSC file name argument, overriding target.txt's ACTIVE_PLATFORM definition.")
Parser.add_option("-m", "--module", action="callback", type="string", dest="ModuleFile", callback=SingleCheckCallback,
help="Build the module specified by the INF file name argument.")
- Parser.add_option("-b", "--buildtarget", action="append", type="choice", choices=['DEBUG','RELEASE','NOOPT'], dest="BuildTarget",
- help="BuildTarget is one of list: DEBUG, RELEASE, NOOPT, which overrides target.txt's TARGET definition. To specify more TARGET, please repeat this option.")
+ Parser.add_option("-b", "--buildtarget", type="string", dest="BuildTarget", help="Using the TARGET to build the platform, overriding target.txt's TARGET definition.",
+ action="append")
Parser.add_option("-t", "--tagname", action="append", type="string", dest="ToolChain",
help="Using the Tool Chain Tagname to build the platform, overriding target.txt's TOOL_CHAIN_TAG definition.")
Parser.add_option("-x", "--sku-id", action="callback", type="string", dest="SkuId", callback=SingleCheckCallback,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <xf...@us...> - 2012-03-08 05:48:29
|
Revision: 2497
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2497&view=rev
Author: xfzyr
Date: 2012-03-08 05:48:22 +0000 (Thu, 08 Mar 2012)
Log Message:
-----------
Fix a issue of One line exceed 120 Characters but Not Wrap Line.
Signed-off-by: yzeng15
Reviewed-by: hchen30
Reviewed-by: jcarsey
Modified Paths:
--------------
trunk/BaseTools/Source/Python/Common/DataType.py
trunk/BaseTools/Source/Python/build/BuildReport.py
Modified: trunk/BaseTools/Source/Python/Common/DataType.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/DataType.py 2012-03-07 02:00:24 UTC (rev 2496)
+++ trunk/BaseTools/Source/Python/Common/DataType.py 2012-03-08 05:48:22 UTC (rev 2497)
@@ -29,6 +29,7 @@
TAB_OPTION_END = '>'
TAB_SLASH = '\\'
TAB_BACK_SLASH = '/'
+TAB_LINE_BREAK = '\n'
TAB_EDK_SOURCE = '$(EDK_SOURCE)'
TAB_EFI_SOURCE = '$(EFI_SOURCE)'
Modified: trunk/BaseTools/Source/Python/build/BuildReport.py
===================================================================
--- trunk/BaseTools/Source/Python/build/BuildReport.py 2012-03-07 02:00:24 UTC (rev 2496)
+++ trunk/BaseTools/Source/Python/build/BuildReport.py 2012-03-08 05:48:22 UTC (rev 2497)
@@ -33,8 +33,8 @@
from Common.InfClassObject import gComponentType2ModuleType
from Common.BuildToolError import FILE_WRITE_FAILURE
from Common.BuildToolError import CODE_ERROR
+from Common.DataType import TAB_LINE_BREAK
-
## Pattern to extract contents in EDK DXS files
gDxsDependencyPattern = re.compile(r"DEPENDENCY_START(.+)DEPENDENCY_END", re.DOTALL)
@@ -63,15 +63,18 @@
## Pattern to find the entry point for EDK module using EDKII Glue library
gGlueLibEntryPoint = re.compile(r"__EDKII_GLUE_MODULE_ENTRY_POINT__\s*=\s*(\w+)")
+## Tags for MaxLength of line in report
+gLineMaxLength = 120
+
## Tags for section start, end and separator
-gSectionStart = ">" + "=" * 118 + "<"
-gSectionEnd = "<" + "=" * 118 + ">" + "\n"
-gSectionSep = "=" * 120
+gSectionStart = ">" + "=" * (gLineMaxLength-2) + "<"
+gSectionEnd = "<" + "=" * (gLineMaxLength-2) + ">" + "\n"
+gSectionSep = "=" * gLineMaxLength
## Tags for subsection start, end and separator
-gSubSectionStart = ">" + "-" * 118 + "<"
-gSubSectionEnd = "<" + "-" * 118 + ">"
-gSubSectionSep = "-" * 120
+gSubSectionStart = ">" + "-" * (gLineMaxLength-2) + "<"
+gSubSectionEnd = "<" + "-" * (gLineMaxLength-2) + ">"
+gSubSectionSep = "-" * gLineMaxLength
## The look up table to map PCD type to pair of report display type and DEC type
gPcdTypeMap = {
@@ -166,6 +169,30 @@
IncludeFiles[FullFileName.lower().replace("\\", "/")] = FullFileName
break
+## Split each lines in file
+#
+# This method is used to split the lines in file to make the length of each line
+# less than MaxLength.
+#
+# @param Content The content of file
+# @param MaxLength The Max Length of the line
+#
+def FileLinesSplit(Content=None, MaxLength=None):
+ ContentList = Content.split(TAB_LINE_BREAK)
+ NewContent = ''
+ NewContentList = []
+ for Line in ContentList:
+ while len(Line) > MaxLength:
+ NewContentList.append(Line[:MaxLength])
+ Line = Line[MaxLength:]
+ if Line:
+ NewContentList.append(Line)
+ for NewLine in NewContentList:
+ NewContent += NewLine + os.linesep
+ return NewContent
+
+
+
##
# Parse binary dependency expression section
#
@@ -1511,7 +1538,8 @@
File = StringIO('')
for (Wa, MaList) in self.ReportList:
PlatformReport(Wa, MaList, self.ReportType).GenerateReport(File, BuildDuration, self.ReportType)
- SaveFileOnChange(self.ReportFile, File.getvalue(), False)
+ Content = FileLinesSplit(File.getvalue(), gLineMaxLength)
+ SaveFileOnChange(self.ReportFile, Content, True)
EdkLogger.quiet("Build report can be found at %s" % os.path.abspath(self.ReportFile))
except IOError:
EdkLogger.error(None, FILE_WRITE_FAILURE, ExtraData=self.ReportFile)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <yi...@us...> - 2012-03-13 00:48:05
|
Revision: 2499
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2499&view=rev
Author: yingke
Date: 2012-03-13 00:47:58 +0000 (Tue, 13 Mar 2012)
Log Message:
-----------
Fix bug to handle ?\226?\128?\152#?\226?\128?\153 in string correctly between build option and other sections.
Signed-off-by: yingke
Reviewed-by: jsu1
Modified Paths:
--------------
trunk/BaseTools/Source/Python/Common/String.py
trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py
Modified: trunk/BaseTools/Source/Python/Common/String.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/String.py 2012-03-09 06:28:44 UTC (rev 2498)
+++ trunk/BaseTools/Source/Python/Common/String.py 2012-03-13 00:47:58 UTC (rev 2499)
@@ -319,7 +319,7 @@
#
# @retval Path Formatted path
#
-def CleanString(Line, CommentCharacter=DataType.TAB_COMMENT_SPLIT, AllowCppStyleComment=False):
+def CleanString(Line, CommentCharacter=DataType.TAB_COMMENT_SPLIT, AllowCppStyleComment=False, BuildOption=False):
#
# remove whitespace
#
@@ -343,7 +343,7 @@
Line = Line[0: Index]
break
- if CommentInString:
+ if CommentInString and BuildOption:
Line = Line.replace('"', '')
ChIndex = Line.find('#')
while ChIndex >= 0:
Modified: trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py
===================================================================
--- trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py 2012-03-09 06:28:44 UTC (rev 2498)
+++ trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py 2012-03-13 00:47:58 UTC (rev 2499)
@@ -340,6 +340,7 @@
## [BuildOptions] section parser
@ParseMacro
def _BuildOptionParser(self):
+ self._CurrentLine = CleanString(self._CurrentLine, BuildOption=True)
TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1)
TokenList2 = GetSplitValueList(TokenList[0], ':', 1)
if len(TokenList2) == 2:
@@ -1069,6 +1070,7 @@
## [BuildOptions] section parser
@ParseMacro
def _BuildOptionParser(self):
+ self._CurrentLine = CleanString(self._CurrentLine, BuildOption=True)
TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1)
TokenList2 = GetSplitValueList(TokenList[0], ':', 1)
if len(TokenList2) == 2:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <yi...@us...> - 2012-03-23 06:59:27
|
Revision: 2505
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2505&view=rev
Author: yingke
Date: 2012-03-23 06:59:21 +0000 (Fri, 23 Mar 2012)
Log Message:
-----------
Report readable error message if invalid PCD is used in conditional directive.
Signed-off-by: yingke
Reviewed-by: lgao4
Reviewed-by: jsu1
Modified Paths:
--------------
trunk/BaseTools/Source/Python/Common/Expression.py
trunk/BaseTools/Source/Python/Common/GlobalData.py
trunk/BaseTools/Source/Python/GenFds/FdfParser.py
trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py
Modified: trunk/BaseTools/Source/Python/Common/Expression.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/Expression.py 2012-03-16 09:20:30 UTC (rev 2504)
+++ trunk/BaseTools/Source/Python/Common/Expression.py 2012-03-23 06:59:21 UTC (rev 2505)
@@ -465,7 +465,9 @@
# PCD token
if self.PcdPattern.match(self._Token):
if self._Token not in self._Symb:
- raise BadExpression(ERR_PCD_RESOLVE % self._Token)
+ Ex = BadExpression(ERR_PCD_RESOLVE % self._Token)
+ Ex.Pcd = self._Token
+ raise Ex
self._Token = ValueExpression(self._Symb[self._Token], self._Symb)(True)
if type(self._Token) != type(''):
self._LiteralToken = hex(self._Token)
Modified: trunk/BaseTools/Source/Python/Common/GlobalData.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/GlobalData.py 2012-03-16 09:20:30 UTC (rev 2504)
+++ trunk/BaseTools/Source/Python/Common/GlobalData.py 2012-03-23 06:59:21 UTC (rev 2505)
@@ -26,7 +26,10 @@
gGlobalDefines = {}
gPlatformDefines = {}
+# PCD name and value pair for fixed at build and feature flag
gPlatformPcds = {}
+# PCDs with type that are not fixed at build and feature flag
+gPlatformOtherPcds = {}
gActivePlatform = None
gCommandLineDefines = {}
gEdkGlobal = {}
Modified: trunk/BaseTools/Source/Python/GenFds/FdfParser.py
===================================================================
--- trunk/BaseTools/Source/Python/GenFds/FdfParser.py 2012-03-16 09:20:30 UTC (rev 2504)
+++ trunk/BaseTools/Source/Python/GenFds/FdfParser.py 2012-03-23 06:59:21 UTC (rev 2505)
@@ -853,7 +853,19 @@
Line=Line)
return Excpt.result
except Exception, Excpt:
- raise Warning("Invalid expression", *FileLineTuple)
+ if hasattr(Excpt, 'Pcd'):
+ if Excpt.Pcd in GlobalData.gPlatformOtherPcds:
+ Info = GlobalData.gPlatformOtherPcds[Excpt.Pcd]
+ raise Warning("Cannot use this PCD (%s) in an expression as"
+ " it must be defined in a [PcdsFixedAtBuild] or [PcdsFeatureFlag] section"
+ " of the DSC file (%s), and it is currently defined in this section:"
+ " %s, line #: %d." % (Excpt.Pcd, GlobalData.gPlatformOtherPcds['DSCFILE'], Info[0], Info[1]),
+ *FileLineTuple)
+ else:
+ raise Warning("PCD (%s) is not defined in DSC file (%s)" % (Excpt.Pcd, GlobalData.gPlatformOtherPcds['DSCFILE']),
+ *FileLineTuple)
+ else:
+ raise Warning(str(Excpt), *FileLineTuple)
else:
if Expression.startswith('$(') and Expression[-1] == ')':
Expression = Expression[2:-1]
Modified: trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py
===================================================================
--- trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py 2012-03-16 09:20:30 UTC (rev 2504)
+++ trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py 2012-03-23 06:59:21 UTC (rev 2505)
@@ -1185,9 +1185,23 @@
# Only catch expression evaluation error here. We need to report
# the precise number of line on which the error occurred
#
- EdkLogger.error('Parser', FORMAT_INVALID, "Invalid expression: %s" % str(Excpt),
- File=self._FileWithError, ExtraData=' '.join(self._ValueList),
- Line=self._LineIndex+1)
+ if hasattr(Excpt, 'Pcd'):
+ if Excpt.Pcd in GlobalData.gPlatformOtherPcds:
+ Info = GlobalData.gPlatformOtherPcds[Excpt.Pcd]
+ EdkLogger.error('Parser', FORMAT_INVALID, "Cannot use this PCD (%s) in an expression as"
+ " it must be defined in a [PcdsFixedAtBuild] or [PcdsFeatureFlag] section"
+ " of the DSC file, and it is currently defined in this section:"
+ " %s, line #: %d." % (Excpt.Pcd, Info[0], Info[1]),
+ File=self._FileWithError, ExtraData=' '.join(self._ValueList),
+ Line=self._LineIndex+1)
+ else:
+ EdkLogger.error('Parser', FORMAT_INVALID, "PCD (%s) is not defined in DSC file" % Excpt.Pcd,
+ File=self._FileWithError, ExtraData=' '.join(self._ValueList),
+ Line=self._LineIndex+1)
+ else:
+ EdkLogger.error('Parser', FORMAT_INVALID, "Invalid expression: %s" % str(Excpt),
+ File=self._FileWithError, ExtraData=' '.join(self._ValueList),
+ Line=self._LineIndex+1)
except MacroException, Excpt:
EdkLogger.error('Parser', FORMAT_INVALID, str(Excpt),
File=self._FileWithError, ExtraData=' '.join(self._ValueList),
@@ -1246,6 +1260,20 @@
Name = TokenSpaceGuid + '.' + PcdName
self._Symbols[Name] = Value
+ Content = open(str(self.MetaFile), 'r').readlines()
+ GlobalData.gPlatformOtherPcds['DSCFILE'] = str(self.MetaFile)
+ for PcdType in (MODEL_PCD_PATCHABLE_IN_MODULE, MODEL_PCD_DYNAMIC_DEFAULT, MODEL_PCD_DYNAMIC_HII,
+ MODEL_PCD_DYNAMIC_VPD, MODEL_PCD_DYNAMIC_EX_DEFAULT, MODEL_PCD_DYNAMIC_EX_HII,
+ MODEL_PCD_DYNAMIC_EX_VPD):
+ Records = self._RawTable.Query(PcdType, BelongsToItem=-1.0)
+ for TokenSpaceGuid,PcdName,Value,Dummy2,Dummy3,ID,Line in Records:
+ Name = TokenSpaceGuid + '.' + PcdName
+ if Name not in GlobalData.gPlatformOtherPcds:
+ PcdLine = Line
+ while not Content[Line - 1].lstrip().startswith(TAB_SECTION_START):
+ Line -= 1
+ GlobalData.gPlatformOtherPcds[Name] = (CleanString(Content[Line - 1]), PcdLine, PcdType)
+
def __ProcessDefine(self):
if not self._Enabled:
return
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <yi...@us...> - 2012-03-29 05:07:41
|
Revision: 2508
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2508&view=rev
Author: yingke
Date: 2012-03-29 05:07:34 +0000 (Thu, 29 Mar 2012)
Log Message:
-----------
Check if PCD name defined in DSC file is declared in DEC files.
Signed-off-by: yingke
Reviewed-by: jsu1
Modified Paths:
--------------
trunk/BaseTools/Source/Python/AutoGen/AutoGen.py
trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
Modified: trunk/BaseTools/Source/Python/AutoGen/AutoGen.py
===================================================================
--- trunk/BaseTools/Source/Python/AutoGen/AutoGen.py 2012-03-27 05:56:14 UTC (rev 2507)
+++ trunk/BaseTools/Source/Python/AutoGen/AutoGen.py 2012-03-29 05:07:34 UTC (rev 2508)
@@ -291,22 +291,24 @@
# apply SKU and inject PCDs from Flash Definition file
for Arch in self.ArchList:
Platform = self.BuildDatabase[self.MetaFile, Arch, Target, Toolchain]
+
DecPcds = set()
- if PcdSet:
- PGen = PlatformAutoGen(self, self.MetaFile, Target, Toolchain, Arch)
- Pkgs = PGen.PackageList
- for Pkg in Pkgs:
- for Pcd in Pkg.Pcds.keys():
- DecPcds.add((Pcd[0], Pcd[1]))
+ PGen = PlatformAutoGen(self, self.MetaFile, Target, Toolchain, Arch)
+ Pkgs = PGen.PackageList
+ for Pkg in Pkgs:
+ for Pcd in Pkg.Pcds.keys():
+ DecPcds.add((Pcd[0], Pcd[1]))
+ Platform.IsPlatformPcdDeclared(DecPcds)
+
Platform.SkuName = self.SkuId
for Name, Guid in PcdSet:
if (Name, Guid) not in DecPcds:
EdkLogger.error(
'build',
- FORMAT_INVALID,
- "PCD (%s.%s) used in FDF is not declared in DEC files. FDF file: %s, line #: %d." % \
- (Guid, Name, self.FdfProfile.PcdFileLineDict[Name, Guid][0], self.FdfProfile.PcdFileLineDict[Name, Guid][1]),
- ExtraData=None
+ PARSER_ERROR,
+ "PCD (%s.%s) used in FDF is not declared in DEC files." % (Guid, Name),
+ File = self.FdfProfile.PcdFileLineDict[Name, Guid][0],
+ Line = self.FdfProfile.PcdFileLineDict[Name, Guid][1]
)
Platform.AddPcd(Name, Guid, PcdSet[Name, Guid])
Modified: trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
===================================================================
--- trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py 2012-03-27 05:56:14 UTC (rev 2507)
+++ trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py 2012-03-29 05:07:34 UTC (rev 2508)
@@ -842,6 +842,17 @@
self.Pcds[Name, Guid] = PcdClassObject(Name, Guid, '', '', '', '', '', {}, False, None)
self.Pcds[Name, Guid].DefaultValue = Value
+ def IsPlatformPcdDeclared(self, DecPcds):
+ for PcdType in (MODEL_PCD_FIXED_AT_BUILD, MODEL_PCD_PATCHABLE_IN_MODULE, MODEL_PCD_FEATURE_FLAG,
+ MODEL_PCD_DYNAMIC_DEFAULT, MODEL_PCD_DYNAMIC_HII, MODEL_PCD_DYNAMIC_VPD,
+ MODEL_PCD_DYNAMIC_EX_DEFAULT, MODEL_PCD_DYNAMIC_EX_HII, MODEL_PCD_DYNAMIC_EX_VPD):
+ RecordList = self._RawData[PcdType, self._Arch]
+ for TokenSpaceGuid, PcdCName, Setting, Arch, SkuName, Dummy3, Dummy4 in RecordList:
+ if (PcdCName, TokenSpaceGuid) not in DecPcds:
+ EdkLogger.error('build', PARSER_ERROR,
+ "Pcd (%s.%s) defined in DSC is not declared in DEC files." % (TokenSpaceGuid, PcdCName),
+ File=self.MetaFile, Line=Dummy4)
+
_Macros = property(_GetMacros)
Arch = property(_GetArch, _SetArch)
Platform = property(_GetPlatformName)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <xf...@us...> - 2012-04-05 06:57:31
|
Revision: 2516
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2516&view=rev
Author: xfzyr
Date: 2012-04-05 06:57:23 +0000 (Thu, 05 Apr 2012)
Log Message:
-----------
Fix some regression issues with BRG:
1) Eliminate unnecessary blank lines in report.
2) Change the case for some keyword to align with spec.
3) Add the slash flag ?\226?\128?\152\\?\226?\128?\153 and space flag ?\226?\128?\152 ?\226?\128?\152 to break a long long line.
Fix a regression build break on Linux with debug and release as TARGET, GCC44 as TOOL_CHAIN.
Signed-off-by: Yurui Zeng <yur...@in...>
Reviewed-by: Liming Gao <lim...@in...>
Modified Paths:
--------------
trunk/BaseTools/Source/Python/Common/DataType.py
trunk/BaseTools/Source/Python/build/BuildReport.py
trunk/BaseTools/Source/Python/build/build.py
Modified: trunk/BaseTools/Source/Python/Common/DataType.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/DataType.py 2012-04-03 20:14:31 UTC (rev 2515)
+++ trunk/BaseTools/Source/Python/Common/DataType.py 2012-04-05 06:57:23 UTC (rev 2516)
@@ -422,6 +422,10 @@
TAB_UNKNOWN_FILE = "UNKNOWN-TYPE-FILE"
TAB_DEFAULT_BINARY_FILE = "_BINARY_FILE_"
+# used by BRG
+TAB_BRG_PCD = 'PCD'
+TAB_BRG_LIBRARY = 'Library'
+
#
# Build Rule File Version Definition
#
Modified: trunk/BaseTools/Source/Python/build/BuildReport.py
===================================================================
--- trunk/BaseTools/Source/Python/build/BuildReport.py 2012-04-03 20:14:31 UTC (rev 2515)
+++ trunk/BaseTools/Source/Python/build/BuildReport.py 2012-04-05 06:57:23 UTC (rev 2516)
@@ -34,9 +34,11 @@
from Common.BuildToolError import FILE_WRITE_FAILURE
from Common.BuildToolError import CODE_ERROR
from Common.DataType import TAB_LINE_BREAK
-from Common.DataType import TAB_INF_PCD
-from Common.DataType import EDK_COMPONENT_TYPE_LIBRARY
from Common.DataType import TAB_DEPEX
+from Common.DataType import TAB_SLASH
+from Common.DataType import TAB_SPACE_SPLIT
+from Common.DataType import TAB_BRG_PCD
+from Common.DataType import TAB_BRG_LIBRARY
## Pattern to extract contents in EDK DXS files
gDxsDependencyPattern = re.compile(r"DEPENDENCY_START(.+)DEPENDENCY_END", re.DOTALL)
@@ -182,17 +184,24 @@
# @param MaxLength The Max Length of the line
#
def FileLinesSplit(Content=None, MaxLength=None):
- ContentList = Content.split(os.linesep)
+ ContentList = Content.split(TAB_LINE_BREAK)
NewContent = ''
NewContentList = []
for Line in ContentList:
- while len(Line) > MaxLength:
- NewContentList.append(Line[:MaxLength])
- Line = Line[MaxLength:]
+ while len(Line.rstrip()) > MaxLength:
+ LineSpaceIndex = Line.rfind(TAB_SPACE_SPLIT, 0, MaxLength)
+ LineSlashIndex = Line.rfind(TAB_SLASH, 0, MaxLength)
+ LineBreakIndex = MaxLength
+ if LineSpaceIndex > LineSlashIndex:
+ LineBreakIndex = LineSpaceIndex
+ elif LineSlashIndex > LineSpaceIndex:
+ LineBreakIndex = LineSlashIndex
+ NewContentList.append(Line[:LineBreakIndex])
+ Line = Line[LineBreakIndex:]
if Line:
NewContentList.append(Line)
for NewLine in NewContentList:
- NewContent += NewLine + os.linesep
+ NewContent += NewLine + TAB_LINE_BREAK
return NewContent
@@ -294,7 +303,7 @@
#
def GenerateReport(self, File):
FileWrite(File, gSubSectionStart)
- FileWrite(File, EDK_COMPONENT_TYPE_LIBRARY)
+ FileWrite(File, TAB_BRG_LIBRARY)
if len(self.LibraryList) > 0:
FileWrite(File, gSubSectionSep)
for LibraryItem in self.LibraryList:
@@ -718,7 +727,7 @@
# For module PCD sub-section
#
FileWrite(File, gSubSectionStart)
- FileWrite(File, TAB_INF_PCD)
+ FileWrite(File, TAB_BRG_PCD)
FileWrite(File, gSubSectionSep)
for Key in self.AllPcds:
Modified: trunk/BaseTools/Source/Python/build/build.py
===================================================================
--- trunk/BaseTools/Source/Python/build/build.py 2012-04-03 20:14:31 UTC (rev 2515)
+++ trunk/BaseTools/Source/Python/build/build.py 2012-04-05 06:57:23 UTC (rev 2516)
@@ -60,6 +60,7 @@
gToolsDefinition = "Conf/tools_def.txt"
TemporaryTablePattern = re.compile(r'^_\d+_\d+_[a-fA-F0-9]+$')
+TmpTableDict = {}
## Check environment PATH variable to make sure the specified tool is found
#
@@ -1450,14 +1451,13 @@
if BuildTask.HasError():
EdkLogger.error("build", BUILD_ERROR, "Failed to build module", ExtraData=GlobalData.gBuildingModule)
- #
- # Drop temp tables to avoid database be locked.
#
+ # Save temp tables to a TmpTableDict.
+ #
for Key in Wa.BuildDatabase._CACHE_:
if Wa.BuildDatabase._CACHE_[Key]._RawData and Wa.BuildDatabase._CACHE_[Key]._RawData._Table and Wa.BuildDatabase._CACHE_[Key]._RawData._Table.Table:
if TemporaryTablePattern.match(Wa.BuildDatabase._CACHE_[Key]._RawData._Table.Table):
- Wa.BuildDatabase._CACHE_[Key]._RawData._Table.Drop()
- Wa.BuildDatabase._CACHE_[Key]._RawData._Table.Table = 0
+ TmpTableDict[Wa.BuildDatabase._CACHE_[Key]._RawData._Table.Table] = Wa.BuildDatabase._CACHE_[Key]._RawData._Table.Cur
#
#
# All modules have been put in build tasks queue. Tell task scheduler
@@ -1822,6 +1822,10 @@
MyBuild = Build(Target, Workspace, Option)
GlobalData.gCommandLineDefines['ARCH'] = ' '.join(MyBuild.ArchList)
MyBuild.Launch()
+ # Drop temp tables to avoid database locked.
+ for TmpTableName in TmpTableDict:
+ SqlCommand = """drop table IF EXISTS %s""" % TmpTableName
+ TmpTableDict[TmpTableName].execute(SqlCommand)
#MyBuild.DumpBuildData()
except FatalError, X:
if MyBuild != None:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <yi...@us...> - 2012-05-21 06:07:44
|
Revision: 2519
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2519&view=rev
Author: yingke
Date: 2012-05-21 06:07:38 +0000 (Mon, 21 May 2012)
Log Message:
-----------
Check the type of same PCD declared in DEC and defined in DSC.
Reviewed-by: Su Jikui <jik...@in...>
Signed-off-by: Liu Yingke <yin...@in...>
Modified Paths:
--------------
trunk/BaseTools/Source/Python/AutoGen/AutoGen.py
trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
Modified: trunk/BaseTools/Source/Python/AutoGen/AutoGen.py
===================================================================
--- trunk/BaseTools/Source/Python/AutoGen/AutoGen.py 2012-04-06 05:39:12 UTC (rev 2518)
+++ trunk/BaseTools/Source/Python/AutoGen/AutoGen.py 2012-05-21 06:07:38 UTC (rev 2519)
@@ -292,12 +292,12 @@
for Arch in self.ArchList:
Platform = self.BuildDatabase[self.MetaFile, Arch, Target, Toolchain]
- DecPcds = set()
+ DecPcds = {}
PGen = PlatformAutoGen(self, self.MetaFile, Target, Toolchain, Arch)
Pkgs = PGen.PackageList
for Pkg in Pkgs:
- for Pcd in Pkg.Pcds.keys():
- DecPcds.add((Pcd[0], Pcd[1]))
+ for Pcd in Pkg.Pcds:
+ DecPcds[Pcd[0], Pcd[1]] = Pkg.Pcds[Pcd]
Platform.IsPlatformPcdDeclared(DecPcds)
Platform.SkuName = self.SkuId
Modified: trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
===================================================================
--- trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py 2012-04-06 05:39:12 UTC (rev 2518)
+++ trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py 2012-05-21 06:07:38 UTC (rev 2519)
@@ -852,6 +852,21 @@
EdkLogger.error('build', PARSER_ERROR,
"Pcd (%s.%s) defined in DSC is not declared in DEC files." % (TokenSpaceGuid, PcdCName),
File=self.MetaFile, Line=Dummy4)
+ PcdValue = ''
+ if PcdType in (MODEL_PCD_DYNAMIC_VPD, MODEL_PCD_DYNAMIC_EX_VPD):
+ if DecPcds[PcdCName, TokenSpaceGuid].DatumType == "VOID*":
+ PcdValue = AnalyzeVpdPcdData(Setting)[2]
+ else:
+ PcdValue = AnalyzeVpdPcdData(Setting)[1]
+ elif PcdType in (MODEL_PCD_DYNAMIC_HII, MODEL_PCD_DYNAMIC_EX_HII):
+ PcdValue = AnalyzeHiiPcdData(Setting)[3]
+ else:
+ PcdValue = AnalyzePcdData(Setting)[0]
+ if PcdValue:
+ Valid, ErrStr = CheckPcdDatum(DecPcds[PcdCName, TokenSpaceGuid].DatumType, PcdValue)
+ if not Valid:
+ EdkLogger.error('build', FORMAT_INVALID, ErrStr, File=self.MetaFile, Line=Dummy4,
+ ExtraData="%s.%s" % (TokenSpaceGuid, PcdCName))
_Macros = property(_GetMacros)
Arch = property(_GetArch, _SetArch)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <xf...@us...> - 2012-05-31 03:07:11
|
Revision: 2529
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2529&view=rev
Author: xfzyr
Date: 2012-05-31 03:07:05 +0000 (Thu, 31 May 2012)
Log Message:
-----------
Add the check for PCD string value and the Maximum size value.
Signed-off-by: Yurui Zeng <yur...@in...>
Reviewed-by: Boyer, Donna J <don...@in...>
Modified Paths:
--------------
trunk/BaseTools/Source/Python/Common/DataType.py
trunk/BaseTools/Source/Python/Common/Misc.py
trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
Modified: trunk/BaseTools/Source/Python/Common/DataType.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/DataType.py 2012-05-29 08:21:34 UTC (rev 2528)
+++ trunk/BaseTools/Source/Python/Common/DataType.py 2012-05-31 03:07:05 UTC (rev 2529)
@@ -31,6 +31,9 @@
TAB_SLASH = '\\'
TAB_BACK_SLASH = '/'
TAB_LINE_BREAK = '\n'
+TAB_PRINTCHAR_VT = '\x0b'
+TAB_PRINTCHAR_BS = '\b'
+TAB_PRINTCHAR_NUL = '\0'
TAB_UINT8 = 'UINT8'
TAB_UINT16 = 'UINT16'
TAB_UINT32 = 'UINT32'
Modified: trunk/BaseTools/Source/Python/Common/Misc.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/Misc.py 2012-05-29 08:21:34 UTC (rev 2528)
+++ trunk/BaseTools/Source/Python/Common/Misc.py 2012-05-31 03:07:05 UTC (rev 2529)
@@ -1236,12 +1236,12 @@
## AnalyzeVpdPcdData
#
-# Analyze the vpd pcd Value, Datum type and TokenNumber.
+# Analyze the vpd pcd VpdOffset, MaxDatumSize and InitialValue.
# Used to avoid split issue while the value string contain "|" character
#
-# @param[in] Setting: A String contain value/datum type/token number information;
+# @param[in] Setting: A String contain VpdOffset/MaxDatumSize/InitialValue information;
#
-# @retval ValueList: A List contain value, datum type and toke number.
+# @retval ValueList: A List contain VpdOffset, MaxDatumSize and InitialValue.
#
def AnalyzeVpdPcdData(Setting):
ValueList = ['', '', '']
@@ -1269,11 +1269,26 @@
#
def CheckPcdDatum(Type, Value):
if Type == "VOID*":
+ ValueRe = re.compile(r'\s*L?\".*\"\s*$')
if not (((Value.startswith('L"') or Value.startswith('"')) and Value.endswith('"'))
or (Value.startswith('{') and Value.endswith('}'))
):
return False, "Invalid value [%s] of type [%s]; must be in the form of {...} for array"\
- ", or \"...\" for string, or L\"...\" for unicode string" % (Value, Type)
+ ", or \"...\" for string, or L\"...\" for unicode string" % (Value, Type)
+ elif ValueRe.match(Value):
+ # Check the chars in UnicodeString or CString is printable
+ if Value.startswith("L"):
+ Value = Value[2:-1]
+ else:
+ Value = Value[1:-1]
+ Printset = set(string.printable)
+ Printset.remove(TAB_PRINTCHAR_VT)
+ Printset.add(TAB_PRINTCHAR_BS)
+ Printset.add(TAB_PRINTCHAR_NUL)
+ if not set(Value).issubset(Printset):
+ PrintList = list(Printset)
+ PrintList.sort()
+ return False, "Invalid PCD string value of type [%s]; must be printable chars %s." % (Type, PrintList)
elif Type == 'BOOLEAN':
if Value not in ['TRUE', 'True', 'true', '0x1', '0x01', '1', 'FALSE', 'False', 'false', '0x0', '0x00', '0']:
return False, "Invalid value [%s] of type [%s]; must be one of TRUE, True, true, 0x1, 0x01, 1"\
Modified: trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
===================================================================
--- trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py 2012-05-29 08:21:34 UTC (rev 2528)
+++ trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py 2012-05-31 03:07:05 UTC (rev 2529)
@@ -856,6 +856,20 @@
if PcdType in (MODEL_PCD_DYNAMIC_VPD, MODEL_PCD_DYNAMIC_EX_VPD):
if DecPcds[PcdCName, TokenSpaceGuid].DatumType == "VOID*":
PcdValue = AnalyzeVpdPcdData(Setting)[2]
+ PcdMaxDatumSize = AnalyzeVpdPcdData(Setting)[1]
+ # Check The MaxDatumSize is valid
+ try:
+ Value = long(PcdMaxDatumSize, 0)
+ except ValueError:
+ EdkLogger.error("build", FORMAT_INVALID, "PCD setting error",
+ File=self.MetaFile, Line=Dummy4,
+ ExtraData="\n\tPCD: The MaxDatumSize [%s] of %s.%s must be a hexadecimal or decimal in C language format in DSC: %s\n\t\t\n"
+ % (PcdMaxDatumSize, TokenSpaceGuid, PcdCName, self.MetaFile.Path))
+ if Value < 0x00 or Value > 0xFFFFFFFF:
+ EdkLogger.error("build", FORMAT_INVALID, "PCD setting error",
+ File=self.MetaFile, Line=Dummy4,
+ ExtraData="\n\tPCD: The MaxDatumSize [%s] of %s.%s exceed the valid scope(0x0 - 0xFFFFFFFF) in DSC: %s\n\t\t\n"
+ % (PcdMaxDatumSize, TokenSpaceGuid, PcdCName, self.MetaFile.Path))
else:
PcdValue = AnalyzeVpdPcdData(Setting)[1]
elif PcdType in (MODEL_PCD_DYNAMIC_HII, MODEL_PCD_DYNAMIC_EX_HII):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <hc...@us...> - 2012-06-01 01:45:03
|
Revision: 2530
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2530&view=rev
Author: hchen30
Date: 2012-06-01 01:44:56 +0000 (Fri, 01 Jun 2012)
Log Message:
-----------
1. Enhance build tool to break when there is an invalid section name in INF file.
2. Clean some format issues.
Reviewed-by: Yurui Zeng <yur...@in...>
Modified Paths:
--------------
trunk/BaseTools/Source/Python/Common/DataType.py
trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py
Modified: trunk/BaseTools/Source/Python/Common/DataType.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/DataType.py 2012-05-31 03:07:05 UTC (rev 2529)
+++ trunk/BaseTools/Source/Python/Common/DataType.py 2012-06-01 01:44:56 UTC (rev 2530)
@@ -27,14 +27,14 @@
TAB_SECTION_START = '['
TAB_SECTION_END = ']'
TAB_OPTION_START = '<'
-TAB_OPTION_END = '>'
+TAB_OPTION_END = '>'
TAB_SLASH = '\\'
TAB_BACK_SLASH = '/'
TAB_LINE_BREAK = '\n'
TAB_PRINTCHAR_VT = '\x0b'
TAB_PRINTCHAR_BS = '\b'
TAB_PRINTCHAR_NUL = '\0'
-TAB_UINT8 = 'UINT8'
+TAB_UINT8 = 'UINT8'
TAB_UINT16 = 'UINT16'
TAB_UINT32 = 'UINT32'
TAB_UINT64 = 'UINT64'
@@ -83,7 +83,7 @@
EDK_COMPONENT_TYPE_RT_DRIVER = 'RT_DRIVER'
EDK_COMPONENT_TYPE_SAL_RT_DRIVER = 'SAL_RT_DRIVER'
EDK_COMPONENT_TYPE_APPLICATION = 'APPLICATION'
-EDK_NAME = 'EDK'
+EDK_NAME = 'EDK'
EDKII_NAME = 'EDKII'
BINARY_FILE_TYPE_FW = 'FW'
@@ -340,7 +340,7 @@
TAB_INF_USAGE_SOME_PRO = 'SOMETIMES_PRODUCES'
TAB_INF_USAGE_CON = 'CONSUMES'
TAB_INF_USAGE_SOME_CON = 'SOMETIMES_CONSUMES'
-TAB_INF_USAGE_NOTIFY = 'NOTIFY'
+TAB_INF_USAGE_NOTIFY = 'NOTIFY'
TAB_INF_USAGE_TO_START = 'TO_START'
TAB_INF_USAGE_BY_START = 'BY_START'
TAB_INF_GUIDTYPE_EVENT = 'Event'
@@ -457,3 +457,16 @@
# Build Rule File Version Definition
#
TAB_BUILD_RULE_VERSION = "build_rule_version"
+
+# section name for PCDs
+TAB_PCDS_DYNAMIC_DEFAULT = "PcdsDynamicDefault"
+TAB_PCDS_DYNAMIC_VPD = "PcdsDynamicVpd"
+TAB_PCDS_DYNAMIC_HII = "PcdsDynamicHii"
+TAB_PCDS_DYNAMICEX_DEFAULT = "PcdsDynamicExDefault"
+TAB_PCDS_DYNAMICEX_VPD = "PcdsDynamicExVpd"
+TAB_PCDS_DYNAMICEX_HII = "PcdsDynamicExHii"
+
+# Section allowed to have items after arch
+SECTIONS_HAVE_ITEM_AFTER_ARCH = [TAB_LIBRARY_CLASSES.upper(), TAB_DEPEX.upper(), TAB_USER_EXTENSIONS.upper(),
+ TAB_PCDS_DYNAMIC_DEFAULT.upper(), TAB_PCDS_DYNAMIC_VPD.upper(), TAB_PCDS_DYNAMIC_HII.upper(),
+ TAB_PCDS_DYNAMICEX_DEFAULT.upper(), TAB_PCDS_DYNAMICEX_VPD.upper(), TAB_PCDS_DYNAMICEX_HII.upper()]
Modified: trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py
===================================================================
--- trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py 2012-05-31 03:07:05 UTC (rev 2529)
+++ trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py 2012-06-01 01:44:56 UTC (rev 2530)
@@ -44,7 +44,7 @@
# Syntax check
if not TokenList[0]:
EdkLogger.error('Parser', FORMAT_INVALID, "No macro name given",
- ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
if len(TokenList) < 2:
TokenList.append('')
@@ -53,11 +53,11 @@
# Global macros can be only defined via environment variable
if Name in GlobalData.gGlobalDefines:
EdkLogger.error('Parser', FORMAT_INVALID, "%s can only be defined via environment variable" % Name,
- ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
# Only upper case letters, digit and '_' are allowed
if not gMacroNamePattern.match(Name):
EdkLogger.error('Parser', FORMAT_INVALID, "The macro name must be in the pattern [A-Z][A-Z0-9_]*",
- ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
Value = ReplaceMacro(Value, self._Macros)
if Type in self.DataType:
@@ -85,14 +85,14 @@
# EDK_GLOBAL defined macros
elif type(self) != DscParser:
EdkLogger.error('Parser', FORMAT_INVALID, "EDK_GLOBAL can only be used in .dsc file",
- ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
elif self._SectionType != MODEL_META_DATA_HEADER:
EdkLogger.error('Parser', FORMAT_INVALID, "EDK_GLOBAL can only be used under [Defines] section",
- ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
elif (Name in self._FileLocalMacros) and (self._FileLocalMacros[Name] != Value):
EdkLogger.error('Parser', FORMAT_INVALID, "EDK_GLOBAL defined a macro with the same name and different value as one defined by 'DEFINE'",
- ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
-
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
+
self._ValueList = [Type, Name, Value]
return MacroParser
@@ -146,7 +146,7 @@
# @param Owner Owner ID (for sub-section parsing)
# @param From ID from which the data comes (for !INCLUDE directive)
#
- def __init__(self, FilePath, FileType, Table, Owner=-1, From=-1):
+ def __init__(self, FilePath, FileType, Table, Owner= -1, From= -1):
self._Table = Table
self._RawTable = Table
self._FileType = FileType
@@ -262,7 +262,7 @@
## Skip unsupported data
def _Skip(self):
EdkLogger.warn("Parser", "Unrecognized content", File=self.MetaFile,
- Line=self._LineIndex+1, ExtraData=self._CurrentLine);
+ Line=self._LineIndex + 1, ExtraData=self._CurrentLine);
self._ValueList[0:1] = [self._CurrentLine]
## Section header parser
@@ -282,20 +282,25 @@
# different section should not mix in one section
if self._SectionName != '' and self._SectionName != ItemList[0].upper():
EdkLogger.error('Parser', FORMAT_INVALID, "Different section names in the same section",
- File=self.MetaFile, Line=self._LineIndex+1, ExtraData=self._CurrentLine)
+ File=self.MetaFile, Line=self._LineIndex + 1, ExtraData=self._CurrentLine)
self._SectionName = ItemList[0].upper()
if self._SectionName in self.DataType:
self._SectionType = self.DataType[self._SectionName]
else:
self._SectionType = MODEL_UNKNOWN
EdkLogger.warn("Parser", "Unrecognized section", File=self.MetaFile,
- Line=self._LineIndex+1, ExtraData=self._CurrentLine)
+ Line=self._LineIndex + 1, ExtraData=self._CurrentLine)
# S1 is always Arch
if len(ItemList) > 1:
S1 = ItemList[1].upper()
+ if self._SectionName not in SECTIONS_HAVE_ITEM_AFTER_ARCH and len(ItemList) > 2:
+ EdkLogger.error("Parser", FORMAT_UNKNOWN_ERROR, "%s is not a valid section name" % Item,
+ self.MetaFile, self._LineIndex + 1, self._CurrentLine)
+
else:
S1 = 'COMMON'
ArchList.add(S1)
+
# S2 may be Platform or ModuleType
if len(ItemList) > 2:
S2 = ItemList[2].upper()
@@ -306,7 +311,7 @@
# 'COMMON' must not be used with specific ARCHs at the same section
if 'COMMON' in ArchList and len(ArchList) > 1:
EdkLogger.error('Parser', FORMAT_INVALID, "'common' ARCH must not be used with specific ARCHs",
- File=self.MetaFile, Line=self._LineIndex+1, ExtraData=self._CurrentLine)
+ File=self.MetaFile, Line=self._LineIndex + 1, ExtraData=self._CurrentLine)
# If the section information is needed later, it should be stored in database
self._ValueList[0] = self._SectionName
@@ -317,10 +322,10 @@
self._ValueList[1:len(TokenList)] = TokenList
if not self._ValueList[1]:
EdkLogger.error('Parser', FORMAT_INVALID, "No name specified",
- ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
if not self._ValueList[2]:
EdkLogger.error('Parser', FORMAT_INVALID, "No value specified",
- ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
self._ValueList = [ReplaceMacro(Value, self._Macros) for Value in self._ValueList]
Name, Value = self._ValueList[1], self._ValueList[2]
@@ -330,7 +335,7 @@
self._Version = int(Value, 0)
except:
EdkLogger.error('Parser', FORMAT_INVALID, "Invalid version number",
- ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
if type(self) == InfParser and self._Version < 0x00010005:
# EDK module allows using defines as macros
@@ -358,7 +363,7 @@
"'%s' must be in format of <TARGET>_<TOOLCHAIN>_<ARCH>_<TOOL>_FLAGS" % self._ValueList[1],
ExtraData=self._CurrentLine,
File=self.MetaFile,
- Line=self._LineIndex+1
+ Line=self._LineIndex + 1
)
def _GetMacros(self):
@@ -391,11 +396,11 @@
ComComMacroDict = {}
ComSpeMacroDict = {}
SpeSpeMacroDict = {}
-
+
ActiveSectionType = self._SectionType
if type(self) == DecParser:
ActiveSectionType = self._SectionType[0]
-
+
for (SectionType, Scope) in self._SectionsMacroDict:
if SectionType != ActiveSectionType:
continue
@@ -406,7 +411,7 @@
break
else:
SpeSpeMacroDict.update(self._SectionsMacroDict[(SectionType, Scope)])
-
+
for ActiveScope in self._Scope:
Scope0, Scope1 = ActiveScope[0], ActiveScope[1]
if(Scope0, Scope1) not in Scope and (Scope0, "COMMON") not in Scope and ("COMMON", Scope1) not in Scope:
@@ -423,9 +428,9 @@
return Macros
- _SectionParser = {}
- Finished = property(_GetFinished, _SetFinished)
- _Macros = property(_GetMacros)
+ _SectionParser = {}
+ Finished = property(_GetFinished, _SetFinished)
+ _Macros = property(_GetMacros)
## INF file parser class
@@ -527,13 +532,13 @@
MODEL_META_DATA_USER_EXTENSION]:
EdkLogger.error('Parser', FORMAT_INVALID,
"Section [%s] is not allowed in inf file without version" % (self._SectionName),
- ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
elif self._SectionType in [MODEL_EFI_INCLUDE,
MODEL_EFI_LIBRARY_INSTANCE,
MODEL_META_DATA_NMAKE]:
EdkLogger.error('Parser', FORMAT_INVALID,
"Section [%s] is not allowed in inf file with version 0x%08x" % (self._SectionName, self._Version),
- ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
continue
# merge two lines specified by '\' in section NMAKE
elif self._SectionType == MODEL_META_DATA_NMAKE:
@@ -553,7 +558,7 @@
NmakeLine = ''
# section content
- self._ValueList = ['','','']
+ self._ValueList = ['', '', '']
# parse current line, result will be put in self._ValueList
self._SectionParser[self._SectionType](self)
if self._ValueList == None or self._ItemType == MODEL_META_DATA_DEFINE:
@@ -571,14 +576,14 @@
Arch,
Platform,
self._Owner[-1],
- self._LineIndex+1,
- -1,
- self._LineIndex+1,
- -1,
+ self._LineIndex + 1,
+ - 1,
+ self._LineIndex + 1,
+ - 1,
0
)
if IsFindBlockComment:
- EdkLogger.error("Parser", FORMAT_INVALID, "Open block comments (starting with /*) are expected to end with */",
+ EdkLogger.error("Parser", FORMAT_INVALID, "Open block comments (starting with /*) are expected to end with */",
File=self.MetaFile)
self._Done()
@@ -636,15 +641,15 @@
if len(TokenList) < 2:
EdkLogger.error('Parser', FORMAT_INVALID, "No file type or path specified",
ExtraData=self._CurrentLine + " (<FileType> | <FilePath> [| <Target>])",
- File=self.MetaFile, Line=self._LineIndex+1)
+ File=self.MetaFile, Line=self._LineIndex + 1)
if not TokenList[0]:
EdkLogger.error('Parser', FORMAT_INVALID, "No file type specified",
ExtraData=self._CurrentLine + " (<FileType> | <FilePath> [| <Target>])",
- File=self.MetaFile, Line=self._LineIndex+1)
+ File=self.MetaFile, Line=self._LineIndex + 1)
if not TokenList[1]:
EdkLogger.error('Parser', FORMAT_INVALID, "No file path specified",
ExtraData=self._CurrentLine + " (<FileType> | <FilePath> [| <Target>])",
- File=self.MetaFile, Line=self._LineIndex+1)
+ File=self.MetaFile, Line=self._LineIndex + 1)
self._ValueList[0:len(TokenList)] = TokenList
self._ValueList[1] = ReplaceMacro(self._ValueList[1], self._Macros)
@@ -665,14 +670,14 @@
if len(ValueList) != 2:
EdkLogger.error('Parser', FORMAT_INVALID, "Illegal token space GUID and PCD name format",
ExtraData=self._CurrentLine + " (<TokenSpaceGuidCName>.<PcdCName>)",
- File=self.MetaFile, Line=self._LineIndex+1)
+ File=self.MetaFile, Line=self._LineIndex + 1)
self._ValueList[0:1] = ValueList
if len(TokenList) > 1:
self._ValueList[2] = TokenList[1]
if self._ValueList[0] == '' or self._ValueList[1] == '':
EdkLogger.error('Parser', FORMAT_INVALID, "No token space GUID or PCD name specified",
ExtraData=self._CurrentLine + " (<TokenSpaceGuidCName>.<PcdCName>)",
- File=self.MetaFile, Line=self._LineIndex+1)
+ File=self.MetaFile, Line=self._LineIndex + 1)
# if value are 'True', 'true', 'TRUE' or 'False', 'false', 'FALSE', replace with integer 1 or 0.
if self._ValueList[2] != '':
@@ -691,11 +696,11 @@
MODEL_UNKNOWN : MetaFileParser._Skip,
MODEL_META_DATA_HEADER : MetaFileParser._DefineParser,
MODEL_META_DATA_BUILD_OPTION : MetaFileParser._BuildOptionParser,
- MODEL_EFI_INCLUDE : _IncludeParser, # for Edk.x modules
- MODEL_EFI_LIBRARY_INSTANCE : MetaFileParser._CommonParser, # for Edk.x modules
+ MODEL_EFI_INCLUDE : _IncludeParser, # for Edk.x modules
+ MODEL_EFI_LIBRARY_INSTANCE : MetaFileParser._CommonParser, # for Edk.x modules
MODEL_EFI_LIBRARY_CLASS : MetaFileParser._PathParser,
MODEL_META_DATA_PACKAGE : MetaFileParser._PathParser,
- MODEL_META_DATA_NMAKE : _NmakeParser, # for Edk.x modules
+ MODEL_META_DATA_NMAKE : _NmakeParser, # for Edk.x modules
MODEL_PCD_FIXED_AT_BUILD : _PcdParser,
MODEL_PCD_PATCHABLE_IN_MODULE : _PcdParser,
MODEL_PCD_FEATURE_FLAG : _PcdParser,
@@ -781,7 +786,7 @@
# @param Owner Owner ID (for sub-section parsing)
# @param From ID from which the data comes (for !INCLUDE directive)
#
- def __init__(self, FilePath, FileType, Table, Owner=-1, From=-1):
+ def __init__(self, FilePath, FileType, Table, Owner= -1, From= -1):
# prevent re-initialization
if hasattr(self, "_Table"):
return
@@ -791,12 +796,12 @@
self._DirectiveStack = []
self._DirectiveEvalStack = []
self._Enabled = 1
-
+
#
# Specify whether current line is in uncertain condition
#
self._InDirective = -1
-
+
# Final valid replacable symbols
self._Symbols = {}
#
@@ -823,7 +828,7 @@
self._LineIndex = Index
if self._InSubsection and self._Owner[-1] == -1:
self._Owner.append(self._LastItem)
-
+
# section header
if Line[0] == TAB_SECTION_START and Line[-1] == TAB_SECTION_END:
self._SectionType = MODEL_META_DATA_SECTION_HEADER
@@ -866,10 +871,10 @@
ModuleType,
self._Owner[-1],
self._From,
- self._LineIndex+1,
- -1,
- self._LineIndex+1,
- -1,
+ self._LineIndex + 1,
+ - 1,
+ self._LineIndex + 1,
+ - 1,
self._Enabled
)
@@ -887,12 +892,12 @@
else:
self._SubsectionType = MODEL_UNKNOWN
EdkLogger.warn("Parser", "Unrecognized sub-section", File=self.MetaFile,
- Line=self._LineIndex+1, ExtraData=self._CurrentLine)
+ Line=self._LineIndex + 1, ExtraData=self._CurrentLine)
self._ValueList[0] = self._SubsectionName
## Directive statement parser
def _DirectiveParser(self):
- self._ValueList = ['','','']
+ self._ValueList = ['', '', '']
TokenList = GetSplitValueList(self._CurrentLine, ' ', 1)
self._ValueList[0:len(TokenList)] = TokenList
@@ -900,7 +905,7 @@
DirectiveName = self._ValueList[0].upper()
if DirectiveName not in self.DataType:
EdkLogger.error("Parser", FORMAT_INVALID, "Unknown directive [%s]" % DirectiveName,
- File=self.MetaFile, Line=self._LineIndex+1)
+ File=self.MetaFile, Line=self._LineIndex + 1)
if DirectiveName in ['!IF', '!IFDEF', '!IFNDEF']:
self._InDirective += 1
@@ -910,7 +915,7 @@
if DirectiveName in ['!IF', '!IFDEF', '!INCLUDE', '!IFNDEF', '!ELSEIF'] and self._ValueList[1] == '':
EdkLogger.error("Parser", FORMAT_INVALID, "Missing expression",
- File=self.MetaFile, Line=self._LineIndex+1,
+ File=self.MetaFile, Line=self._LineIndex + 1,
ExtraData=self._CurrentLine)
ItemType = self.DataType[DirectiveName]
@@ -928,7 +933,7 @@
break
else:
EdkLogger.error("Parser", FORMAT_INVALID, "Redundant '!endif'",
- File=self.MetaFile, Line=self._LineIndex+1,
+ File=self.MetaFile, Line=self._LineIndex + 1,
ExtraData=self._CurrentLine)
elif ItemType != MODEL_META_DATA_INCLUDE:
# Break if there's a !else is followed by a !elseif
@@ -936,14 +941,14 @@
self._DirectiveStack and \
self._DirectiveStack[-1][0] == MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE:
EdkLogger.error("Parser", FORMAT_INVALID, "'!elseif' after '!else'",
- File=self.MetaFile, Line=self._LineIndex+1,
+ File=self.MetaFile, Line=self._LineIndex + 1,
ExtraData=self._CurrentLine)
- self._DirectiveStack.append((ItemType, self._LineIndex+1, self._CurrentLine))
+ self._DirectiveStack.append((ItemType, self._LineIndex + 1, self._CurrentLine))
elif self._From > 0:
EdkLogger.error('Parser', FORMAT_INVALID,
"No '!include' allowed in included file",
- ExtraData=self._CurrentLine, File=self.MetaFile,
- Line=self._LineIndex+1)
+ ExtraData=self._CurrentLine, File=self.MetaFile,
+ Line=self._LineIndex + 1)
#
# Model, Value1, Value2, Value3, Arch, ModuleType, BelongsToItem=-1, BelongsToFile=-1,
@@ -959,10 +964,10 @@
ModuleType,
self._Owner[-1],
self._From,
- self._LineIndex+1,
- -1,
- self._LineIndex+1,
- -1,
+ self._LineIndex + 1,
+ - 1,
+ self._LineIndex + 1,
+ - 1,
0
)
@@ -975,16 +980,16 @@
# Syntax check
if not self._ValueList[1]:
EdkLogger.error('Parser', FORMAT_INVALID, "No name specified",
- ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
if not self._ValueList[2]:
EdkLogger.error('Parser', FORMAT_INVALID, "No value specified",
- ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
if not self._ValueList[1] in self.DefineKeywords:
EdkLogger.error('Parser', FORMAT_INVALID,
"Unknown keyword found: %s. "
"If this is a macro you must "
"add it as a DEFINE in the DSC" % self._ValueList[1],
- ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
self._Defines[self._ValueList[1]] = self._ValueList[2]
self._ItemType = self.DataType[TAB_DSC_DEFINES.upper()]
@@ -993,7 +998,7 @@
TokenList = GetSplitValueList(self._CurrentLine, TAB_VALUE_SPLIT)
if len(TokenList) != 2:
EdkLogger.error('Parser', FORMAT_INVALID, "Correct format is '<Integer>|<UiName>'",
- ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+ ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
self._ValueList[0:len(TokenList)] = TokenList
## Parse Edk style of library modules
@@ -1024,11 +1029,11 @@
if self._ValueList[0] == '' or self._ValueList[1] == '':
EdkLogger.error('Parser', FORMAT_INVALID, "No token space GUID or PCD name specified",
ExtraData=self._CurrentLine + " (<TokenSpaceGuidCName>.<TokenCName>|<PcdValue>)",
- File=self.MetaFile, Line=self._LineIndex+1)
+ File=self.MetaFile, Line=self._LineIndex + 1)
if self._ValueList[2] == '':
EdkLogger.error('Parser', FORMAT_INVALID, "No PCD value given",
ExtraData=self._CurrentLine + " (<TokenSpaceGuidCName>.<TokenCName>|<PcdValue>)",
- File=self.MetaFile, Line=self._LineIndex+1)
+ File=self.MetaFile, Line=self._LineIndex + 1)
# if value are 'True', 'true', 'TRUE' or 'False', 'false', 'FALSE', replace with integer 1 or 0.
DscPcdValueList = GetSplitValueList(TokenList[1], TAB_VALUE_SPLIT, 1)
if DscPcdValueList[0] in ['True', 'true', 'TRUE']:
@@ -1052,15 +1057,15 @@
if len(TokenList) < 2:
EdkLogger.error('Parser', FORMAT_INVALID, "No library class or instance specified",
ExtraData=self._CurrentLine + " (<LibraryClassName>|<LibraryInstancePath>)",
- File=self.MetaFile, Line=self._LineIndex+1)
+ File=self.MetaFile, Line=self._LineIndex + 1)
if TokenList[0] == '':
EdkLogger.error('Parser', FORMAT_INVALID, "No library class specified",
ExtraData=self._CurrentLine + " (<LibraryClassName>|<LibraryInstancePath>)",
- File=self.MetaFile, Line=self._LineIndex+1)
+ File=self.MetaFile, Line=self._LineIndex + 1)
if TokenList[1] == '':
EdkLogger.error('Parser', FORMAT_INVALID, "No library instance specified",
ExtraData=self._CurrentLine + " (<LibraryClassName>|<LibraryInstancePath>)",
- File=self.MetaFile, Line=self._LineIndex+1)
+ File=self.MetaFile, Line=self._LineIndex + 1)
self._ValueList[0:len(TokenList)] = TokenList
@@ -1088,7 +1093,7 @@
"'%s' must be in format of <TARGET>_<TOOLCHAIN>_<ARCH>_<TOOL>_FLAGS" % self._ValueList[1],
ExtraData=self._CurrentLine,
File=self.MetaFile,
- Line=self._LineIndex+1
+ Line=self._LineIndex + 1
)
## Override parent's method since we'll do all macro replacements in parser
@@ -1192,23 +1197,23 @@
" it must be defined in a [PcdsFixedAtBuild] or [PcdsFeatureFlag] section"
" of the DSC file, and it is currently defined in this section:"
" %s, line #: %d." % (Excpt.Pcd, Info[0], Info[1]),
- File=self._FileWithError, ExtraData=' '.join(self._ValueList),
- Line=self._LineIndex+1)
+ File=self._FileWithError, ExtraData=' '.join(self._ValueList),
+ Line=self._LineIndex + 1)
else:
EdkLogger.error('Parser', FORMAT_INVALID, "PCD (%s) is not defined in DSC file" % Excpt.Pcd,
- File=self._FileWithError, ExtraData=' '.join(self._ValueList),
- Line=self._LineIndex+1)
+ File=self._FileWithError, ExtraData=' '.join(self._ValueList),
+ Line=self._LineIndex + 1)
else:
EdkLogger.error('Parser', FORMAT_INVALID, "Invalid expression: %s" % str(Excpt),
- File=self._FileWithError, ExtraData=' '.join(self._ValueList),
- Line=self._LineIndex+1)
+ File=self._FileWithError, ExtraData=' '.join(self._ValueList),
+ Line=self._LineIndex + 1)
except MacroException, Excpt:
EdkLogger.error('Parser', FORMAT_INVALID, str(Excpt),
- File=self._FileWithError, ExtraData=' '.join(self._ValueList),
- Line=self._LineIndex+1)
+ File=self._FileWithError, ExtraData=' '.join(self._ValueList),
+ Line=self._LineIndex + 1)
if self._ValueList == None:
- continue
+ continue
NewOwner = self._IdMapping.get(Owner, -1)
self._Enabled = int((not self._DirectiveEvalStack) or (False not in self._DirectiveEvalStack))
@@ -1221,10 +1226,10 @@
S2,
NewOwner,
self._From,
- self._LineIndex+1,
- -1,
- ...
[truncated message content] |