|
From: <gi...@us...> - 2010-09-08 03:30:36
|
Revision: 2044
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2044&view=rev
Author: gikidy
Date: 2010-09-08 03:30:30 +0000 (Wed, 08 Sep 2010)
Log Message:
-----------
Retired VPD_FILENAME support.
Modified Paths:
--------------
trunk/BaseTools/Source/Python/AutoGen/AutoGen.py
trunk/BaseTools/Source/Python/Common/DataType.py
trunk/BaseTools/Source/Python/Common/VpdInfoFile.py
trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
Modified: trunk/BaseTools/Source/Python/AutoGen/AutoGen.py
===================================================================
--- trunk/BaseTools/Source/Python/AutoGen/AutoGen.py 2010-09-08 02:57:10 UTC (rev 2043)
+++ trunk/BaseTools/Source/Python/AutoGen/AutoGen.py 2010-09-08 03:30:30 UTC (rev 2044)
@@ -569,11 +569,9 @@
except:
EdkLogger.error("build", FILE_WRITE_FAILURE, "Fail to create FV folder under %s" % self.BuildDir)
- VpdFileName = self.Platform.VpdFileName
- if VpdFileName == None or VpdFileName == "" :
- VpdFilePath = os.path.join(FvPath, "%s.txt" % self.Platform.VpdToolGuid)
- else :
- VpdFilePath = os.path.join(FvPath, "%s.txt" % VpdFileName)
+
+ VpdFilePath = os.path.join(FvPath, "%s.txt" % self.Platform.VpdToolGuid)
+
if not os.path.exists(VpdFilePath) or os.path.getmtime(VpdFilePath) < DscTimeStamp:
VpdFile.Write(VpdFilePath)
@@ -588,16 +586,13 @@
break
# Call third party GUID BPDG tool.
if BPDGToolName != None:
- VpdInfoFile.CallExtenalBPDGTool(BPDGToolName, VpdFilePath, VpdFileName)
+ VpdInfoFile.CallExtenalBPDGTool(BPDGToolName, VpdFilePath)
else:
EdkLogger.error("Build", FILE_NOT_FOUND, "Fail to find third-party BPDG tool to process VPD PCDs. BPDG Guid tool need to be defined in tools_def.txt and VPD_TOOL_GUID need to be provided in DSC file.")
# Process VPD map file generated by third party BPDG tool
if NeedProcessVpdMapFile:
- if VpdFileName == None or VpdFileName == "" :
- VpdMapFilePath = os.path.join(self.BuildDir, "FV", "%s.map" % self.Platform.VpdToolGuid)
- else :
- VpdMapFilePath = os.path.join(self.BuildDir, "FV", "%s.map" % VpdFileName)
+ VpdMapFilePath = os.path.join(self.BuildDir, "FV", "%s.map" % self.Platform.VpdToolGuid)
if os.path.exists(VpdMapFilePath):
VpdFile.Read(VpdMapFilePath)
Modified: trunk/BaseTools/Source/Python/Common/DataType.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/DataType.py 2010-09-08 02:57:10 UTC (rev 2043)
+++ trunk/BaseTools/Source/Python/Common/DataType.py 2010-09-08 03:30:30 UTC (rev 2044)
@@ -355,7 +355,6 @@
TAB_DSC_DEFINES_RT_BASE_ADDRESS = 'RtBaseAddress'
TAB_DSC_DEFINES_DEFINE = 'DEFINE'
TAB_DSC_DEFINES_VPD_TOOL_GUID = 'VPD_TOOL_GUID'
-TAB_DSC_DEFINES_VPD_FILENAME = 'VPD_FILENAME'
TAB_FIX_LOAD_TOP_MEMORY_ADDRESS = 'FIX_LOAD_TOP_MEMORY_ADDRESS'
#
Modified: trunk/BaseTools/Source/Python/Common/VpdInfoFile.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/VpdInfoFile.py 2010-09-08 02:57:10 UTC (rev 2043)
+++ trunk/BaseTools/Source/Python/Common/VpdInfoFile.py 2010-09-08 03:30:30 UTC (rev 2044)
@@ -219,28 +219,23 @@
# @param ToolPath The string path name for BPDG tool
# @param VpdFileName The string path name for VPD information guid.txt
#
-def CallExtenalBPDGTool(ToolPath, VpdFilePath, VpdFileName):
+def CallExtenalBPDGTool(ToolPath, VpdFileName):
assert ToolPath != None, "Invalid parameter ToolPath"
- assert VpdFilePath != None and os.path.exists(VpdFilePath), "Invalid parameter VpdFileName"
+ assert VpdFileName != None and os.path.exists(VpdFileName), "Invalid parameter VpdFileName"
- OutputDir = os.path.dirname(VpdFilePath)
- if (VpdFileName == None or VpdFileName == "") :
- FileName = os.path.basename(VpdFilePath)
- BaseName, ext = os.path.splitext(FileName)
- OutputMapFileName = os.path.join(OutputDir, "%s.map" % BaseName)
- OutputBinFileName = os.path.join(OutputDir, "%s.bin" % BaseName)
- else :
- OutputMapFileName = os.path.join(OutputDir, "%s.map" % VpdFileName)
- OutputBinFileName = os.path.join(OutputDir, "%s.bin" % VpdFileName)
+ OutputDir = os.path.dirname(VpdFileName)
+ FileName = os.path.basename(VpdFileName)
+ BaseName, ext = os.path.splitext(FileName)
+ OutputMapFileName = os.path.join(OutputDir, "%s.map" % BaseName)
+ OutputBinFileName = os.path.join(OutputDir, "%s.bin" % BaseName)
try:
PopenObject = subprocess.Popen([ToolPath,
'-o', OutputBinFileName,
'-m', OutputMapFileName,
- '-s',
+ '-q',
'-f',
- '-v',
- VpdFilePath],
+ VpdFileName],
stdout=subprocess.PIPE,
stderr= subprocess.PIPE)
except Exception, X:
Modified: trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
===================================================================
--- trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py 2010-09-08 02:57:10 UTC (rev 2043)
+++ trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py 2010-09-08 03:30:30 UTC (rev 2044)
@@ -141,7 +141,6 @@
self._BuildOptions = None
self._LoadFixAddress = None
self._VpdToolGuid = None
- self._VpdFileName = None
## Get architecture
def _GetArch(self):
@@ -204,9 +203,7 @@
uuid.UUID(Record[1])
except:
EdkLogger.error("build", FORMAT_INVALID, "Invalid GUID format for VPD_TOOL_GUID", File=self.MetaFile)
- self._VpdToolGuid = Record[1]
- elif Name == TAB_DSC_DEFINES_VPD_FILENAME:
- self._VpdFileName = Record[1]
+ self._VpdToolGuid = Record[1]
# set _Header to non-None in order to avoid database re-querying
self._Header = 'DUMMY'
@@ -350,16 +347,7 @@
if self._VpdToolGuid == None:
self._VpdToolGuid = ''
return self._VpdToolGuid
-
- ## Retrieve the VPD file Name, this is optional in DSC file
- def _GetVpdFileName(self):
- if self._VpdFileName == None:
- if self._Header == None:
- self._GetHeaderInfo()
- if self._VpdFileName == None:
- self._VpdFileName = ''
- return self._VpdFileName
-
+
## Retrieve [SkuIds] section information
def _GetSkuIds(self):
if self._SkuIds == None:
@@ -802,8 +790,7 @@
BsBaseAddress = property(_GetBsBaseAddress)
RtBaseAddress = property(_GetRtBaseAddress)
LoadFixAddress = property(_GetLoadFixAddress)
- VpdToolGuid = property(_GetVpdToolGuid)
- VpdFileName = property(_GetVpdFileName)
+ VpdToolGuid = property(_GetVpdToolGuid)
SkuIds = property(_GetSkuIds)
Modules = property(_GetModules)
LibraryInstances = property(_GetLibraryInstances)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gi...@us...> - 2010-09-16 07:46:58
|
Revision: 2053
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2053&view=rev
Author: gikidy
Date: 2010-09-16 07:46:51 +0000 (Thu, 16 Sep 2010)
Log Message:
-----------
Expend INF's [Define] syntax to support human readable string for *_VERSION:
The HumanReadable String is a decimal value, major version followed by '.', followed by minor version, detailed definition/example can be found in INF spec, section 3.4
Modified Paths:
--------------
trunk/BaseTools/Source/Python/Common/String.py
trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py
trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
Modified: trunk/BaseTools/Source/Python/Common/String.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/String.py 2010-09-16 03:15:29 UTC (rev 2052)
+++ trunk/BaseTools/Source/Python/Common/String.py 2010-09-16 07:46:51 UTC (rev 2053)
@@ -23,6 +23,9 @@
from GlobalData import *
from BuildToolError import *
+gHexVerPatt = re.compile('0x[a-f0-9]{4}[a-f0-9]{4}$',re.IGNORECASE)
+gHumanReadableVerPatt = re.compile('([1-9][0-9]*|0)\.[0-9]{1,2}$')
+
## GetSplitValueList
#
# Get a value list from a string with multiple values splited with SplitTag
@@ -377,6 +380,31 @@
String = CleanString(String)
return String[String.find(Key + ' ') + len(Key + ' ') : ]
+## GetHexVerValue
+#
+# Get a Hex Version Value
+#
+# @param VerString: The version string to be parsed
+#
+# @retval: If VerString is ill-formated string, return None, else return the Hex format version
+#
+def GetHexVerValue(VerString):
+ VerString = CleanString(VerString)
+
+ if gHumanReadableVerPatt.match(VerString):
+ ValueList = VerString.split('.')
+ Major = ValueList[0]
+ Minor = ValueList[1]
+ if len(Minor) == 1:
+ Minor += '0'
+ DeciValue = (int(Major) << 16) + int(Minor);
+ return "0x%08x"%DeciValue
+ elif gHexVerPatt.match(VerString):
+ return VerString
+ else:
+ return None
+
+
## GetSingleValueOfKeyFromLines
#
# Parse multiple strings as below to get value of each definition line
Modified: trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py
===================================================================
--- trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py 2010-09-16 03:15:29 UTC (rev 2052)
+++ trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py 2010-09-16 07:46:51 UTC (rev 2053)
@@ -474,11 +474,11 @@
def _DefineParser(self):
TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1)
self._ValueList[0:len(TokenList)] = TokenList
- self._Macros[TokenList[0]] = ReplaceMacro(TokenList[1], self._Macros, False)
if self._ValueList[1] == '':
EdkLogger.error('Parser', FORMAT_INVALID, "No value specified",
ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
-
+ self._Macros[TokenList[0]] = ReplaceMacro(TokenList[1], self._Macros, False)
+
## [nmake] section parser (R8.x style only)
def _NmakeParser(self):
TokenList = GetSplitValueList(self._CurrentLine, TAB_EQUAL_SPLIT, 1)
Modified: trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
===================================================================
--- trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py 2010-09-16 03:15:29 UTC (rev 2052)
+++ trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py 2010-09-16 07:46:51 UTC (rev 2053)
@@ -1317,18 +1317,16 @@
if Name in self:
self[Name] = Record[1]
# some special items in [Defines] section need special treatment
- elif Name in ('EFI_SPECIFICATION_VERSION', 'UEFI_SPECIFICATION_VERSION'):
+ elif Name in ('EFI_SPECIFICATION_VERSION', 'UEFI_SPECIFICATION_VERSION', 'EDK_RELEASE_VERSION', 'PI_SPECIFICATION_VERSION'):
+ if Name in ('EFI_SPECIFICATION_VERSION', 'UEFI_SPECIFICATION_VERSION'):
+ Name = 'UEFI_SPECIFICATION_VERSION'
if self._Specification == None:
self._Specification = sdict()
- self._Specification['UEFI_SPECIFICATION_VERSION'] = Record[1]
- elif Name == 'EDK_RELEASE_VERSION':
- if self._Specification == None:
- self._Specification = sdict()
- self._Specification[Name] = Record[1]
- elif Name == 'PI_SPECIFICATION_VERSION':
- if self._Specification == None:
- self._Specification = sdict()
- self._Specification[Name] = Record[1]
+ self._Specification[Name] = GetHexVerValue(Record[1])
+ if self._Specification[Name] == None:
+ EdkLogger.error("build", FORMAT_NOT_SUPPORTED,
+ "'%s' format is not supported for %s" % (Record[1], Name),
+ File=self.MetaFile, Line=Record[-1])
elif Name == 'LIBRARY_CLASS':
if self._LibraryClass == None:
self._LibraryClass = []
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2010-09-19 08:59:54
|
Revision: 2054
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2054&view=rev
Author: jsu1
Date: 2010-09-19 08:59:47 +0000 (Sun, 19 Sep 2010)
Log Message:
-----------
optional support of [sources] of INF
For the following BNF in [sources] section of INF
<expression> ::= <Filename> [<Options>] <EOL>
<Options> ::= "|" [<Family>] [<opt1>]
<opt1> ::= "|" [<TagName>] [<opt2>]
<opt2> ::= "|" [<ToolCode>] [<opt3>]
Add support of "*" for <Family> and <TagName>
Modified Paths:
--------------
trunk/BaseTools/Source/Python/AutoGen/AutoGen.py
trunk/BaseTools/Source/Python/Common/String.py
Modified: trunk/BaseTools/Source/Python/AutoGen/AutoGen.py
===================================================================
--- trunk/BaseTools/Source/Python/AutoGen/AutoGen.py 2010-09-16 07:46:51 UTC (rev 2053)
+++ trunk/BaseTools/Source/Python/AutoGen/AutoGen.py 2010-09-19 08:59:47 UTC (rev 2054)
@@ -1713,12 +1713,12 @@
self._SourceFileList = []
for F in self.Module.Sources:
# match tool chain
- if F.TagName != "" and F.TagName != self.ToolChain:
+ if F.TagName not in ("", "*", self.ToolChain):
EdkLogger.debug(EdkLogger.DEBUG_9, "The toolchain [%s] for processing file [%s] is found, "
"but [%s] is needed" % (F.TagName, str(F), self.ToolChain))
continue
# match tool chain family
- if F.ToolChainFamily != "" and F.ToolChainFamily != self.ToolChainFamily:
+ if F.ToolChainFamily not in ("", "*", self.ToolChainFamily):
EdkLogger.debug(
EdkLogger.DEBUG_0,
"The file [%s] must be built by tools of [%s], " \
Modified: trunk/BaseTools/Source/Python/Common/String.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/String.py 2010-09-16 07:46:51 UTC (rev 2053)
+++ trunk/BaseTools/Source/Python/Common/String.py 2010-09-19 08:59:47 UTC (rev 2054)
@@ -24,7 +24,7 @@
from BuildToolError import *
gHexVerPatt = re.compile('0x[a-f0-9]{4}[a-f0-9]{4}$',re.IGNORECASE)
-gHumanReadableVerPatt = re.compile('([1-9][0-9]*|0)\.[0-9]{1,2}$')
+gHumanReadableVerPatt = re.compile(r'([1-9][0-9]*|0)\.[0-9]{1,2}$')
## GetSplitValueList
#
@@ -386,8 +386,11 @@
#
# @param VerString: The version string to be parsed
#
-# @retval: If VerString is ill-formated string, return None, else return the Hex format version
#
+# @retval: If VerString is incorrectly formatted, return "None" which will break the build.
+# If VerString is correctly formatted, return a Hex value of the Version Number (0xmmmmnnnn)
+# where mmmm is the major number and nnnn is the adjusted minor number.
+#
def GetHexVerValue(VerString):
VerString = CleanString(VerString)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gi...@us...> - 2010-09-25 03:10:23
|
Revision: 2056
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2056&view=rev
Author: gikidy
Date: 2010-09-25 03:10:17 +0000 (Sat, 25 Sep 2010)
Log Message:
-----------
Remove MULTIPLE_THREAD support since MAX_CONCURRENT_THREAD_NUMBER can be used to do the same.
Modified Paths:
--------------
trunk/BaseTools/Source/Python/Common/DataType.py
trunk/BaseTools/Source/Python/Common/TargetTxtClassObject.py
trunk/BaseTools/Source/Python/TargetTool/TargetTool.py
Modified: trunk/BaseTools/Source/Python/Common/DataType.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/DataType.py 2010-09-20 00:49:47 UTC (rev 2055)
+++ trunk/BaseTools/Source/Python/Common/DataType.py 2010-09-25 03:10:17 UTC (rev 2056)
@@ -363,7 +363,6 @@
TAB_TAT_DEFINES_ACTIVE_PLATFORM = 'ACTIVE_PLATFORM'
TAB_TAT_DEFINES_ACTIVE_MODULE = 'ACTIVE_MODULE'
TAB_TAT_DEFINES_TOOL_CHAIN_CONF = 'TOOL_CHAIN_CONF'
-TAB_TAT_DEFINES_MULTIPLE_THREAD = 'MULTIPLE_THREAD'
TAB_TAT_DEFINES_MAX_CONCURRENT_THREAD_NUMBER = 'MAX_CONCURRENT_THREAD_NUMBER'
TAB_TAT_DEFINES_TARGET = 'TARGET'
TAB_TAT_DEFINES_TOOL_CHAIN_TAG = 'TOOL_CHAIN_TAG'
Modified: trunk/BaseTools/Source/Python/Common/TargetTxtClassObject.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/TargetTxtClassObject.py 2010-09-20 00:49:47 UTC (rev 2055)
+++ trunk/BaseTools/Source/Python/Common/TargetTxtClassObject.py 2010-09-25 03:10:17 UTC (rev 2056)
@@ -1,7 +1,7 @@
## @file
# This file is used to define each component of Target.txt file
#
-# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
+# 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
@@ -37,7 +37,6 @@
DataType.TAB_TAT_DEFINES_ACTIVE_PLATFORM : '',
DataType.TAB_TAT_DEFINES_ACTIVE_MODULE : '',
DataType.TAB_TAT_DEFINES_TOOL_CHAIN_CONF : '',
- DataType.TAB_TAT_DEFINES_MULTIPLE_THREAD : '',
DataType.TAB_TAT_DEFINES_MAX_CONCURRENT_THREAD_NUMBER : '',
DataType.TAB_TAT_DEFINES_TARGET : [],
DataType.TAB_TAT_DEFINES_TOOL_CHAIN_TAG : [],
@@ -102,12 +101,6 @@
elif Key in [DataType.TAB_TAT_DEFINES_TARGET, DataType.TAB_TAT_DEFINES_TARGET_ARCH, \
DataType.TAB_TAT_DEFINES_TOOL_CHAIN_TAG]:
self.TargetTxtDictionary[Key] = Value.split()
- elif Key == DataType.TAB_TAT_DEFINES_MULTIPLE_THREAD:
- if Value not in ["Enable", "Disable"]:
- EdkLogger.error("build", FORMAT_INVALID, "Invalid setting of [%s]: %s." % (Key, Value),
- ExtraData="\tSetting must be one of [Enable, Disable]",
- File=FileName)
- self.TargetTxtDictionary[Key] = Value
elif Key == DataType.TAB_TAT_DEFINES_MAX_CONCURRENT_THREAD_NUMBER:
try:
V = int(Value, 0)
Modified: trunk/BaseTools/Source/Python/TargetTool/TargetTool.py
===================================================================
--- trunk/BaseTools/Source/Python/TargetTool/TargetTool.py 2010-09-20 00:49:47 UTC (rev 2055)
+++ trunk/BaseTools/Source/Python/TargetTool/TargetTool.py 2010-09-25 03:10:17 UTC (rev 2056)
@@ -33,7 +33,6 @@
self.TargetTxtDictionary = {
TAB_TAT_DEFINES_ACTIVE_PLATFORM : None,
TAB_TAT_DEFINES_TOOL_CHAIN_CONF : None,
- TAB_TAT_DEFINES_MULTIPLE_THREAD : None,
TAB_TAT_DEFINES_MAX_CONCURRENT_THREAD_NUMBER : None,
TAB_TAT_DEFINES_TARGET : None,
TAB_TAT_DEFINES_TOOL_CHAIN_TAG : None,
@@ -44,7 +43,7 @@
def LoadTargetTxtFile(self, filename):
if os.path.exists(filename) and os.path.isfile(filename):
- return self.ConvertTextFileToDict(filename, '#', '=')
+ return self.ConvertTextFileToDict(filename, '#', '=')
else:
raise ParseError('LoadTargetTxtFile() : No Target.txt file exists.')
return 1
@@ -64,7 +63,7 @@
Key = LineList[0].strip()
if Key.startswith(CommentCharacter) == False and Key in self.TargetTxtDictionary.keys():
if Key == TAB_TAT_DEFINES_ACTIVE_PLATFORM or Key == TAB_TAT_DEFINES_TOOL_CHAIN_CONF \
- or Key == TAB_TAT_DEFINES_MULTIPLE_THREAD or Key == TAB_TAT_DEFINES_MAX_CONCURRENT_THREAD_NUMBER \
+ or Key == TAB_TAT_DEFINES_MAX_CONCURRENT_THREAD_NUMBER \
or Key == TAB_TAT_DEFINES_ACTIVE_MODULE:
self.TargetTxtDictionary[Key] = LineList[1].replace('\\', '/').strip()
elif Key == TAB_TAT_DEFINES_TARGET or Key == TAB_TAT_DEFINES_TARGET_ARCH \
@@ -149,15 +148,13 @@
else:
EdkLogger.error("TagetTool", BuildToolError.FILE_NOT_FOUND,
"Tooldef file %s does not exist!" % self.Opt.TOOL_DEFINITION_FILE, RaiseError=False)
- elif Key == TAB_TAT_DEFINES_MULTIPLE_THREAD and self.Opt.NUM != None:
- if self.Opt.NUM >= 2:
- Line = "%-30s = %s\n" % (Key, 'Enable')
- else:
- Line = "%-30s = %s\n" % (Key, 'Disable')
+
+ elif self.Opt.NUM >= 2:
+ Line = "%-30s = %s\n" % (Key, 'Enable')
+ elif self.Opt.NUM <= 1:
+ Line = "%-30s = %s\n" % (Key, 'Disable')
elif Key == TAB_TAT_DEFINES_MAX_CONCURRENT_THREAD_NUMBER and self.Opt.NUM != None:
Line = "%-30s = %s\n" % (Key, str(self.Opt.NUM))
- elif Key == TAB_TAT_DEFINES_MULTIPLE_THREAD and self.Opt.ENABLE_MULTI_THREAD != None:
- Line = "%-30s = %s\n" % (Key, self.Opt.ENABLE_MULTI_THREAD)
elif Key == TAB_TAT_DEFINES_TARGET and self.Opt.TARGET != None:
Line = "%-30s = %s\n" % (Key, ''.join(elem + ' ' for elem in self.Opt.TARGET))
elif Key == TAB_TAT_DEFINES_TARGET_ARCH and self.Opt.TARGET_ARCH != None:
@@ -216,8 +213,6 @@
help="Specify the build rule configure file, which replaces target.txt's BUILD_RULE_CONF definition. If not specified, the default value Conf/build_rule.txt will be set.")
parser.add_option("-m", "--multithreadnum", action="callback", type="int", dest="NUM", callback=RangeCheckCallback,
help="Specify the multi-thread number which replace target.txt's MAX_CONCURRENT_THREAD_NUMBER. If the value is less than 2, MULTIPLE_THREAD will be disabled. If the value is larger than 1, MULTIPLE_THREAD will be enabled.")
- parser.add_option("-e", "--enablemultithread", action="store", type="choice", choices=['Enable', 'Disable'], dest="ENABLE_MULTI_THREAD",
- help="Specify whether enable multi-thread! If Enable, multi-thread is enabled; If Disable, mutli-thread is disable")
(opt, args)=parser.parse_args()
return (opt, args)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gi...@us...> - 2010-09-25 03:22:49
|
Revision: 2058
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2058&view=rev
Author: gikidy
Date: 2010-09-25 03:22:42 +0000 (Sat, 25 Sep 2010)
Log Message:
-----------
Fixed some PyLint issues and typo;
Modified Paths:
--------------
trunk/BaseTools/Source/Python/Common/BuildToolError.py
trunk/BaseTools/Source/Python/Common/Dictionary.py
trunk/BaseTools/Source/Python/Common/ToolDefClassObject.py
trunk/BaseTools/Source/Python/CommonDataClass/CommonClass.py
trunk/BaseTools/Source/Python/CommonDataClass/DistributionPackageClass.py
trunk/BaseTools/Source/Python/PackagingTool/DependencyRules.py
trunk/BaseTools/Source/Python/build/build.py
Modified: trunk/BaseTools/Source/Python/Common/BuildToolError.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/BuildToolError.py 2010-09-25 03:15:26 UTC (rev 2057)
+++ trunk/BaseTools/Source/Python/Common/BuildToolError.py 2010-09-25 03:22:42 UTC (rev 2058)
@@ -1,7 +1,7 @@
## @file
# Standardized Error Hanlding infrastructures.
#
-# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
+# 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
@@ -125,7 +125,7 @@
RESOURCE_FULL : "Full",
RESOURCE_OVERFLOW : "Overflow",
RESOURCE_UNDERRUN : "Underrun",
- RESOURCE_UNKNOWN_ERROR : "Unkown error",
+ RESOURCE_UNKNOWN_ERROR : "Unknown error",
ATTRIBUTE_NOT_AVAILABLE : "Not available",
ATTRIBUTE_GET_FAILURE : "Failed to retrieve",
Modified: trunk/BaseTools/Source/Python/Common/Dictionary.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/Dictionary.py 2010-09-25 03:15:26 UTC (rev 2057)
+++ trunk/BaseTools/Source/Python/Common/Dictionary.py 2010-09-25 03:22:42 UTC (rev 2058)
@@ -25,26 +25,26 @@
# @retval 1 Open file failed
#
def ConvertTextFileToDictionary(FileName, Dictionary, CommentCharacter, KeySplitCharacter, ValueSplitFlag, ValueSplitCharacter):
- try:
- F = open(FileName,'r')
- Keys = []
- for Line in F:
- if Line.startswith(CommentCharacter):
- continue
- LineList = Line.split(KeySplitCharacter,1)
- if len(LineList) >= 2:
- Key = LineList[0].split()
- if len(Key) == 1 and Key[0][0] != CommentCharacter and Key[0] not in Keys:
- if ValueSplitFlag:
- Dictionary[Key[0]] = LineList[1].replace('\\','/').split(ValueSplitCharacter)
- else:
- Dictionary[Key[0]] = LineList[1].strip().replace('\\','/')
- Keys += [Key[0]]
- F.close()
- return 0
- except:
- EdkLogger.info('Open file failed')
- return 1
+ try:
+ F = open(FileName,'r')
+ Keys = []
+ for Line in F:
+ if Line.startswith(CommentCharacter):
+ continue
+ LineList = Line.split(KeySplitCharacter,1)
+ if len(LineList) >= 2:
+ Key = LineList[0].split()
+ if len(Key) == 1 and Key[0][0] != CommentCharacter and Key[0] not in Keys:
+ if ValueSplitFlag:
+ Dictionary[Key[0]] = LineList[1].replace('\\','/').split(ValueSplitCharacter)
+ else:
+ Dictionary[Key[0]] = LineList[1].strip().replace('\\','/')
+ Keys += [Key[0]]
+ F.close()
+ return 0
+ except:
+ EdkLogger.info('Open file failed')
+ return 1
## Print the dictionary
#
@@ -53,11 +53,11 @@
# @param Dict: The dictionary to be printed
#
def printDict(Dict):
- if Dict != None:
- KeyList = Dict.keys()
- for Key in KeyList:
- if Dict[Key] != '':
- print Key + ' = ' + str(Dict[Key])
+ if Dict != None:
+ KeyList = Dict.keys()
+ for Key in KeyList:
+ if Dict[Key] != '':
+ print Key + ' = ' + str(Dict[Key])
## Print the dictionary
#
@@ -67,9 +67,9 @@
# @param key: The key of the item to be printed
#
def printList(Key, List):
- if type(List) == type([]):
- if len(List) > 0:
- if key.find(TAB_SPLIT) != -1:
- print "\n" + Key
- for Item in List:
- print Item
+ if type(List) == type([]):
+ if len(List) > 0:
+ if Key.find(TAB_SPLIT) != -1:
+ print "\n" + Key
+ for Item in List:
+ print Item
Modified: trunk/BaseTools/Source/Python/Common/ToolDefClassObject.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/ToolDefClassObject.py 2010-09-25 03:15:26 UTC (rev 2057)
+++ trunk/BaseTools/Source/Python/Common/ToolDefClassObject.py 2010-09-25 03:22:42 UTC (rev 2058)
@@ -23,7 +23,7 @@
from TargetTxtClassObject import *
##
-# Static vailabes used for pattern
+# Static variables used for pattern
#
gMacroRefPattern = re.compile('(DEF\([^\(\)]+\))')
gEnvRefPattern = re.compile('(ENV\([^\(\)]+\))')
Modified: trunk/BaseTools/Source/Python/CommonDataClass/CommonClass.py
===================================================================
--- trunk/BaseTools/Source/Python/CommonDataClass/CommonClass.py 2010-09-25 03:15:26 UTC (rev 2057)
+++ trunk/BaseTools/Source/Python/CommonDataClass/CommonClass.py 2010-09-25 03:22:42 UTC (rev 2058)
@@ -1,7 +1,7 @@
## @file
# This file is used to define common items of class object
#
-# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
+# 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
@@ -53,7 +53,7 @@
self.HelpText = HelpText
self.HelpTextList = []
-## CommonClass
+## CommonHeaderClass
#
# This class defined common items used in Module/Platform/Package files
#
@@ -301,7 +301,7 @@
# @retval Rtn Formatted String
#
def __str__(self):
- Rtn = Rtn = 'SkuId = ' + str(self.SkuId) + "," + \
+ Rtn = 'SkuId = ' + str(self.SkuId) + "," + \
'SkuIdName = ' + str(self.SkuIdName) + "," + \
'VariableName = ' + str(self.VariableName) + "," + \
'VariableGuid = ' + str(self.VariableGuid) + "," + \
Modified: trunk/BaseTools/Source/Python/CommonDataClass/DistributionPackageClass.py
===================================================================
--- trunk/BaseTools/Source/Python/CommonDataClass/DistributionPackageClass.py 2010-09-25 03:15:26 UTC (rev 2057)
+++ trunk/BaseTools/Source/Python/CommonDataClass/DistributionPackageClass.py 2010-09-25 03:22:42 UTC (rev 2058)
@@ -150,7 +150,6 @@
# script.
#
if __name__ == '__main__':
- pass
D = DistributionPackageClass()
D.GetDistributionPackage(os.getenv('WORKSPACE'), ['MdePkg/MdePkg.dec', 'TianoModulePkg/TianoModulePkg.dec'], ['MdeModulePkg/Application/HelloWorld/HelloWorld.inf'])
Xml = DistributionPackageXml()
Modified: trunk/BaseTools/Source/Python/PackagingTool/DependencyRules.py
===================================================================
--- trunk/BaseTools/Source/Python/PackagingTool/DependencyRules.py 2010-09-25 03:15:26 UTC (rev 2057)
+++ trunk/BaseTools/Source/Python/PackagingTool/DependencyRules.py 2010-09-25 03:22:42 UTC (rev 2058)
@@ -1,7 +1,7 @@
## @file
# This file is for installed package information database operations
#
-# Copyright (c) 2007 - 2008, Intel Corporation. All rights reserved.<BR>
+# 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
@@ -25,7 +25,7 @@
## IpiDb
#
-# This class represents the installed package information databse
+# This class represents the installed package information database
# Add/Remove/Get installed distribution package information here.
#
#
@@ -57,7 +57,7 @@
return False
- ## Check whether a module depex satified by current workspace.
+ ## Check whether a module depex satisfied by current workspace.
#
# @param ModuleObj:
# @param DpObj:
@@ -103,7 +103,7 @@
EdkLogger.verbose("Check package exists in workspace ... DONE!")
- ## Check whether a package depex satified by current workspace.
+ ## Check whether a package depex satisfied by current workspace.
#
# @param ModuleObj:
# @param DpObj:
@@ -135,7 +135,7 @@
EdkLogger.verbose("Check DP exists in workspace ... DONE!")
- ## Check whether a DP depex satified by current workspace.
+ ## Check whether a DP depex satisfied by current workspace.
#
# @param ModuleObj:
# @param DpObj:
@@ -158,7 +158,7 @@
return True
- ## Check whether a DP depex satified by current workspace.
+ ## Check whether a DP depex satisfied by current workspace.
#
# @param ModuleObj:
# @param DpObj:
Modified: trunk/BaseTools/Source/Python/build/build.py
===================================================================
--- trunk/BaseTools/Source/Python/build/build.py 2010-09-25 03:15:26 UTC (rev 2057)
+++ trunk/BaseTools/Source/Python/build/build.py 2010-09-25 03:22:42 UTC (rev 2058)
@@ -305,7 +305,7 @@
## str() method
#
- # It just returns the string representaion of self.BuildObject
+ # It just returns the string representation of self.BuildObject
#
# @param self The object pointer
#
@@ -943,7 +943,7 @@
## Build a module or platform
#
- # Create autogen code and makfile for a module or platform, and the launch
+ # Create autogen code and makefile for a module or platform, and the launch
# "make" command to build it
#
# @param Target The target of build command
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gi...@us...> - 2010-10-13 05:04:03
|
Revision: 2067
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2067&view=rev
Author: gikidy
Date: 2010-10-13 05:03:57 +0000 (Wed, 13 Oct 2010)
Log Message:
-----------
support format other than "TRUE", "FALSE" for a boolean type PCD, more precisely, following formats are supported:
'TRUE', 'true', 'True', '0x01', '0x1', '1'
'FALSE', 'false', 'False', '0x00', '0x0', '0'
Modified Paths:
--------------
trunk/BaseTools/Source/Python/Common/Misc.py
trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py
Modified: trunk/BaseTools/Source/Python/Common/Misc.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/Misc.py 2010-10-13 01:16:08 UTC (rev 2066)
+++ trunk/BaseTools/Source/Python/Common/Misc.py 2010-10-13 05:03:57 UTC (rev 2067)
@@ -1178,8 +1178,9 @@
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)
elif Type == 'BOOLEAN':
- if Value not in ['TRUE', 'FALSE']:
- return False, "Invalid value [%s] of type [%s]; must be TRUE or FALSE" % (Value, Type)
+ 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"\
+ ", FALSE, False, false, 0x0, 0x00, 0" % (Value, Type)
elif type(Value) == type(""):
try:
Value = long(Value, 0)
Modified: trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py
===================================================================
--- trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py 2010-10-13 01:16:08 UTC (rev 2066)
+++ trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py 2010-10-13 05:03:57 UTC (rev 2067)
@@ -503,6 +503,13 @@
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)
+ # if value are 'True', 'true', 'TRUE' or 'False', 'false', 'FALSE', replace with integer 1 or 0.
+ if self._ValueList[2] != '':
+ InfPcdValueList = GetSplitValueList(TokenList[1], TAB_VALUE_SPLIT, 1)
+ if InfPcdValueList[0] in ['True', 'true', 'TRUE']:
+ self._ValueList[2] = TokenList[1].replace(InfPcdValueList[0], '1', 1);
+ elif InfPcdValueList[0] in ['False', 'false', 'FALSE']:
+ self._ValueList[2] = TokenList[1].replace(InfPcdValueList[0], '0', 1);
## [depex] section parser
def _DepexParser(self):
@@ -929,7 +936,13 @@
EdkLogger.error('Parser', FORMAT_INVALID, "No PCD value given",
ExtraData=self._CurrentLine + " (<TokenSpaceGuidCName>.<TokenCName>|<PcdValue>)",
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']:
+ self._ValueList[2] = TokenList[1].replace(DscPcdValueList[0], '1', 1);
+ elif DscPcdValueList[0] in ['False', 'false', 'FALSE']:
+ self._ValueList[2] = TokenList[1].replace(DscPcdValueList[0], '0', 1);
+
## [components] section parser
def _ComponentParser(self):
if self._CurrentLine[-1] == '{':
@@ -1226,6 +1239,10 @@
if not IsValid:
EdkLogger.error('Parser', FORMAT_INVALID, Cause, ExtraData=self._CurrentLine,
File=self.MetaFile, Line=self._LineIndex+1)
+ if ValueList[0] in ['True', 'true', 'TRUE']:
+ ValueList[0] = '1'
+ elif ValueList[0] in ['False', 'false', 'FALSE']:
+ ValueList[0] = '0'
self._ValueList[2] = ValueList[0].strip() + '|' + ValueList[1].strip() + '|' + ValueList[2].strip()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gi...@us...> - 2010-10-22 05:48:38
|
Revision: 2075
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2075&view=rev
Author: gikidy
Date: 2010-10-22 05:48:32 +0000 (Fri, 22 Oct 2010)
Log Message:
-----------
Support "|" character in void star type pcd value string
Modified Paths:
--------------
trunk/BaseTools/Source/Python/BPDG/GenVpd.py
trunk/BaseTools/Source/Python/Common/Misc.py
trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py
trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
Modified: trunk/BaseTools/Source/Python/BPDG/GenVpd.py
===================================================================
--- trunk/BaseTools/Source/Python/BPDG/GenVpd.py 2010-10-16 18:45:56 UTC (rev 2074)
+++ trunk/BaseTools/Source/Python/BPDG/GenVpd.py 2010-10-22 05:48:32 UTC (rev 2075)
@@ -17,6 +17,7 @@
import StringIO
import StringTable as st
import array
+import re
from struct import *
import Common.EdkLogger as EdkLogger
@@ -338,8 +339,27 @@
line = line.rstrip(os.linesep)
# Skip the comment line
- if (not line.startswith("#")) and len(line) > 1 :
- self.FileLinesList[count] = line.split('|')
+ if (not line.startswith("#")) and len(line) > 1 :
+ #
+ # Enhanced for support "|" character in the string.
+ #
+ ValueList = ['', '', '', '']
+
+ ValueRe = re.compile(r'\s*L?\".*\|.*\"\s*$')
+ PtrValue = ValueRe.findall(line)
+
+ ValueUpdateFlag = False
+
+ if len(PtrValue) >= 1:
+ line = re.sub(ValueRe, '', line)
+ ValueUpdateFlag = True
+
+ TokenList = line.split('|')
+ ValueList[0:len(TokenList)] = TokenList
+
+ if ValueUpdateFlag:
+ ValueList[3] = PtrValue[0]
+ self.FileLinesList[count] = ValueList
# Store the line number
self.FileLinesList[count].append(str(count+1))
elif len(line) <= 1 :
Modified: trunk/BaseTools/Source/Python/Common/Misc.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/Misc.py 2010-10-16 18:45:56 UTC (rev 2074)
+++ trunk/BaseTools/Source/Python/Common/Misc.py 2010-10-22 05:48:32 UTC (rev 2075)
@@ -1,7 +1,7 @@
## @file
# Common routines used by all tools
#
-# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
+# 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
@@ -28,7 +28,7 @@
from Common import EdkLogger as EdkLogger
from Common import GlobalData as GlobalData
-
+from DataType import *
from BuildToolError import *
## Regular expression used to find out place holders in string template
@@ -1166,6 +1166,93 @@
Opr.close()
Opw.close()
+## AnalyzePcdData
+#
+# Analyze the pcd Value, Datum type and TokenNumber.
+# Used to avoid split issue while the value string contain "|" character
+#
+# @param[in] Setting: A String contain value/datum type/token number information;
+#
+# @retval ValueList: A List contain value, datum type and toke number.
+#
+def AnalyzePcdData(Setting):
+ ValueList = ['', '', '']
+
+ ValueRe = re.compile(r'^\s*L?\".*\|.*\"')
+ PtrValue = ValueRe.findall(Setting)
+
+ ValueUpdateFlag = False
+
+ if len(PtrValue) >= 1:
+ Setting = re.sub(ValueRe, '', Setting)
+ ValueUpdateFlag = True
+
+ TokenList = Setting.split(TAB_VALUE_SPLIT)
+ ValueList[0:len(TokenList)] = TokenList
+
+ if ValueUpdateFlag:
+ ValueList[0] = PtrValue[0]
+
+ return ValueList
+
+## AnalyzeHiiPcdData
+#
+# Analyze the pcd Value, variable name, variable Guid and variable offset.
+# Used to avoid split issue while the value string contain "|" character
+#
+# @param[in] Setting: A String contain VariableName, VariableGuid, VariableOffset, DefaultValue information;
+#
+# @retval ValueList: A List contaian VariableName, VariableGuid, VariableOffset, DefaultValue.
+#
+def AnalyzeHiiPcdData(Setting):
+ ValueList = ['', '', '', '']
+
+ ValueRe = re.compile(r'^\s*L?\".*\|.*\"')
+ PtrValue = ValueRe.findall(Setting)
+
+ ValueUpdateFlag = False
+
+ if len(PtrValue) >= 1:
+ Setting = re.sub(ValueRe, '', Setting)
+ ValueUpdateFlag = True
+
+ TokenList = Setting.split(TAB_VALUE_SPLIT)
+ ValueList[0:len(TokenList)] = TokenList
+
+ if ValueUpdateFlag:
+ ValueList[0] = PtrValue[0]
+
+ return ValueList
+
+## AnalyzeVpdPcdData
+#
+# Analyze the vpd pcd Value, Datum type and TokenNumber.
+# Used to avoid split issue while the value string contain "|" character
+#
+# @param[in] Setting: A String contain value/datum type/token number information;
+#
+# @retval ValueList: A List contain value, datum type and toke number.
+#
+def AnalyzeVpdPcdData(Setting):
+ ValueList = ['', '', '']
+
+ ValueRe = re.compile(r'\s*L?\".*\|.*\"\s*$')
+ PtrValue = ValueRe.findall(Setting)
+
+ ValueUpdateFlag = False
+
+ if len(PtrValue) >= 1:
+ Setting = re.sub(ValueRe, '', Setting)
+ ValueUpdateFlag = True
+
+ TokenList = Setting.split(TAB_VALUE_SPLIT)
+ ValueList[0:len(TokenList)] = TokenList
+
+ if ValueUpdateFlag:
+ ValueList[2] = PtrValue[0]
+
+ return ValueList
+
## check format of PCD value against its the datum type
#
# For PCD value setting
Modified: trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py
===================================================================
--- trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py 2010-10-16 18:45:56 UTC (rev 2074)
+++ trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py 2010-10-22 05:48:32 UTC (rev 2075)
@@ -1209,7 +1209,19 @@
" (<TokenSpaceGuidCName>.<PcdCName>|<DefaultValue>|<DatumType>|<Token>)",
File=self.MetaFile, Line=self._LineIndex+1)
- ValueList = GetSplitValueList(TokenList[1])
+
+ ValueRe = re.compile(r'^\s*L?\".*\|.*\"')
+ PtrValue = ValueRe.findall(TokenList[1])
+
+ # Has VOID* type string, may contain "|" character in the string.
+ if len(PtrValue) != 0:
+ ptrValueList = re.sub(ValueRe, '', TokenList[1])
+ ValueList = GetSplitValueList(ptrValueList)
+ ValueList[0] = PtrValue[0]
+ else:
+ ValueList = GetSplitValueList(TokenList[1])
+
+
# check if there's enough datum information given
if len(ValueList) != 3:
EdkLogger.error('Parser', FORMAT_INVALID, "Invalid PCD Datum information given",
Modified: trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
===================================================================
--- trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py 2010-10-16 18:45:56 UTC (rev 2074)
+++ trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py 2010-10-22 05:48:32 UTC (rev 2075)
@@ -588,13 +588,10 @@
PcdDict[Arch, PcdCName, TokenSpaceGuid] = Setting
# Remove redundant PCD candidates
for PcdCName, TokenSpaceGuid in PcdSet:
- ValueList = ['', '', '']
Setting = PcdDict[self._Arch, PcdCName, TokenSpaceGuid]
if Setting == None:
continue
- TokenList = Setting.split(TAB_VALUE_SPLIT)
- ValueList[0:len(TokenList)] = TokenList
- PcdValue, DatumType, MaxDatumSize = ValueList
+ PcdValue, DatumType, MaxDatumSize = AnalyzePcdData(Setting)
Pcds[PcdCName, TokenSpaceGuid] = PcdClassObject(
PcdCName,
TokenSpaceGuid,
@@ -630,14 +627,12 @@
PcdDict[Arch, SkuName, PcdCName, TokenSpaceGuid] = Setting
# Remove redundant PCD candidates, per the ARCH and SKU
for PcdCName, TokenSpaceGuid in PcdSet:
- ValueList = ['', '', '']
Setting = PcdDict[self._Arch, self.SkuName, PcdCName, TokenSpaceGuid]
if Setting == None:
continue
- TokenList = Setting.split(TAB_VALUE_SPLIT)
- ValueList[0:len(TokenList)] = TokenList
- PcdValue, DatumType, MaxDatumSize = ValueList
-
+
+ PcdValue, DatumType, MaxDatumSize = AnalyzePcdData(Setting)
+
SkuInfo = SkuInfoClass(self.SkuName, self.SkuIds[self.SkuName], '', '', '', '', '', PcdValue)
Pcds[PcdCName, TokenSpaceGuid] = PcdClassObject(
PcdCName,
@@ -674,13 +669,10 @@
PcdDict[Arch, SkuName, PcdCName, TokenSpaceGuid] = Setting
# Remove redundant PCD candidates, per the ARCH and SKU
for PcdCName, TokenSpaceGuid in PcdSet:
- ValueList = ['', '', '', '']
Setting = PcdDict[self._Arch, self.SkuName, PcdCName, TokenSpaceGuid]
if Setting == None:
continue
- TokenList = Setting.split(TAB_VALUE_SPLIT)
- ValueList[0:len(TokenList)] = TokenList
- VariableName, VariableGuid, VariableOffset, DefaultValue = ValueList
+ VariableName, VariableGuid, VariableOffset, DefaultValue = AnalyzeHiiPcdData(Setting)
SkuInfo = SkuInfoClass(self.SkuName, self.SkuIds[self.SkuName], VariableName, VariableGuid, VariableOffset, DefaultValue)
Pcds[PcdCName, TokenSpaceGuid] = PcdClassObject(
PcdCName,
@@ -717,19 +709,16 @@
PcdDict[Arch, SkuName, PcdCName, TokenSpaceGuid] = Setting
# Remove redundant PCD candidates, per the ARCH and SKU
for PcdCName, TokenSpaceGuid in PcdSet:
- ValueList = ['', '', '']
Setting = PcdDict[self._Arch, self.SkuName, PcdCName, TokenSpaceGuid]
if Setting == None:
continue
- TokenList = Setting.split(TAB_VALUE_SPLIT)
- ValueList[0:len(TokenList)] = TokenList
#
# For the VOID* type, it can have optional data of MaxDatumSize and InitialValue
# For the Integer & Boolean type, the optional data can only be InitialValue.
# At this point, we put all the data into the PcdClssObject for we don't know the PCD's datumtype
# until the DEC parser has been called.
#
- VpdOffset, MaxDatumSize, InitialValue = ValueList
+ VpdOffset, MaxDatumSize, InitialValue = AnalyzeVpdPcdData(Setting)
SkuInfo = SkuInfoClass(self.SkuName, self.SkuIds[self.SkuName], '', '', '', '', VpdOffset, InitialValue)
Pcds[PcdCName, TokenSpaceGuid] = PcdClassObject(
@@ -1083,7 +1072,6 @@
PcdSet.add((PcdCName, TokenSpaceGuid))
for PcdCName, TokenSpaceGuid in PcdSet:
- ValueList = ['', '', '']
#
# limit the ARCH to self._Arch, if no self._Arch found, tdict
# will automatically turn to 'common' ARCH and try again
@@ -1091,9 +1079,9 @@
Setting = PcdDict[self._Arch, PcdCName, TokenSpaceGuid]
if Setting == None:
continue
- TokenList = Setting.split(TAB_VALUE_SPLIT)
- ValueList[0:len(TokenList)] = TokenList
- DefaultValue, DatumType, TokenNumber = ValueList
+
+ DefaultValue, DatumType, TokenNumber = AnalyzePcdData(Setting)
+
Pcds[PcdCName, TokenSpaceGuid, self._PCD_TYPE_STRING_[Type]] = PcdClassObject(
PcdCName,
TokenSpaceGuid,
@@ -1937,12 +1925,10 @@
# resolve PCD type, value, datum info, etc. by getting its definition from package
for PcdCName, TokenSpaceGuid in PcdSet:
- ValueList = ['', '']
Setting, LineNo = PcdDict[self._Arch, self.Platform, PcdCName, TokenSpaceGuid]
if Setting == None:
continue
- TokenList = Setting.split(TAB_VALUE_SPLIT)
- ValueList[0:len(TokenList)] = TokenList
+ ValueList = AnalyzePcdData(Setting)
DefaultValue = ValueList[0]
Pcd = PcdClassObject(
PcdCName,
@@ -1980,6 +1966,35 @@
PcdInPackage = Package.Pcds[PcdCName, TokenSpaceGuid, PcdType]
Pcd.Type = PcdType
Pcd.TokenValue = PcdInPackage.TokenValue
+
+ if len(Pcd.TokenValue) != 10:
+ EdkLogger.error(
+ 'build',
+ FORMAT_INVALID,
+ "The length of TokenValue [%s] of PCD [%s.%s] in [%s] is invalid:" % (Pcd.TokenValue, TokenSpaceGuid, PcdCName, str(Package)),
+ File =self.MetaFile, Line=LineNo,
+ ExtraData=None
+ )
+ if Pcd.TokenValue.startswith("0x") or Pcd.TokenValue.startswith("0X"):
+ try:
+ int (Pcd.TokenValue, 16)
+ except:
+ EdkLogger.error(
+ 'build',
+ FORMAT_INVALID,
+ "The format of TokenValue [%s] of PCD [%s.%s] in [%s] is invalid:" % (Pcd.TokenValue, TokenSpaceGuid, PcdCName, str(Package)),
+ File =self.MetaFile, Line=LineNo,
+ ExtraData=None
+ )
+ else:
+ EdkLogger.error(
+ 'build',
+ FORMAT_INVALID,
+ "The format of TokenValue [%s] of PCD [%s.%s] in [%s] is invalid: should start with \"0X\" or \"0x\""% (Pcd.TokenValue, TokenSpaceGuid, PcdCName, str(Package)),
+ File =self.MetaFile, Line=LineNo,
+ ExtraData=None
+ )
+
Pcd.DatumType = PcdInPackage.DatumType
Pcd.MaxDatumSize = PcdInPackage.MaxDatumSize
Pcd.InfDefaultValue = Pcd.DefaultValue
@@ -1989,12 +2004,13 @@
else:
EdkLogger.error(
'build',
- PARSER_ERROR,
+ FORMAT_INVALID,
"PCD [%s.%s] in [%s] is not found in dependent packages:" % (TokenSpaceGuid, PcdCName, self.MetaFile),
File =self.MetaFile, Line=LineNo,
ExtraData="\t%s" % '\n\t'.join([str(P) for P in self.Packages])
)
Pcds[PcdCName, TokenSpaceGuid] = Pcd
+
return Pcds
Arch = property(_GetArch, _SetArch)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gi...@us...> - 2010-11-02 01:47:19
|
Revision: 2081
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2081&view=rev
Author: gikidy
Date: 2010-11-02 01:47:12 +0000 (Tue, 02 Nov 2010)
Log Message:
-----------
Fix the token value format/length check, and also the conflict check.
Modified Paths:
--------------
trunk/BaseTools/Source/Python/AutoGen/AutoGen.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 2010-11-02 01:15:30 UTC (rev 2080)
+++ trunk/BaseTools/Source/Python/AutoGen/AutoGen.py 2010-11-02 01:47:12 UTC (rev 2081)
@@ -189,7 +189,12 @@
#
Pa.CollectPlatformDynamicPcds()
self.AutoGenObjectList.append(Pa)
-
+
+ #
+ # Check PCDs token value conflict in each DEC file.
+ #
+ self._CheckAllPcdsTokenValueConflict()
+
self._BuildDir = None
self._FvDir = None
self._MakeFileDir = None
@@ -248,6 +253,54 @@
# BuildCommand should be all the same. So just get one from platform AutoGen
self._BuildCommand = self.AutoGenObjectList[0].BuildCommand
return self._BuildCommand
+
+ ## Check the PCDs token value conflict in each DEC file.
+ #
+ # Will cause build break and raise error message while two PCDs conflict.
+ #
+ # @return None
+ #
+ def _CheckAllPcdsTokenValueConflict(self):
+ if len(self.BuildDatabase.WorkspaceDb.PackageList) >= 1:
+ for Package in self.BuildDatabase.WorkspaceDb.PackageList:
+ PcdList = Package.Pcds.values()
+ PcdList.sort(lambda x, y: cmp(x.TokenValue, y.TokenValue))
+ Count = 0
+ while (Count < len(PcdList) - 1) :
+ Item = PcdList[Count]
+ ItemNext = PcdList[Count + 1]
+ #
+ # Make sure in the same token space the TokenValue should be unique
+ #
+ if (Item.TokenValue == ItemNext.TokenValue) and (Item.TokenSpaceGuidCName == ItemNext.TokenSpaceGuidCName) and (Item.TokenCName != ItemNext.TokenCName):
+ EdkLogger.error(
+ 'build',
+ FORMAT_INVALID,
+ "The TokenValue [%s] of PCD [%s.%s] is conflict with: [%s.%s] in %s"\
+ % (Item.TokenValue, Item.TokenSpaceGuidCName, Item.TokenCName, ItemNext.TokenSpaceGuidCName, ItemNext.TokenCName, Package),
+ ExtraData=None
+ )
+ Count += 1
+
+ PcdList = Package.Pcds.values()
+ PcdList.sort(lambda x, y: cmp("%s.%s"%(x.TokenSpaceGuidCName, x.TokenCName), "%s.%s"%(y.TokenSpaceGuidCName, y.TokenCName)))
+ Count = 0
+ while (Count < len(PcdList) - 1) :
+ Item = PcdList[Count]
+ ItemNext = PcdList[Count + 1]
+ #
+ # Check PCDs with same TokenSpaceGuidCName.TokenCName have same token value as well.
+ #
+ if (Item.TokenSpaceGuidCName == ItemNext.TokenSpaceGuidCName) and (Item.TokenCName == ItemNext.TokenCName) and (Item.TokenValue != ItemNext.TokenValue):
+ EdkLogger.error(
+ 'build',
+ FORMAT_INVALID,
+ "The TokenValue [%s] of PCD [%s.%s] in %s defined in two places should be same as well."\
+ % (Item.TokenValue, Item.TokenSpaceGuidCName, Item.TokenCName, Package),
+ ExtraData=None
+ )
+ Count += 1
+
## Create makefile for the platform and modules in it
#
Modified: trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
===================================================================
--- trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py 2010-11-02 01:15:30 UTC (rev 2080)
+++ trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py 2010-11-02 01:47:12 UTC (rev 2081)
@@ -1966,7 +1966,30 @@
PcdInPackage = Package.Pcds[PcdCName, TokenSpaceGuid, PcdType]
Pcd.Type = PcdType
Pcd.TokenValue = PcdInPackage.TokenValue
+
+ #
+ # Check whether the token value exist or not.
+ #
+ if Pcd.TokenValue == None or Pcd.TokenValue == "":
+ EdkLogger.error(
+ 'build',
+ FORMAT_INVALID,
+ "No TokenValue for PCD [%s.%s] in [%s]!" % (Pcd.TokenValue, TokenSpaceGuid, PcdCName, str(Package)),
+ File =self.MetaFile, Line=LineNo,
+ ExtraData=None
+ )
+ #
+ # Check hexadecimal token value length and format.
+ #
if Pcd.TokenValue.startswith("0x") or Pcd.TokenValue.startswith("0X"):
+ if len(Pcd.TokenValue) < 3 or len(Pcd.TokenValue) > 10:
+ EdkLogger.error(
+ 'build',
+ FORMAT_INVALID,
+ "The format of TokenValue [%s] of PCD [%s.%s] in [%s] is invalid:" % (Pcd.TokenValue, TokenSpaceGuid, PcdCName, str(Package)),
+ File =self.MetaFile, Line=LineNo,
+ ExtraData=None
+ )
try:
int (Pcd.TokenValue, 16)
except:
@@ -1977,14 +2000,29 @@
File =self.MetaFile, Line=LineNo,
ExtraData=None
)
+
+ #
+ # Check decimal token value length and format.
+ #
else:
- EdkLogger.error(
- 'build',
- FORMAT_INVALID,
- "The format of TokenValue [%s] of PCD [%s.%s] in [%s] is invalid: should start with \"0X\" or \"0x\""% (Pcd.TokenValue, TokenSpaceGuid, PcdCName, str(Package)),
- File =self.MetaFile, Line=LineNo,
- ExtraData=None
- )
+ try:
+ TokenValueInt = int (Pcd.TokenValue, 10)
+ if (TokenValueInt < 0 or TokenValueInt > 4294967295):
+ EdkLogger.error(
+ 'build',
+ FORMAT_INVALID,
+ "The format of TokenValue [%s] of PCD [%s.%s] in [%s] is invalid, as a decimal it should between: 0 - 4294967295!"% (Pcd.TokenValue, TokenSpaceGuid, PcdCName, str(Package)),
+ File =self.MetaFile, Line=LineNo,
+ ExtraData=None
+ )
+ except:
+ EdkLogger.error(
+ 'build',
+ FORMAT_INVALID,
+ "The format of TokenValue [%s] of PCD [%s.%s] in [%s] is invalid, it should be hexadecimal or decimal!"% (Pcd.TokenValue, TokenSpaceGuid, PcdCName, str(Package)),
+ File =self.MetaFile, Line=LineNo,
+ ExtraData=None
+ )
Pcd.DatumType = PcdInPackage.DatumType
Pcd.MaxDatumSize = PcdInPackage.MaxDatumSize
Modified: trunk/BaseTools/Source/Python/build/build.py
===================================================================
--- trunk/BaseTools/Source/Python/build/build.py 2010-11-02 01:15:30 UTC (rev 2080)
+++ trunk/BaseTools/Source/Python/build/build.py 2010-11-02 01:47:12 UTC (rev 2081)
@@ -999,7 +999,7 @@
EdkLogger.error("build", FILE_DELETE_FAILURE, ExtraData=str(X))
return True
- ## Rebase module image and Get function address for the inpug module list.
+ ## Rebase module image and Get function address for the input module list.
#
def _RebaseModule (self, MapBuffer, BaseAddress, ModuleList, AddrIsOffset = True, ModeIsSmm = False):
if ModeIsSmm:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gi...@us...> - 2010-11-03 05:48:36
|
Revision: 2083
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2083&view=rev
Author: gikidy
Date: 2010-11-03 05:48:30 +0000 (Wed, 03 Nov 2010)
Log Message:
-----------
Enhanced the conflict check for process more than 2 PCDs' token value conflict.
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 2010-11-03 02:23:17 UTC (rev 2082)
+++ trunk/BaseTools/Source/Python/AutoGen/AutoGen.py 2010-11-03 05:48:30 UTC (rev 2083)
@@ -272,14 +272,35 @@
#
# Make sure in the same token space the TokenValue should be unique
#
- if (Item.TokenValue == ItemNext.TokenValue) and (Item.TokenSpaceGuidCName == ItemNext.TokenSpaceGuidCName) and (Item.TokenCName != ItemNext.TokenCName):
- EdkLogger.error(
- 'build',
- FORMAT_INVALID,
- "The TokenValue [%s] of PCD [%s.%s] is conflict with: [%s.%s] in %s"\
- % (Item.TokenValue, Item.TokenSpaceGuidCName, Item.TokenCName, ItemNext.TokenSpaceGuidCName, ItemNext.TokenCName, Package),
- ExtraData=None
- )
+ if (Item.TokenValue == ItemNext.TokenValue):
+ SameTokenValuePcdList = []
+ SameTokenValuePcdList.append(Item)
+ SameTokenValuePcdList.append(ItemNext)
+ RemainPcdListLength = len(PcdList) - Count - 2
+ for ValueSameCount in range(RemainPcdListLength):
+ if PcdList[len(PcdList) - RemainPcdListLength + ValueSameCount].TokenValue == Item.TokenValue:
+ SameTokenValuePcdList.append(PcdList[len(PcdList) - RemainPcdListLength + ValueSameCount])
+ else:
+ break;
+ #
+ # Sort same token value PCD list with TokenGuid and TokenCName
+ #
+ SameTokenValuePcdList.sort(lambda x, y: cmp("%s.%s"%(x.TokenSpaceGuidCName, x.TokenCName), "%s.%s"%(y.TokenSpaceGuidCName, y.TokenCName)))
+ SameTokenValuePcdListCount = 0
+ while (SameTokenValuePcdListCount < len(SameTokenValuePcdList) - 1):
+ TemListItem = SameTokenValuePcdList[SameTokenValuePcdListCount]
+ TemListItemNext = SameTokenValuePcdList[SameTokenValuePcdListCount + 1]
+
+ if (TemListItem.TokenSpaceGuidCName == TemListItemNext.TokenSpaceGuidCName) and (TemListItem.TokenCName != TemListItemNext.TokenCName):
+ EdkLogger.error(
+ 'build',
+ FORMAT_INVALID,
+ "The TokenValue [%s] of PCD [%s.%s] is conflict with: [%s.%s] in %s"\
+ % (TemListItem.TokenValue, TemListItem.TokenSpaceGuidCName, TemListItem.TokenCName, TemListItemNext.TokenSpaceGuidCName, TemListItemNext.TokenCName, Package),
+ ExtraData=None
+ )
+ SameTokenValuePcdListCount += 1
+ Count += SameTokenValuePcdListCount
Count += 1
PcdList = Package.Pcds.values()
Modified: trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
===================================================================
--- trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py 2010-11-03 02:23:17 UTC (rev 2082)
+++ trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py 2010-11-03 05:48:30 UTC (rev 2083)
@@ -1974,7 +1974,7 @@
EdkLogger.error(
'build',
FORMAT_INVALID,
- "No TokenValue for PCD [%s.%s] in [%s]!" % (Pcd.TokenValue, TokenSpaceGuid, PcdCName, str(Package)),
+ "No TokenValue for PCD [%s.%s] in [%s]!" % (TokenSpaceGuid, PcdCName, str(Package)),
File =self.MetaFile, Line=LineNo,
ExtraData=None
)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2010-11-09 01:41:33
|
Revision: 2089
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2089&view=rev
Author: jsu1
Date: 2010-11-09 01:41:26 +0000 (Tue, 09 Nov 2010)
Log Message:
-----------
add support for language filter features: use the RFC_LANGUAGES or ISO_LANGUAGES in [defines] section of DSC to filter the unicode strings. Details refer to DSC spec, Table 2 and Section 3.4
Modified Paths:
--------------
trunk/BaseTools/Source/Python/AutoGen/GenC.py
trunk/BaseTools/Source/Python/AutoGen/StrGather.py
trunk/BaseTools/Source/Python/Common/DataType.py
trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
Modified: trunk/BaseTools/Source/Python/AutoGen/GenC.py
===================================================================
--- trunk/BaseTools/Source/Python/AutoGen/GenC.py 2010-11-08 09:05:12 UTC (rev 2088)
+++ trunk/BaseTools/Source/Python/AutoGen/GenC.py 2010-11-09 01:41:26 UTC (rev 2089)
@@ -1860,8 +1860,10 @@
IncList = [Info.MetaFile.Dir]
# Get all files under [Sources] section in inf file for EDK-II module
+ EDK2Module = True
SrcList = [F for F in Info.SourceFileList]
if Info.AutoGenVersion < 0x00010005:
+ EDK2Module = False
# Get all files under the module directory for EDK-I module
Cwd = os.getcwd()
os.chdir(Info.MetaFile.Dir)
@@ -1883,7 +1885,7 @@
CompatibleMode = False
#
- # -s is a temporary option dedicated for building .UNI files with ISO 639-2 lanauge codes of EDK Shell in EDK2
+ # -s is a temporary option dedicated for building .UNI files with ISO 639-2 language codes of EDK Shell in EDK2
#
if 'BUILD' in Info.BuildOption and Info.BuildOption['BUILD']['FLAGS'].find('-s') > -1:
if CompatibleMode:
@@ -1894,7 +1896,12 @@
else:
ShellMode = False
- Header, Code = GetStringFiles(Info.UnicodeFileList, SrcList, IncList, Info.IncludePathList, ['.uni', '.inf'], Info.Name, CompatibleMode, ShellMode, UniGenCFlag, UniGenBinBuffer)
+ #RFC4646 is only for EDKII modules and ISO639-2 for EDK modules
+ if EDK2Module:
+ FilterInfo = [EDK2Module] + [Info.PlatformInfo.Platform.RFCLanguages]
+ else:
+ FilterInfo = [EDK2Module] + [Info.PlatformInfo.Platform.ISOLanguages]
+ Header, Code = GetStringFiles(Info.UnicodeFileList, SrcList, IncList, Info.IncludePathList, ['.uni', '.inf'], Info.Name, CompatibleMode, ShellMode, UniGenCFlag, UniGenBinBuffer, FilterInfo)
if CompatibleMode or UniGenCFlag:
AutoGenC.Append("\n//\n//Unicode String Pack Definition\n//\n")
AutoGenC.Append(Code)
Modified: trunk/BaseTools/Source/Python/AutoGen/StrGather.py
===================================================================
--- trunk/BaseTools/Source/Python/AutoGen/StrGather.py 2010-11-08 09:05:12 UTC (rev 2088)
+++ trunk/BaseTools/Source/Python/AutoGen/StrGather.py 2010-11-09 01:41:26 UTC (rev 2089)
@@ -284,7 +284,66 @@
return Str
+## GetFilteredLanguage
+#
+# apply get best language rules to the UNI language code list
+#
+# @param UniLanguageList: language code definition list in *.UNI file
+# @param LanguageFilterList: language code filter list of RFC4646 format in DSC file
+#
+# @retval UniLanguageListFiltered: the filtered language code
+#
+def GetFilteredLanguage(UniLanguageList, LanguageFilterList):
+ UniLanguageListFiltered = []
+ # if filter list is empty, then consider there is no filter
+ if LanguageFilterList == []:
+ UniLanguageListFiltered = UniLanguageList
+ return UniLanguageListFiltered
+ for Language in LanguageFilterList:
+ # first check for exact match
+ if Language in UniLanguageList:
+ if Language not in UniLanguageListFiltered:
+ UniLanguageListFiltered += [Language]
+ # find the first one with the same/equivalent primary tag
+ else:
+ if Language.find('-') != -1:
+ PrimaryTag = Language[0:Language.find('-')].lower()
+ else:
+ PrimaryTag = Language
+
+ if len(PrimaryTag) == 3:
+ PrimaryTag = LangConvTable.get(PrimaryTag)
+
+ for UniLanguage in UniLanguageList:
+ if UniLanguage.find('-') != -1:
+ UniLanguagePrimaryTag = UniLanguage[0:UniLanguage.find('-')].lower()
+ else:
+ UniLanguagePrimaryTag = UniLanguage
+
+ if len(UniLanguagePrimaryTag) == 3:
+ UniLanguagePrimaryTag = LangConvTable.get(UniLanguagePrimaryTag)
+ if PrimaryTag == UniLanguagePrimaryTag:
+ if UniLanguage not in UniLanguageListFiltered:
+ UniLanguageListFiltered += [UniLanguage]
+ break
+ else:
+ # Here is rule 3 for "get best language"
+ # If tag is not listed in the Unicode file, the default ("en") tag should be used for that language
+ # for better processing, find the one that best suit for it.
+ DefaultTag = 'en'
+ if DefaultTag not in UniLanguageListFiltered:
+ # check whether language code with primary code equivalent with DefaultTag already in the list, if so, use that
+ for UniLanguage in UniLanguageList:
+ if UniLanguage.startswith('en-') or UniLanguage.startswith('eng-'):
+ if UniLanguage not in UniLanguageListFiltered:
+ UniLanguageListFiltered += [UniLanguage]
+ break
+ else:
+ UniLanguageListFiltered += [DefaultTag]
+ return UniLanguageListFiltered
+
+
## Create content of .c file
#
# Create content of .c file
@@ -293,10 +352,11 @@
# @param UniObjectClass A UniObjectClass instance
# @param IsCompatibleMode Compatible mode
# @param UniBinBuffer UniBinBuffer to contain UniBinary data.
+# @param FilterInfo Platform language filter information
#
# @retval Str: A string of .c file content
#
-def CreateCFileContent(BaseName, UniObjectClass, IsCompatibleMode, UniBinBuffer=None):
+def CreateCFileContent(BaseName, UniObjectClass, IsCompatibleMode, UniBinBuffer, FilterInfo):
#
# Init array length
#
@@ -304,13 +364,29 @@
Str = ''
Offset = 0
+ EDK2Module = FilterInfo[0]
+ if EDK2Module:
+ LanguageFilterList = FilterInfo[1]
+ else:
+ # EDK module is using ISO639-2 format filter, convert to the RFC4646 format
+ LanguageFilterList = [LangConvTable.get(F.lower()) for F in FilterInfo[1]]
+
+ UniLanguageList = []
+ for IndexI in range(len(UniObjectClass.LanguageDef)):
+ UniLanguageList += [UniObjectClass.LanguageDef[IndexI][0]]
+
+ UniLanguageListFiltered = GetFilteredLanguage(UniLanguageList, LanguageFilterList)
+
+
#
# Create lines for each language's strings
#
for IndexI in range(len(UniObjectClass.LanguageDef)):
Language = UniObjectClass.LanguageDef[IndexI][0]
LangPrintName = UniObjectClass.LanguageDef[IndexI][1]
-
+ if Language not in UniLanguageListFiltered:
+ continue
+
StringBuffer = StringIO()
StrStringValue = ''
ArrayLength = 0
@@ -428,13 +504,14 @@
# @param BaseName: The basename of strings
# @param UniObjectClass A UniObjectClass instance
# @param IsCompatibleMode Compatible Mode
+# @param FilterInfo Platform language filter information
#
-# @retval CFile: A string of complete .c file
+# @retval CFile: A string of complete .c file
#
-def CreateCFile(BaseName, UniObjectClass, IsCompatibleMode):
+def CreateCFile(BaseName, UniObjectClass, IsCompatibleMode, FilterInfo):
CFile = ''
#CFile = WriteLine(CFile, CreateCFileHeader())
- CFile = WriteLine(CFile, CreateCFileContent(BaseName, UniObjectClass, IsCompatibleMode))
+ CFile = WriteLine(CFile, CreateCFileContent(BaseName, UniObjectClass, IsCompatibleMode, None, FilterInfo))
CFile = WriteLine(CFile, CreateCFileEnd())
return CFile
@@ -518,7 +595,7 @@
# This function is used for UEFI2.1 spec
#
#
-def GetStringFiles(UniFilList, SourceFileList, IncludeList, IncludePathList, SkipList, BaseName, IsCompatibleMode = False, ShellMode = False, UniGenCFlag = True, UniGenBinBuffer = None):
+def GetStringFiles(UniFilList, SourceFileList, IncludeList, IncludePathList, SkipList, BaseName, IsCompatibleMode = False, ShellMode = False, UniGenCFlag = True, UniGenBinBuffer = None, FilterInfo = [True, []]):
Status = True
ErrorMessage = ''
@@ -540,9 +617,9 @@
HFile = CreateHFile(BaseName, Uni, IsCompatibleMode, UniGenCFlag)
CFile = None
if IsCompatibleMode or UniGenCFlag:
- CFile = CreateCFile(BaseName, Uni, IsCompatibleMode)
+ CFile = CreateCFile(BaseName, Uni, IsCompatibleMode, FilterInfo)
if UniGenBinBuffer:
- CreateCFileContent(BaseName, Uni, IsCompatibleMode, UniGenBinBuffer)
+ CreateCFileContent(BaseName, Uni, IsCompatibleMode, UniGenBinBuffer, FilterInfo)
return HFile, CFile
Modified: trunk/BaseTools/Source/Python/Common/DataType.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/DataType.py 2010-11-08 09:05:12 UTC (rev 2088)
+++ trunk/BaseTools/Source/Python/Common/DataType.py 2010-11-09 01:41:26 UTC (rev 2089)
@@ -22,6 +22,7 @@
TAB_VALUE_SPLIT = '|'
TAB_COMMA_SPLIT = ','
TAB_SPACE_SPLIT = ' '
+TAB_SEMI_COLON_SPLIT = ';'
TAB_SECTION_START = '['
TAB_SECTION_END = ']'
TAB_OPTION_START = '<'
@@ -353,6 +354,8 @@
TAB_DSC_DEFINES_MAKEFILE_NAME = 'MAKEFILE_NAME'
TAB_DSC_DEFINES_BS_BASE_ADDRESS = 'BsBaseAddress'
TAB_DSC_DEFINES_RT_BASE_ADDRESS = 'RtBaseAddress'
+TAB_DSC_DEFINES_RFC_LANGUAGES = 'RFC_LANGUAGES'
+TAB_DSC_DEFINES_ISO_LANGUAGES = 'ISO_LANGUAGES'
TAB_DSC_DEFINES_DEFINE = 'DEFINE'
TAB_DSC_DEFINES_VPD_TOOL_GUID = 'VPD_TOOL_GUID'
TAB_FIX_LOAD_TOP_MEMORY_ADDRESS = 'FIX_LOAD_TOP_MEMORY_ADDRESS'
Modified: trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
===================================================================
--- trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py 2010-11-08 09:05:12 UTC (rev 2088)
+++ trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py 2010-11-09 01:41:26 UTC (rev 2089)
@@ -74,6 +74,8 @@
TAB_DSC_DEFINES_MAKEFILE_NAME : "_MakefileName",
TAB_DSC_DEFINES_BS_BASE_ADDRESS : "_BsBaseAddress",
TAB_DSC_DEFINES_RT_BASE_ADDRESS : "_RtBaseAddress",
+ #TAB_DSC_DEFINES_RFC_LANGUAGES : "_RFCLanguages",
+ #TAB_DSC_DEFINES_ISO_LANGUAGES : "_ISOLanguages",
}
# used to compose dummy library class name for those forced library instances
@@ -140,6 +142,8 @@
self._Pcds = None
self._BuildOptions = None
self._LoadFixAddress = None
+ self._RFCLanguages = None
+ self._ISOLanguages = None
self._VpdToolGuid = None
## Get architecture
@@ -194,6 +198,35 @@
self._SkuName = Record[1]
elif Name == TAB_FIX_LOAD_TOP_MEMORY_ADDRESS:
self._LoadFixAddress = Record[1]
+ elif Name == TAB_DSC_DEFINES_RFC_LANGUAGES:
+ if not Record[1] or Record[1][0] != '"' or Record[1][-1] != '"' or len(Record[1]) == 1:
+ EdkLogger.error('build', FORMAT_NOT_SUPPORTED, 'language code for RFC_LANGUAGES must have double quotes around it, for example: RFC_LANGUAGES = "en-us;zh-hans"',
+ File=self.MetaFile, Line=Record[-1])
+ LanguageCodes = Record[1][1:-1]
+ if not LanguageCodes:
+ EdkLogger.error('build', FORMAT_NOT_SUPPORTED, 'one or more RFC4646 format language code must be provided for RFC_LANGUAGES statement',
+ File=self.MetaFile, Line=Record[-1])
+ LanguageList = GetSplitValueList(LanguageCodes, TAB_SEMI_COLON_SPLIT)
+ # check whether there is empty entries in the list
+ if None in LanguageList:
+ EdkLogger.error('build', FORMAT_NOT_SUPPORTED, 'one or more empty language code is in RFC_LANGUAGES statement',
+ File=self.MetaFile, Line=Record[-1])
+ self._RFCLanguages = LanguageList
+ elif Name == TAB_DSC_DEFINES_ISO_LANGUAGES:
+ if not Record[1] or Record[1][0] != '"' or Record[1][-1] != '"' or len(Record[1]) == 1:
+ EdkLogger.error('build', FORMAT_NOT_SUPPORTED, 'language code for ISO_LANGUAGES must have double quotes around it, for example: ISO_LANGUAGES = "engchn"',
+ File=self.MetaFile, Line=Record[-1])
+ LanguageCodes = Record[1][1:-1]
+ if not LanguageCodes:
+ EdkLogger.error('build', FORMAT_NOT_SUPPORTED, 'one or more ISO639-2 format language code must be provided for ISO_LANGUAGES statement',
+ File=self.MetaFile, Line=Record[-1])
+ if len(LanguageCodes)%3:
+ EdkLogger.error('build', FORMAT_NOT_SUPPORTED, 'bad ISO639-2 format for ISO_LANGUAGES',
+ File=self.MetaFile, Line=Record[-1])
+ LanguageList = []
+ for i in range(0, len(LanguageCodes), 3):
+ LanguageList.append(LanguageCodes[i:i+3])
+ self._ISOLanguages = LanguageList
elif Name == TAB_DSC_DEFINES_VPD_TOOL_GUID:
#
# try to convert GUID to a real UUID value to see whether the GUID is format
@@ -339,6 +372,24 @@
self._LoadFixAddress = ''
return self._LoadFixAddress
+ ## Retrieve RFCLanguage filter
+ def _GetRFCLanguages(self):
+ if self._RFCLanguages == None:
+ if self._Header == None:
+ self._GetHeaderInfo()
+ if self._RFCLanguages == None:
+ self._RFCLanguages = []
+ return self._RFCLanguages
+
+ ## Retrieve ISOLanguage filter
+ def _GetISOLanguages(self):
+ if self._ISOLanguages == None:
+ if self._Header == None:
+ self._GetHeaderInfo()
+ if self._ISOLanguages == None:
+ self._ISOLanguages = []
+ return self._ISOLanguages
+
## Retrieve the GUID string for VPD tool
def _GetVpdToolGuid(self):
if self._VpdToolGuid == None:
@@ -779,6 +830,8 @@
BsBaseAddress = property(_GetBsBaseAddress)
RtBaseAddress = property(_GetRtBaseAddress)
LoadFixAddress = property(_GetLoadFixAddress)
+ RFCLanguages = property(_GetRFCLanguages)
+ ISOLanguages = property(_GetISOLanguages)
VpdToolGuid = property(_GetVpdToolGuid)
SkuIds = property(_GetSkuIds)
Modules = property(_GetModules)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gi...@us...> - 2010-11-11 02:43:07
|
Revision: 2092
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2092&view=rev
Author: gikidy
Date: 2010-11-11 02:43:01 +0000 (Thu, 11 Nov 2010)
Log Message:
-----------
1. Support the sequence of VPD PCD in guided.txt file same as DSC file;
2. Report error while VPD PCD's offset need to be fixed but no VPD_TOOL defined in DSC file.
Modified Paths:
--------------
trunk/BaseTools/Source/Python/AutoGen/AutoGen.py
trunk/BaseTools/Source/Python/Common/VpdInfoFile.py
trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
Modified: trunk/BaseTools/Source/Python/AutoGen/AutoGen.py
===================================================================
--- trunk/BaseTools/Source/Python/AutoGen/AutoGen.py 2010-11-11 02:25:42 UTC (rev 2091)
+++ trunk/BaseTools/Source/Python/AutoGen/AutoGen.py 2010-11-11 02:43:01 UTC (rev 2092)
@@ -575,12 +575,12 @@
UnicodePcdArray = []
HiiPcdArray = []
OtherPcdArray = []
+ VpdPcdDict = {}
VpdFile = VpdInfoFile.VpdInfoFile()
NeedProcessVpdMapFile = False
if (self.Workspace.ArchList[-1] == self.Arch):
for Pcd in self._DynamicPcdList:
-
# just pick the a value to determine whether is unicode string type
Sku = Pcd.SkuInfoList[Pcd.SkuInfoList.keys()[0]]
Sku.VpdOffset = Sku.VpdOffset.strip()
@@ -594,32 +594,47 @@
HiiPcdArray.append(Pcd)
else:
OtherPcdArray.append(Pcd)
+ if Pcd.Type in [TAB_PCDS_DYNAMIC_VPD, TAB_PCDS_DYNAMIC_EX_VPD]:
+ VpdPcdDict[(Pcd.TokenCName, Pcd.TokenSpaceGuidCName)] = Pcd
+
+ PlatformPcds = self.Platform.Pcds.keys()
+ PlatformPcds.sort()
+ #
+ # Add VPD type PCD into VpdFile and determine whether the VPD PCD need to be fixed up.
+ #
+ for PcdKey in PlatformPcds:
+ Pcd = self.Platform.Pcds[PcdKey]
+ if Pcd.Type in [TAB_PCDS_DYNAMIC_VPD, TAB_PCDS_DYNAMIC_EX_VPD]:
+ Pcd = VpdPcdDict[PcdKey]
+ Sku = Pcd.SkuInfoList[Pcd.SkuInfoList.keys()[0]]
+ Sku.VpdOffset = Sku.VpdOffset.strip()
+ #
+ # Fix the optional data of VPD PCD.
+ #
+ if (Pcd.DatumType.strip() != "VOID*"):
+ if Sku.DefaultValue == '':
+ Pcd.SkuInfoList[Pcd.SkuInfoList.keys()[0]].DefaultValue = Pcd.MaxDatumSize
+ Pcd.MaxDatumSize = None
+ else:
+ EdkLogger.error("build", AUTOGEN_ERROR, "PCD setting error",
+ File=self.MetaFile,
+ ExtraData="\n\tPCD: %s.%s format incorrect in DSC: %s\n\t\t\n"
+ % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName, self.Platform.MetaFile.Path))
- if Pcd.Type in [TAB_PCDS_DYNAMIC_VPD, TAB_PCDS_DYNAMIC_EX_VPD]:
- if not (self.Platform.VpdToolGuid == None or self.Platform.VpdToolGuid == ''):
- #
- # Fix the optional data of VPD PCD.
- #
- if (Pcd.DatumType.strip() != "VOID*"):
- if Sku.DefaultValue == '':
- Pcd.SkuInfoList[Pcd.SkuInfoList.keys()[0]].DefaultValue = Pcd.MaxDatumSize
- Pcd.MaxDatumSize = None
- else:
- EdkLogger.error("build", AUTOGEN_ERROR, "PCD setting error",
- File=self.MetaFile,
- ExtraData="\n\tPCD: %s.%s format incorrect in DSC: %s\n\t\t\n"
- % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName, self.Platform.MetaFile.Path))
-
- VpdFile.Add(Pcd, Sku.VpdOffset)
- # if the offset of a VPD is *, then it need to be fixed up by third party tool.
- if not NeedProcessVpdMapFile and Sku.VpdOffset == "*":
- NeedProcessVpdMapFile = True
+ VpdFile.Add(Pcd, Sku.VpdOffset)
+ # if the offset of a VPD is *, then it need to be fixed up by third party tool.
+ if not NeedProcessVpdMapFile and Sku.VpdOffset == "*":
+ NeedProcessVpdMapFile = True
+ if self.Platform.VpdToolGuid == None or self.Platform.VpdToolGuid == '':
+ EdkLogger.error("Build", FILE_NOT_FOUND, \
+ "Fail to find third-party BPDG tool to process VPD PCDs. BPDG Guid tool need to be defined in tools_def.txt and VPD_TOOL_GUID need to be provided in DSC file.")
+
#
# Fix the PCDs define in VPD PCD section that never referenced by module.
# An example is PCD for signature usage.
- #
- for DscPcd in self.Platform.Pcds:
+ #
+ for DscPcd in PlatformPcds:
DscPcdEntry = self.Platform.Pcds[DscPcd]
if DscPcdEntry.Type in [TAB_PCDS_DYNAMIC_VPD, TAB_PCDS_DYNAMIC_EX_VPD]:
if not (self.Platform.VpdToolGuid == None or self.Platform.VpdToolGuid == ''):
Modified: trunk/BaseTools/Source/Python/Common/VpdInfoFile.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/VpdInfoFile.py 2010-11-11 02:25:42 UTC (rev 2091)
+++ trunk/BaseTools/Source/Python/Common/VpdInfoFile.py 2010-11-11 02:43:01 UTC (rev 2092)
@@ -135,7 +135,9 @@
fd.write(FILE_COMMENT_TEMPLATE)
# write each of PCD in VPD type
- for Pcd in self._VpdArray.keys():
+ Pcds = self._VpdArray.keys()
+ Pcds.sort()
+ for Pcd in Pcds:
for Offset in self._VpdArray[Pcd]:
PcdValue = str(Pcd.SkuInfoList[Pcd.SkuInfoList.keys()[0]].DefaultValue).strip()
if PcdValue == "" :
Modified: trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
===================================================================
--- trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py 2010-11-11 02:25:42 UTC (rev 2091)
+++ trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py 2010-11-11 02:43:01 UTC (rev 2092)
@@ -670,14 +670,14 @@
# PCD settings for certain ARCH and SKU
#
PcdDict = tdict(True, 4)
- PcdSet = set()
+ PcdList = []
# Find out all possible PCD candidates for self._Arch
RecordList = self._RawData[Type, self._Arch]
for TokenSpaceGuid, PcdCName, Setting, Arch, SkuName, Dummy3, Dummy4 in RecordList:
- PcdSet.add((PcdCName, TokenSpaceGuid))
+ PcdList.append((PcdCName, TokenSpaceGuid))
PcdDict[Arch, SkuName, PcdCName, TokenSpaceGuid] = Setting
# Remove redundant PCD candidates, per the ARCH and SKU
- for PcdCName, TokenSpaceGuid in PcdSet:
+ for PcdCName, TokenSpaceGuid in PcdList:
Setting = PcdDict[self._Arch, self.SkuName, PcdCName, TokenSpaceGuid]
if Setting == None:
continue
@@ -752,14 +752,14 @@
# PCD settings for certain ARCH and SKU
#
PcdDict = tdict(True, 4)
- PcdSet = set()
+ PcdList = []
# Find out all possible PCD candidates for self._Arch
RecordList = self._RawData[Type, self._Arch]
for TokenSpaceGuid, PcdCName, Setting, Arch, SkuName, Dummy3, Dummy4 in RecordList:
- PcdSet.add((PcdCName, TokenSpaceGuid))
+ PcdList.append((PcdCName, TokenSpaceGuid))
PcdDict[Arch, SkuName, PcdCName, TokenSpaceGuid] = Setting
# Remove redundant PCD candidates, per the ARCH and SKU
- for PcdCName, TokenSpaceGuid in PcdSet:
+ for PcdCName, TokenSpaceGuid in PcdList:
Setting = PcdDict[self._Arch, self.SkuName, PcdCName, TokenSpaceGuid]
if Setting == None:
continue
@@ -1961,11 +1961,11 @@
def _GetPcd(self, Type):
Pcds = {}
PcdDict = tdict(True, 4)
- PcdSet = set()
+ PcdList = []
RecordList = self._RawData[Type, self._Arch, self._Platform]
for TokenSpaceGuid, PcdCName, Setting, Arch, Platform, Dummy1, LineNo in RecordList:
PcdDict[Arch, Platform, PcdCName, TokenSpaceGuid] = (Setting, LineNo)
- PcdSet.add((PcdCName, TokenSpaceGuid))
+ PcdList.append((PcdCName, TokenSpaceGuid))
# get the guid value
if TokenSpaceGuid not in self.Guids:
Value = GuidValue(TokenSpaceGuid, self.Packages)
@@ -1977,7 +1977,7 @@
self.Guids[TokenSpaceGuid] = Value
# resolve PCD type, value, datum info, etc. by getting its definition from package
- for PcdCName, TokenSpaceGuid in PcdSet:
+ for PcdCName, TokenSpaceGuid in PcdList:
Setting, LineNo = PcdDict[self._Arch, self.Platform, PcdCName, TokenSpaceGuid]
if Setting == None:
continue
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jw...@us...> - 2010-12-22 06:10:34
|
Revision: 2106
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2106&view=rev
Author: jwang36
Date: 2010-12-22 06:10:25 +0000 (Wed, 22 Dec 2010)
Log Message:
-----------
Enhanced macro support in meta-file and build process. Related trackers (HSD): 202560, 202825, 203408, 203523, 203567, 203863, 203954, 203988
Modified Paths:
--------------
trunk/BaseTools/Source/Python/AutoGen/AutoGen.py
trunk/BaseTools/Source/Python/AutoGen/GenC.py
trunk/BaseTools/Source/Python/Common/DataType.py
trunk/BaseTools/Source/Python/Common/GlobalData.py
trunk/BaseTools/Source/Python/Common/Misc.py
trunk/BaseTools/Source/Python/Common/String.py
trunk/BaseTools/Source/Python/CommonDataClass/DataClass.py
trunk/BaseTools/Source/Python/GenFds/AprioriSection.py
trunk/BaseTools/Source/Python/GenFds/FdfParser.py
trunk/BaseTools/Source/Python/GenFds/FfsInfStatement.py
trunk/BaseTools/Source/Python/GenFds/GenFds.py
trunk/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
trunk/BaseTools/Source/Python/Workspace/MetaDataTable.py
trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py
trunk/BaseTools/Source/Python/Workspace/MetaFileTable.py
trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
trunk/BaseTools/Source/Python/build/build.py
Added Paths:
-----------
trunk/BaseTools/Source/Python/Common/Expression.py
Modified: trunk/BaseTools/Source/Python/AutoGen/AutoGen.py
===================================================================
--- trunk/BaseTools/Source/Python/AutoGen/AutoGen.py 2010-12-22 06:03:59 UTC (rev 2105)
+++ trunk/BaseTools/Source/Python/AutoGen/AutoGen.py 2010-12-22 06:10:25 UTC (rev 2106)
@@ -140,16 +140,16 @@
#
def _Init(self, WorkspaceDir, ActivePlatform, Target, Toolchain, ArchList, MetaFileDb,
BuildConfig, ToolDefinition, FlashDefinitionFile='', Fds=[], Fvs=[], SkuId='', UniFlag=None):
- self.MetaFile = ActivePlatform.MetaFile
+ self.BuildDatabase = MetaFileDb
+ self.MetaFile = ActivePlatform
self.WorkspaceDir = WorkspaceDir
- self.Platform = ActivePlatform
+ self.Platform = self.BuildDatabase[self.MetaFile, 'COMMON', Target, Toolchain]
self.BuildTarget = Target
self.ToolChain = Toolchain
self.ArchList = ArchList
self.SkuId = SkuId
self.UniFlag = UniFlag
- self.BuildDatabase = MetaFileDb
self.TargetTxt = BuildConfig
self.ToolDef = ToolDefinition
self.FdfFile = FlashDefinitionFile
@@ -160,25 +160,66 @@
# there's many relative directory operations, so ...
os.chdir(self.WorkspaceDir)
+ #
+ # Merge Arch
+ #
+ if not self.ArchList:
+ ArchList = set(self.Platform.SupArchList)
+ else:
+ ArchList = set(self.ArchList) & set(self.Platform.SupArchList)
+ if not ArchList:
+ EdkLogger.error("build", PARAMETER_INVALID,
+ ExtraData = "Invalid ARCH specified. [Valid ARCH: %s]" % (" ".join(self.Platform.SupArchList)))
+ elif self.ArchList and len(ArchList) != len(self.ArchList):
+ SkippedArchList = set(self.ArchList).symmetric_difference(set(self.Platform.SupArchList))
+ EdkLogger.verbose("\nArch [%s] is ignored because the platform supports [%s] only!"
+ % (" ".join(SkippedArchList), " ".join(self.Platform.SupArchList)))
+ self.ArchList = tuple(ArchList)
+
+ # Validate build target
+ if self.BuildTarget not in self.Platform.BuildTargets:
+ EdkLogger.error("build", PARAMETER_INVALID,
+ ExtraData="Build target [%s] is not supported by the platform. [Valid target: %s]"
+ % (self.BuildTarget, " ".join(self.Platform.BuildTargets)))
+
+ # Validate SKU ID
+ if not self.SkuId:
+ self.SkuId = 'DEFAULT'
+
+ if self.SkuId not in self.Platform.SkuIds:
+ EdkLogger.error("build", PARAMETER_INVALID,
+ ExtraData="SKU-ID [%s] is not supported by the platform. [Valid SKU-ID: %s]"
+ % (self.SkuId, " ".join(self.Platform.SkuIds.keys())))
+
# parse FDF file to get PCDs in it, if any
- if self.FdfFile != None and self.FdfFile != '':
- #
- # Make global macros available when parsing FDF file
- #
- InputMacroDict.update(self.BuildDatabase.WorkspaceDb._GlobalMacros)
+ if not self.FdfFile:
+ self.FdfFile = self.Platform.FlashDefinition
+ EdkLogger.verbose("\nFLASH_DEFINITION = %s" % self.FdfFile)
+
+ if self.FdfFile:
Fdf = FdfParser(self.FdfFile.Path)
Fdf.ParseFile()
PcdSet = Fdf.Profile.PcdDict
ModuleList = Fdf.Profile.InfList
self.FdfProfile = Fdf.Profile
+ for fvname in self.FvTargetList:
+ if fvname.upper() not in self.FdfProfile.FvDict:
+ EdkLogger.error("build", OPTION_VALUE_INVALID,
+ "No such an FV in FDF file: %s" % fvname)
else:
PcdSet = {}
ModuleList = []
self.FdfProfile = None
+ if self.FdTargetList:
+ EdkLogger.info("No flash definition file found. FD [%s] will be ignored." % " ".join(self.FdTargetList))
+ self.FdTargetList = []
+ if self.FvTargetList:
+ EdkLogger.info("No flash definition file found. FV [%s] will be ignored." % " ".join(self.FvTargetList))
+ self.FvTargetList = []
# apply SKU and inject PCDs from Flash Definition file
for Arch in self.ArchList:
- Platform = self.BuildDatabase[self.MetaFile, Arch]
+ Platform = self.BuildDatabase[self.MetaFile, Arch, Target, Toolchain]
Platform.SkuName = self.SkuId
for Name, Guid in PcdSet:
Platform.AddPcd(Name, Guid, PcdSet[Name, Guid])
@@ -737,7 +778,7 @@
## Return the platform build data object
def _GetPlatform(self):
if self._Platform == None:
- self._Platform = self.BuildDatabase[self.MetaFile, self.Arch]
+ self._Platform = self.BuildDatabase[self.MetaFile, self.Arch, self.BuildTarget, self.ToolChain]
return self._Platform
## Return platform name
@@ -1070,7 +1111,7 @@
File=self.MetaFile,
ExtraData="in [%s] [%s]\n\tconsumed by module [%s]" % (str(M), self.Arch, str(Module)))
- LibraryModule = self.BuildDatabase[LibraryPath, self.Arch]
+ LibraryModule = self.BuildDatabase[LibraryPath, self.Arch, self.BuildTarget, self.ToolChain]
# for those forced library instance (NULL library), add a fake library class
if LibraryClassName.startswith("NULL"):
LibraryModule.LibraryClass.append(LibraryClassObject(LibraryClassName, [ModuleType]))
@@ -1678,7 +1719,7 @@
## Return the module build data object
def _GetModule(self):
if self._Module == None:
- self._Module = self.Workspace.BuildDatabase[self.MetaFile, self.Arch]
+ self._Module = self.Workspace.BuildDatabase[self.MetaFile, self.Arch, self.BuildTarget, self.ToolChain]
return self._Module
## Return the module name
Modified: trunk/BaseTools/Source/Python/AutoGen/GenC.py
===================================================================
--- trunk/BaseTools/Source/Python/AutoGen/GenC.py 2010-12-22 06:03:59 UTC (rev 2105)
+++ trunk/BaseTools/Source/Python/AutoGen/GenC.py 2010-12-22 06:10:25 UTC (rev 2106)
@@ -956,6 +956,14 @@
Value = Pcd.DefaultValue
Unicode = False
ValueNumber = 0
+
+ if Pcd.DatumType == 'BOOLEAN':
+ BoolValue = Value.upper()
+ if BoolValue == 'TRUE':
+ Value = 1
+ elif BoolValue == 'FALSE':
+ Value = 0
+
if Pcd.DatumType in ['UINT64', 'UINT32', 'UINT16', 'UINT8']:
try:
if Value.upper().startswith('0X'):
Modified: trunk/BaseTools/Source/Python/Common/DataType.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/DataType.py 2010-12-22 06:03:59 UTC (rev 2105)
+++ trunk/BaseTools/Source/Python/Common/DataType.py 2010-12-22 06:10:25 UTC (rev 2106)
@@ -359,6 +359,7 @@
TAB_DSC_DEFINES_DEFINE = 'DEFINE'
TAB_DSC_DEFINES_VPD_TOOL_GUID = 'VPD_TOOL_GUID'
TAB_FIX_LOAD_TOP_MEMORY_ADDRESS = 'FIX_LOAD_TOP_MEMORY_ADDRESS'
+TAB_DSC_DEFINES_EDKGLOBAL = 'EDK_GLOBAL'
#
# TargetTxt Definitions
Added: trunk/BaseTools/Source/Python/Common/Expression.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/Expression.py (rev 0)
+++ trunk/BaseTools/Source/Python/Common/Expression.py 2010-12-22 06:10:25 UTC (rev 2106)
@@ -0,0 +1,140 @@
+## @file
+# This file is used to parse and evaluate expression in directive or PCD value.
+#
+# Copyright (c) 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 sys
+import os
+import re
+import traceback
+
+class EvaluationException(Exception):
+ pass
+
+class BadExpression(EvaluationException):
+ pass
+
+class SymbolNotFound(EvaluationException):
+ pass
+
+# Constants
+TRUE = 1
+FALSE = 0
+
+class ValueExpression(object):
+ #
+ # Pattern to match $(MACRO) or gTokenSpaceGuid.gPcdCName
+ #
+ SymbolPattern = re.compile("(\$\([A-Z_][A-Z0-9_]*\)|\$\(\w+\.\w+\)|\w+\.\w+)")
+
+ # Wide string pattern in C
+ WideStringPattern = re.compile('(\W|\A)L"')
+
+ # Data array pattern
+ DataArrayPattern = re.compile('^\{([^{}]*)\}$')
+
+ ## Constructor
+ #
+ # @param Expression The list or string of dependency expression
+ # @param SymbolTable The type of the module using the dependency expression
+ #
+ def __init__(self, Expression, SymbolTable={}):
+ self._Expression = Expression
+ self._SymbolTable = SymbolTable
+ self._Value = None
+
+ def __str__(self):
+ return self._Expression
+
+ def __repr__(self):
+ # Don't do any replacement for string
+ if self._IsString():
+ return self._Expression
+ return self._Replace()
+
+ def __call__(self):
+ if self._Value == None:
+ try:
+ if not self._IsString():
+ self._Value = eval(self.__repr__())
+ else:
+ # Don't do eval to string
+ self._Value = self.__repr__()
+ except SymbolNotFound, Excpt:
+ raise
+ except Exception, Excpt:
+ raise BadExpression(str(Excpt))
+ return self._Value
+
+ def _IsString(self):
+ Index = 0
+ if (self._Expression[0] == '"'):
+ Index = 1
+ elif self._Expression.startswith('L"'):
+ Index = 2
+ else:
+ return False
+
+ if (self._Expression[-1] != '"'):
+ return False
+
+ End = len(self._Expression) - 1
+ while Index < End:
+ if self._Expression[Index] == '"':
+ return False
+
+ # Ignore the escaped quotation mark \"
+ if self._Expression[Index] == '\\':
+ if (Index + 1) >= End:
+ return False
+ elif self._Expression[Index+1] == '"':
+ Index += 1
+ Index += 1
+ return True
+
+ def _Replace(self):
+ Expression = self._Expression
+ while True:
+ Symbols = {}
+ for SymbolMatch in self.SymbolPattern.finditer(Expression):
+ # The enclosed $() will be removed
+ Symbol = SymbolMatch.group(0)
+ if Symbol.startswith('$('):
+ Symbol = Symbol[2:-1]
+ Symbols[Symbol] = SymbolMatch
+
+ if not Symbols:
+ break
+
+ ExpressionParts = []
+ Last = 0
+ for Symbol in Symbols:
+ if Symbol not in self._SymbolTable:
+ raise SymbolNotFound(Symbol)
+
+ SymbolMatch = Symbols[Symbol]
+ ExpressionParts.append(self._Expression[Last:SymbolMatch.start()])
+ ExpressionParts.append(self._SymbolTable[Symbol])
+ Last = SymbolMatch.end()
+
+ ExpressionParts.append(self._Expression[Last:])
+ Expression = ''.join(ExpressionParts)
+ #
+ # Since we use python interpreter to do the evaluation, we have to convert
+ # all unicode strings in the expression to python way, as the last step
+ # of macro replacement
+ #
+ return self.WideStringPattern.sub('\\1u"', Expression)
+
+if __name__ == '__main__':
+ pass
+
Modified: trunk/BaseTools/Source/Python/Common/GlobalData.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/GlobalData.py 2010-12-22 06:03:59 UTC (rev 2105)
+++ trunk/BaseTools/Source/Python/Common/GlobalData.py 2010-12-22 06:10:25 UTC (rev 2106)
@@ -22,9 +22,11 @@
gOptions = None
gCaseInsensitive = False
-gGlobalDefines = {}
gAllFiles = None
+gGlobalDefines = {}
+gPlatformDefines = {}
+gCommandLineDefines = {}
gEdkGlobal = {}
gOverrideDir = {}
Modified: trunk/BaseTools/Source/Python/Common/Misc.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/Misc.py 2010-12-22 06:03:59 UTC (rev 2105)
+++ trunk/BaseTools/Source/Python/Common/Misc.py 2010-12-22 06:10:25 UTC (rev 2106)
@@ -156,7 +156,7 @@
guidValueString = GuidValue.lower().replace("{", "").replace("}", "").replace(" ", "")
guidValueList = guidValueString.split(",")
if len(guidValueList) != 11:
- EdkLogger.error(None, None, "Invalid GUID value string %s" % GuidValue)
+ EdkLogger.error(None, FORMAT_INVALID, "Invalid GUID value string [%s]" % GuidValue)
return "%08x_%04x_%04x_%02x%02x_%02x%02x%02x%02x%02x%02x" % (
int(guidValueList[0], 16),
int(guidValueList[1], 16),
@@ -1402,6 +1402,9 @@
self._Key = self.Path.upper() # + self.ToolChainFamily + self.TagName + self.ToolCode + self.Target
return self._Key
+ def _GetTimeStamp(self):
+ return os.stat(self.Path)[8]
+
def Validate(self, Type='', CaseSensitive=True):
if GlobalData.gCaseInsensitive:
CaseSensitive = False
@@ -1436,6 +1439,7 @@
return ErrorCode, ErrorInfo
Key = property(_GetFileKey)
+ TimeStamp = property(_GetTimeStamp)
## Parse PE image to get the required PE informaion.
#
Modified: trunk/BaseTools/Source/Python/Common/String.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/String.py 2010-12-22 06:03:59 UTC (rev 2105)
+++ trunk/BaseTools/Source/Python/Common/String.py 2010-12-22 06:10:25 UTC (rev 2106)
@@ -210,9 +210,9 @@
#
# @retval string The string whose macros are replaced
#
-def ReplaceMacro(String, MacroDefinitions={}, SelfReplacement = False):
+def ReplaceMacro(String, MacroDefinitions={}, SelfReplacement=False, RaiseError=False):
LastString = String
- while MacroDefinitions:
+ while String and MacroDefinitions:
MacroUsed = gMacroPattern.findall(String)
# no macro found in String, stop replacing
if len(MacroUsed) == 0:
@@ -220,6 +220,8 @@
for Macro in MacroUsed:
if Macro not in MacroDefinitions:
+ if RaiseError:
+ raise Exception("%s not defined" % Macro)
if SelfReplacement:
String = String.replace("$(%s)" % Macro, '')
continue
Modified: trunk/BaseTools/Source/Python/CommonDataClass/DataClass.py
===================================================================
--- trunk/BaseTools/Source/Python/CommonDataClass/DataClass.py 2010-12-22 06:03:59 UTC (rev 2105)
+++ trunk/BaseTools/Source/Python/CommonDataClass/DataClass.py 2010-12-22 06:10:25 UTC (rev 2106)
@@ -89,11 +89,13 @@
MODEL_META_DATA_USER_EXTENSION = 5010
MODEL_META_DATA_PACKAGE = 5011
MODEL_META_DATA_NMAKE = 5012
-MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF = 50013
+MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF = 5013
MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF = 5014
MODEL_META_DATA_COMPONENT_SOURCE_OVERRIDE_PATH = 5015
MODEL_META_DATA_COMMENT = 5016
MODEL_META_DATA_GLOBAL_DEFINE = 5017
+MODEL_META_DATA_SECTION_HEADER = 5100
+MODEL_META_DATA_SUBSECTION_HEADER = 5200
MODEL_EXTERNAL_DEPENDENCY = 10000
Modified: trunk/BaseTools/Source/Python/GenFds/AprioriSection.py
===================================================================
--- trunk/BaseTools/Source/Python/GenFds/AprioriSection.py 2010-12-22 06:03:59 UTC (rev 2105)
+++ trunk/BaseTools/Source/Python/GenFds/AprioriSection.py 2010-12-22 06:10:25 UTC (rev 2106)
@@ -79,11 +79,11 @@
InfFileName = GenFdsGlobalVariable.MacroExtend(InfFileName, Dict, Arch)
if Arch != None:
- Inf = GenFdsGlobalVariable.WorkSpace.BuildObject[PathClass(InfFileName, GenFdsGlobalVariable.WorkSpaceDir), Arch]
+ Inf = GenFdsGlobalVariable.WorkSpace.BuildObject[PathClass(InfFileName, GenFdsGlobalVariable.WorkSpaceDir), Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
Guid = Inf.Guid
else:
- Inf = GenFdsGlobalVariable.WorkSpace.BuildObject[PathClass(InfFileName, GenFdsGlobalVariable.WorkSpaceDir), 'COMMON']
+ Inf = GenFdsGlobalVariable.WorkSpace.BuildObject[PathClass(InfFileName, GenFdsGlobalVariable.WorkSpaceDir), 'COMMON', GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
Guid = Inf.Guid
self.BinFileList = Inf.Module.Binaries
Modified: trunk/BaseTools/Source/Python/GenFds/FdfParser.py
===================================================================
--- trunk/BaseTools/Source/Python/GenFds/FdfParser.py 2010-12-22 06:03:59 UTC (rev 2105)
+++ trunk/BaseTools/Source/Python/GenFds/FdfParser.py 2010-12-22 06:10:25 UTC (rev 2106)
@@ -15,6 +15,8 @@
##
# Import Modules
#
+import re
+
import Fd
import Region
import Fv
@@ -45,6 +47,8 @@
from Common import EdkLogger
from Common.Misc import PathClass
from Common.String import NormPath
+import Common.GlobalData as GlobalData
+from Common.Expression import *
import re
import os
@@ -67,6 +71,9 @@
SEPERATOR_TUPLE = ('=', '|', ',', '{', '}')
+RegionSizePattern = re.compile("\s*(?P<base>(?:0x|0X)?[a-fA-F0-9]+)\s*\|\s*(?P<size>(?:0x|0X)?[a-fA-F0-9]+)\s*")
+RegionSizeGuidPattern = re.compile("\s*(?P<base>\w+\.\w+)\s*\|\s*(?P<size>\w+\.\w+)\s*")
+
IncludeFileList = []
# Macro passed from command line, which has greatest priority and can NOT be overridden by those in FDF
InputMacroDict = {}
@@ -210,6 +217,10 @@
if GenFdsGlobalVariable.WorkSpaceDir == '':
GenFdsGlobalVariable.WorkSpaceDir = os.getenv("WORKSPACE")
+ InputMacroDict.update(GlobalData.gPlatformDefines)
+ InputMacroDict.update(GlobalData.gGlobalDefines)
+ InputMacroDict.update(GlobalData.gCommandLineDefines)
+
## __IsWhiteSpace() method
#
# Whether char at current FileBufferPos is whitespace
@@ -575,6 +586,7 @@
def PreprocessConditionalStatement(self):
# IfList is a stack of if branches with elements of list [Pos, CondSatisfied, BranchDetermined]
IfList = []
+ RegionLayoutLine = 0
while self.__GetNextToken():
if self.__Token == 'DEFINE':
DefineLine = self.CurrentLineNumber - 1
@@ -597,60 +609,48 @@
MacProfile.MacroName = Macro
MacProfile.MacroValue = Value
AllMacroList.append(MacProfile)
+ InputMacroDict[MacProfile.MacroName] = MacProfile.MacroValue
self.__WipeOffArea.append(((DefineLine, DefineOffset), (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - 1)))
+ elif self.__Token == 'SET':
+ PcdPair = self.__GetNextPcdName()
+ PcdName = "%s.%s" % (PcdPair[1], PcdPair[0])
+ if not self.__IsToken( "="):
+ raise Warning("expected '='", self.FileName, self.CurrentLineNumber)
+ if not self.__GetNextToken():
+ raise Warning("expected value", self.FileName, self.CurrentLineNumber)
+
+ Value = self.__Token
+ if Value.startswith("{"):
+ # deal with value with {}
+ if not self.__SkipToToken( "}"):
+ raise Warning("expected '}'", self.FileName, self.CurrentLineNumber)
+ Value += self.__SkippedChars
+
+ InputMacroDict[PcdName] = Value
elif self.__Token in ('!ifdef', '!ifndef', '!if'):
IfStartPos = (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - len(self.__Token))
IfList.append([IfStartPos, None, None])
+
CondLabel = self.__Token
+ Expression = self.__GetExpression()
- MacroName, NotFlag = self.__GetMacroName()
- NotDefineFlag = False
- if CondLabel == '!ifndef':
- NotDefineFlag = True
- if CondLabel == '!ifdef' or CondLabel == '!ifndef':
- if NotFlag:
- raise Warning("'NOT' operation not allowed for Macro name", self.FileName, self.CurrentLineNumber)
-
if CondLabel == '!if':
-
- if not self.__GetNextOp():
- raise Warning("expected !endif", self.FileName, self.CurrentLineNumber)
-
- if self.__Token in ('!=', '==', '>', '<', '>=', '<='):
- Op = self.__Token
- if not self.__GetNextToken():
- raise Warning("expected value", self.FileName, self.CurrentLineNumber)
- if self.__GetStringData():
- pass
- MacroValue = self.__Token
- ConditionSatisfied = self.__EvaluateConditional(MacroName, IfList[-1][0][0] + 1, Op, MacroValue)
- if NotFlag:
- ConditionSatisfied = not ConditionSatisfied
- BranchDetermined = ConditionSatisfied
- else:
- self.CurrentOffsetWithinLine -= len(self.__Token)
- ConditionSatisfied = self.__EvaluateConditional(MacroName, IfList[-1][0][0] + 1, None, 'Bool')
- if NotFlag:
- ConditionSatisfied = not ConditionSatisfied
- BranchDetermined = ConditionSatisfied
- IfList[-1] = [IfList[-1][0], ConditionSatisfied, BranchDetermined]
- if ConditionSatisfied:
- self.__WipeOffArea.append((IfList[-1][0], (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - 1)))
-
+ ConditionSatisfied = self.__EvaluateConditional(Expression, IfList[-1][0][0] + 1, 'eval')
else:
- ConditionSatisfied = self.__EvaluateConditional(MacroName, IfList[-1][0][0] + 1)
- if NotDefineFlag:
+ ConditionSatisfied = self.__EvaluateConditional(Expression, IfList[-1][0][0] + 1, 'in')
+ if CondLabel == '!ifndef':
ConditionSatisfied = not ConditionSatisfied
- BranchDetermined = ConditionSatisfied
- IfList[-1] = [IfList[-1][0], ConditionSatisfied, BranchDetermined]
- if ConditionSatisfied:
- self.__WipeOffArea.append((IfStartPos, (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - 1)))
+ BranchDetermined = ConditionSatisfied
+ IfList[-1] = [IfList[-1][0], ConditionSatisfied, BranchDetermined]
+ if ConditionSatisfied:
+ self.__WipeOffArea.append((IfList[-1][0], (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - 1)))
elif self.__Token in ('!elseif', '!else'):
ElseStartPos = (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - len(self.__Token))
if len(IfList) <= 0:
raise Warning("Missing !if statement", self.FileName, self.CurrentLineNumber)
+
if IfList[-1][1]:
IfList[-1] = [ElseStartPos, False, True]
self.__WipeOffArea.append((ElseStartPos, (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - 1)))
@@ -658,27 +658,8 @@
self.__WipeOffArea.append((IfList[-1][0], ElseStartPos))
IfList[-1] = [ElseStartPos, True, IfList[-1][2]]
if self.__Token == '!elseif':
- MacroName, NotFlag = self.__GetMacroName()
- if not self.__GetNextOp():
- raise Warning("expected !endif", self.FileName, self.CurrentLineNumber)
-
- if self.__Token in ('!=', '==', '>', '<', '>=', '<='):
- Op = self.__Token
- if not self.__GetNextToken():
- raise Warning("expected value", self.FileName, self.CurrentLineNumber)
- if self.__GetStringData():
- pass
- MacroValue = self.__Token
- ConditionSatisfied = self.__EvaluateConditional(MacroName, IfList[-1][0][0] + 1, Op, MacroValue)
- if NotFlag:
- ConditionSatisfied = not ConditionSatisfied
-
- else:
- self.CurrentOffsetWithinLine -= len(self.__Token)
- ConditionSatisfied = self.__EvaluateConditional(MacroName, IfList[-1][0][0] + 1, None, 'Bool')
- if NotFlag:
- ConditionSatisfied = not ConditionSatisfied
-
+ Expression = self.__GetExpression()
+ ConditionSatisfied = self.__EvaluateConditional(Expression, IfList[-1][0][0] + 1, 'eval')
IfList[-1] = [IfList[-1][0], ConditionSatisfied, IfList[-1][2]]
if IfList[-1][1]:
@@ -687,8 +668,6 @@
else:
IfList[-1][2] = True
self.__WipeOffArea.append((IfList[-1][0], (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - 1)))
-
-
elif self.__Token == '!endif':
if IfList[-1][1]:
self.__WipeOffArea.append(((self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - len('!endif')), (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - 1)))
@@ -696,107 +675,40 @@
self.__WipeOffArea.append((IfList[-1][0], (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - 1)))
IfList.pop()
+ elif not IfList: # Don't use PCDs inside conditional directive
+ if self.CurrentLineNumber <= RegionLayoutLine:
+ # Don't try the same line twice
+ continue
+ RegionSize = RegionSizePattern.match(self.Profile.FileLinesList[self.CurrentLineNumber - 1])
+ if not RegionSize:
+ RegionLayoutLine = self.CurrentLineNumber
+ continue
+ RegionSizeGuid = RegionSizeGuidPattern.match(self.Profile.FileLinesList[self.CurrentLineNumber])
+ if not RegionSizeGuid:
+ RegionLayoutLine = self.CurrentLineNumber + 1
+ continue
+ InputMacroDict[RegionSizeGuid.group('base')] = RegionSize.group('base')
+ InputMacroDict[RegionSizeGuid.group('size')] = RegionSize.group('size')
+ RegionLayoutLine = self.CurrentLineNumber + 1
-
- if len(IfList) > 0:
+ if IfList:
raise Warning("Missing !endif", self.FileName, self.CurrentLineNumber)
self.Rewind()
- def __EvaluateConditional(self, Name, Line, Op = None, Value = None):
-
+ def __EvaluateConditional(self, Expression, Line, Op = None, Value = None):
FileLineTuple = GetRealFileLine(self.FileName, Line)
- if Name in InputMacroDict:
- MacroValue = InputMacroDict[Name]
- if Op == None:
- if Value == 'Bool' and MacroValue == None or MacroValue.upper() == 'FALSE':
- return False
- return True
- elif Op == '!=':
- if Value != MacroValue:
- return True
- else:
- return False
- elif Op == '==':
- if Value == MacroValue:
- return True
- else:
- return False
- else:
- if (self...
[truncated message content] |
|
From: <jw...@us...> - 2011-03-07 07:08:48
|
Revision: 2126
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2126&view=rev
Author: jwang36
Date: 2011-03-07 07:08:42 +0000 (Mon, 07 Mar 2011)
Log Message:
-----------
Fixed following issues:
1. Build doesn't allow if statement in !include file (hsd204601)
2. Build tools doesn't handle multiple nested !if statement (hsd204602)
3. Build tools doesn't correctly handle expression of two cases (hsd204604)
Modified Paths:
--------------
trunk/BaseTools/Source/Python/AutoGen/BuildEngine.py
trunk/BaseTools/Source/Python/Common/Expression.py
trunk/BaseTools/Source/Python/Common/GlobalData.py
trunk/BaseTools/Source/Python/Common/String.py
trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py
trunk/BaseTools/Source/Python/build/build.py
Modified: trunk/BaseTools/Source/Python/AutoGen/BuildEngine.py
===================================================================
--- trunk/BaseTools/Source/Python/AutoGen/BuildEngine.py 2011-03-04 01:00:46 UTC (rev 2125)
+++ trunk/BaseTools/Source/Python/AutoGen/BuildEngine.py 2011-03-07 07:08:42 UTC (rev 2126)
@@ -137,7 +137,7 @@
self.MacroList = []
self.CommandList = []
for CmdLine in Command:
- self.MacroList.extend(gMacroPattern.findall(CmdLine))
+ self.MacroList.extend(gMacroRefPattern.findall(CmdLine))
# replace path separator with native one
self.CommandList.append(CmdLine)
Modified: trunk/BaseTools/Source/Python/Common/Expression.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/Expression.py 2011-03-04 01:00:46 UTC (rev 2125)
+++ trunk/BaseTools/Source/Python/Common/Expression.py 2011-03-07 07:08:42 UTC (rev 2126)
@@ -12,36 +12,48 @@
## Import Modules
#
-import sys
-import os
import re
-import traceback
-class EvaluationException(Exception):
- pass
+from CommonDataClass.Exceptions import *
+from Common.GlobalData import *
-class BadExpression(EvaluationException):
- pass
-
-class SymbolNotFound(EvaluationException):
- pass
-
# Constants
TRUE = 1
FALSE = 0
+true = 1
+false = 0
class ValueExpression(object):
#
# Pattern to match $(MACRO) or gTokenSpaceGuid.gPcdCName
#
- SymbolPattern = re.compile("(\$\([A-Z_][A-Z0-9_]*\)|\$\(\w+\.\w+\)|\w+\.\w+)")
+ SymbolPattern = re.compile("("
+ "\$\([A-Z][A-Z0-9_]*\)|\$\(\w+\.\w+\)|\w+\.\w+|"
+ "&&|\|\||!(?!=)|"
+ "(?<=\W)AND(?=\W)|(?<=\W)OR(?=\W)|(?<=\W)NOT(?=\W)|(?<=\W)XOR(?=\W)|"
+ "(?<=\W)EQ(?=\W)|(?<=\W)NE(?=\W)|(?<=\W)GT(?=\W)|(?<=\W)LT(?=\W)|(?<=\W)GE(?=\W)|(?<=\W)LE(?=\W)"
+ ")")
- # Wide string pattern in C
- WideStringPattern = re.compile('(\W|\A)L"')
-
# Data array pattern
DataArrayPattern = re.compile('^\{([^{}]*)\}$')
+ # Logical operator mapping
+ LogicalOperators = {
+ '&&' : ' and ',
+ '||' : ' or ',
+ '!' : ' not ',
+ 'AND': 'and',
+ 'OR' : 'or',
+ 'NOT': 'not',
+ 'XOR': '^',
+ 'EQ' : '==',
+ 'NE' : '!=',
+ 'GT' : '>',
+ 'LT' : '<',
+ 'GE' : '>=',
+ 'LE' : '<=',
+ }
+
## Constructor
#
# @param Expression The list or string of dependency expression
@@ -51,6 +63,8 @@
self._Expression = Expression
self._SymbolTable = SymbolTable
self._Value = None
+ # To support C-style and AND/OR/NOT/XOR/EQ/NE/GT/LT/GE/LE logical operators
+ self._SymbolTable.update(self.LogicalOperators)
def __str__(self):
return self._Expression
@@ -72,7 +86,7 @@
except SymbolNotFound, Excpt:
raise
except Exception, Excpt:
- raise BadExpression(str(Excpt))
+ raise BadExpression("syntax error")
return self._Value
def _IsString(self):
@@ -104,36 +118,38 @@
def _Replace(self):
Expression = self._Expression
while True:
- Symbols = {}
+ Symbols = []
for SymbolMatch in self.SymbolPattern.finditer(Expression):
# The enclosed $() will be removed
Symbol = SymbolMatch.group(0)
if Symbol.startswith('$('):
Symbol = Symbol[2:-1]
- Symbols[Symbol] = SymbolMatch
+ Symbols.append((Symbol, SymbolMatch))
if not Symbols:
break
ExpressionParts = []
Last = 0
- for Symbol in Symbols:
+ for Symbol,SymbolMatch in Symbols:
if Symbol not in self._SymbolTable:
raise SymbolNotFound(Symbol)
- SymbolMatch = Symbols[Symbol]
ExpressionParts.append(self._Expression[Last:SymbolMatch.start()])
ExpressionParts.append(self._SymbolTable[Symbol])
Last = SymbolMatch.end()
ExpressionParts.append(self._Expression[Last:])
Expression = ''.join(ExpressionParts)
+ if Expression == self._Expression:
+ # Nothing is replaced?
+ break
#
# Since we use python interpreter to do the evaluation, we have to convert
# all unicode strings in the expression to python way, as the last step
# of macro replacement
#
- return self.WideStringPattern.sub('\\1u"', Expression)
+ return gWideStringPattern.sub('\\1u"', Expression)
if __name__ == '__main__':
pass
Modified: trunk/BaseTools/Source/Python/Common/GlobalData.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/GlobalData.py 2011-03-04 01:00:46 UTC (rev 2125)
+++ trunk/BaseTools/Source/Python/Common/GlobalData.py 2011-03-07 07:08:42 UTC (rev 2126)
@@ -35,5 +35,9 @@
gBuildingModule = ''
## Regular expression for matching macro used in DSC/DEC/INF file inclusion
-gMacroPattern = re.compile("\$\(([_A-Z][_A-Z0-9]*)\)", re.UNICODE)
+gMacroRefPattern = re.compile("\$\(([A-Z][_A-Z0-9]*)\)", re.UNICODE)
+gMacroDefPattern = re.compile("^(DEFINE|EDK_GLOBAL)[ \t]+")
+gMacroNamePattern = re.compile("^[A-Z][A-Z0-9_]*$")
+# C-style wide string pattern
+gWideStringPattern = re.compile('(\W|\A)L"')
Modified: trunk/BaseTools/Source/Python/Common/String.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/String.py 2011-03-04 01:00:46 UTC (rev 2125)
+++ trunk/BaseTools/Source/Python/Common/String.py 2011-03-07 07:08:42 UTC (rev 2126)
@@ -22,6 +22,7 @@
from GlobalData import *
from BuildToolError import *
+from CommonDataClass.Exceptions import *
gHexVerPatt = re.compile('0x[a-f0-9]{4}[a-f0-9]{4}$',re.IGNORECASE)
gHumanReadableVerPatt = re.compile(r'([1-9][0-9]*|0)\.[0-9]{1,2}$')
@@ -213,7 +214,7 @@
def ReplaceMacro(String, MacroDefinitions={}, SelfReplacement=False, RaiseError=False):
LastString = String
while String and MacroDefinitions:
- MacroUsed = gMacroPattern.findall(String)
+ MacroUsed = gMacroRefPattern.findall(String)
# no macro found in String, stop replacing
if len(MacroUsed) == 0:
break
@@ -221,7 +222,7 @@
for Macro in MacroUsed:
if Macro not in MacroDefinitions:
if RaiseError:
- raise Exception("%s not defined" % Macro)
+ raise SymbolNotFound("%s not defined" % Macro)
if SelfReplacement:
String = String.replace("$(%s)" % Macro, '')
continue
Modified: trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py
===================================================================
--- trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py 2011-03-04 01:00:46 UTC (rev 2125)
+++ trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py 2011-03-07 07:08:42 UTC (rev 2126)
@@ -27,11 +27,10 @@
from Common.String import *
from Common.Misc import GuidStructureStringToGuidString, CheckPcdDatum, PathClass, AnalyzePcdData
from Common.Expression import *
+from CommonDataClass.Exceptions import *
from MetaFileTable import MetaFileStorage
-gMacroDefPattern = re.compile("^(DEFINE|EDK_GLOBAL)[ \t]+")
-
## A decorator used to parse macro definition
def ParseMacro(Parser):
def MacroParser(self):
@@ -47,8 +46,7 @@
EdkLogger.error('Parser', FORMAT_INVALID, "No macro name given",
ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
if len(TokenList) < 2:
- EdkLogger.error('Parser', FORMAT_INVALID, "No macro value given",
- ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
+ TokenList.append('')
Type = Match.group(1)
Name, Value = TokenList
@@ -56,6 +54,10 @@
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)
+ # 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)
self._ItemType = self.DataType[Type]
# DEFINE defined macros
@@ -701,8 +703,6 @@
## Parser starter
def Start(self):
- self._Symbols.update(self._Macros)
-
Content = ''
try:
Content = open(str(self.MetaFile), 'r').readlines()
@@ -724,7 +724,7 @@
if Line[0] == TAB_SECTION_START and Line[-1] == TAB_SECTION_END:
self._SectionType = MODEL_META_DATA_SECTION_HEADER
# subsection ending
- elif Line[0] == '}':
+ elif Line[0] == '}' and self._InSubsection:
self._InSubsection = False
self._SubsectionType = MODEL_UNKNOWN
self._SubsectionName = ''
@@ -788,12 +788,6 @@
## Directive statement parser
def _DirectiveParser(self):
- if self._From > 0:
- EdkLogger.error('Parser', FORMAT_INVALID,
- "No directive allowed in included file",
- ExtraData=self._CurrentLine, File=self.MetaFile,
- Line=self._LineIndex+1)
-
self._ValueList = ['','','']
TokenList = GetSplitValueList(self._CurrentLine, ' ', 1)
self._ValueList[0:len(TokenList)] = TokenList
@@ -831,6 +825,11 @@
File=self.MetaFile, Line=self._LineIndex+1,
ExtraData=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)
#
# Model, Value1, Value2, Value3, Arch, ModuleType, BelongsToItem=-1, BelongsToFile=-1,
@@ -1042,14 +1041,19 @@
# Only catch expression evalution error here. We need to report
# the precise number of line on which the error occured
#
- EdkLogger.error('Parser', FORMAT_INVALID, "Invalid expression",
- File=self._FileWithError, ExtraData=str(Excpt),
+ 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),
+ Line=self._LineIndex+1)
if self._ValueList == None:
continue
NewOwner = self._IdMapping.get(Owner, -1)
+ self._Enabled = int((not self._DirectiveEvalStack) or (False not in self._DirectiveEvalStack))
self._LastItem = self._Store(
self._ItemType,
self._ValueList[0],
@@ -1063,7 +1067,7 @@
-1,
self._LineIndex+1,
-1,
- int((not self._DirectiveEvalStack) or (False not in self._DirectiveEvalStack))
+ self._Enabled
)
self._IdMapping[Id] = self._LastItem
@@ -1114,6 +1118,9 @@
self._Symbols[Name] = Value
def __ProcessDefine(self):
+ if not self._Enabled:
+ return
+
Type, Name, Value = self._ValueList
Value = ReplaceMacro(Value, self._Macros, False)
if self._ItemType == MODEL_META_DATA_DEFINE:
@@ -1164,6 +1171,7 @@
Directive = self._DirectiveStack.pop()
if Directive in [MODEL_META_DATA_CONDITIONAL_STATEMENT_IF,
MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF,
+ MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSE,
MODEL_META_DATA_CONDITIONAL_STATEMENT_IFNDEF]:
break
elif self._ItemType == MODEL_META_DATA_INCLUDE:
@@ -1212,7 +1220,7 @@
self._ValueList[1] = ReplaceMacro(self._ValueList[1], self._Macros, RaiseError=True)
def __ProcessPcd(self):
- self._ValueList[2] = ReplaceMacro(self._ValueList[2], self._Macros)
+ self._ValueList[2] = str(ValueExpression(self._ValueList[2], self._Macros)())
def __ProcessComponent(self):
self._ValueList[0] = ReplaceMacro(self._ValueList[0], self._Macros)
Modified: trunk/BaseTools/Source/Python/build/build.py
===================================================================
--- trunk/BaseTools/Source/Python/build/build.py 2011-03-04 01:00:46 UTC (rev 2125)
+++ trunk/BaseTools/Source/Python/build/build.py 2011-03-07 07:08:42 UTC (rev 2126)
@@ -1606,6 +1606,11 @@
if DefineList != None:
for Define in DefineList:
DefineTokenList = Define.split("=", 1)
+ if not GlobalData.gMacroNamePattern.match(DefineTokenList[0]):
+ EdkLogger.error('build', FORMAT_INVALID,
+ "The macro name must be in the pattern [A-Z][A-Z0-9_]*",
+ ExtraData=DefineTokenList[0])
+
if len(DefineTokenList) == 1:
DefineDict[DefineTokenList[0]] = ""
else:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jw...@us...> - 2011-03-07 09:55:41
|
Revision: 2127
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2127&view=rev
Author: jwang36
Date: 2011-03-07 09:55:35 +0000 (Mon, 07 Mar 2011)
Log Message:
-----------
Fixed expression issue in dynamic PCD value used in dsc file
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 2011-03-07 07:08:42 UTC (rev 2126)
+++ trunk/BaseTools/Source/Python/Common/String.py 2011-03-07 09:55:35 UTC (rev 2127)
@@ -40,8 +40,38 @@
# @retval list() A list for splitted string
#
def GetSplitValueList(String, SplitTag = DataType.TAB_VALUE_SPLIT, MaxSplit = -1):
- return map(lambda l: l.strip(), String.split(SplitTag, MaxSplit))
+ ValueList = []
+ Last = 0
+ Escaped = False
+ InString = False
+ for Index in range(0, len(String)):
+ Char = String[Index]
+ if not Escaped:
+ # Found a splitter not in a string, split it
+ if not InString and Char == SplitTag:
+ ValueList.append(String[Last:Index].strip())
+ Last = Index+1
+ if MaxSplit > 0 and len(ValueList) >= MaxSplit:
+ break
+
+ if Char == '\\' and InString:
+ Escaped = True
+ elif Char == '"':
+ if not InString:
+ InString = True
+ else:
+ InString = False
+ else:
+ Escaped = False
+
+ if Last < len(String):
+ ValueList.append(String[Last:].strip())
+ elif Last == len(String):
+ ValueList.append('')
+
+ return ValueList
+
## MergeArches
#
# Find a key's all arches in dict, add the new arch to the list
Modified: trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py
===================================================================
--- trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py 2011-03-07 07:08:42 UTC (rev 2126)
+++ trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py 2011-03-07 09:55:35 UTC (rev 2127)
@@ -1220,7 +1220,13 @@
self._ValueList[1] = ReplaceMacro(self._ValueList[1], self._Macros, RaiseError=True)
def __ProcessPcd(self):
- self._ValueList[2] = str(ValueExpression(self._ValueList[2], self._Macros)())
+ ValueList = GetSplitValueList(self._ValueList[2])
+ if len(ValueList) > 1 and ValueList[1] == 'VOID*':
+ PcdValue = ValueList[0]
+ else:
+ PcdValue = ValueList[-1]
+ PcdValue = str(ValueExpression(PcdValue, self._Macros)())
+ self._ValueList[2] = '|'.join(ValueList)
def __ProcessComponent(self):
self._ValueList[0] = ReplaceMacro(self._ValueList[0], self._Macros)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mdk...@us...> - 2011-04-13 21:18:35
|
Revision: 2135
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2135&view=rev
Author: mdkinney
Date: 2011-04-13 21:18:28 +0000 (Wed, 13 Apr 2011)
Log Message:
-----------
1) Ignore [Depex] section in INF if INF specifies [Binaries] and no [Sources]
2) Make sure all evaluations of the PI_SPECIFICATION_VERSION are converted from a string to an int() before any comparison operations.
3) Make sure all evaluations of the UEFI_SPECIFICATION_VERSION are converted from a string to an int() before any comparison operations.
4) Make sure the default string vale for PI_SPECIFICATION_VERSION is the string '0x00000000' and not the value 0.
5) Make sure the default string vale for UEFI_SPECIFICATION_VERSION is the string '0x00000000' and not the value 0.
6) Fix Autogen for libraries to use the PCD TokenNumber declared in a DEC file if the PCD type is DynamicEx.
7) Fix AutoGen.h for libraries to generate extern EFI_GUID declarations for the Token Space GUIDs associated with PCDs the library uses that are type DynamicEx.
8) Do not check the number of ENTRY_POINTs defined for modules of type PEI_CORE, DXE_CORE, or SMM_CORE if the INF specifies [Binaries] and no [Sources]
9) Update AutoGen to produce a Binary INF file for every module built in the module's OUTPUT directory.
Modified Paths:
--------------
trunk/BaseTools/Source/Python/AutoGen/AutoGen.py
trunk/BaseTools/Source/Python/AutoGen/GenC.py
trunk/BaseTools/Source/Python/GenFds/FfsInfStatement.py
trunk/BaseTools/Source/Python/GenFds/Section.py
trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
Modified: trunk/BaseTools/Source/Python/AutoGen/AutoGen.py
===================================================================
--- trunk/BaseTools/Source/Python/AutoGen/AutoGen.py 2011-04-11 00:35:23 UTC (rev 2134)
+++ trunk/BaseTools/Source/Python/AutoGen/AutoGen.py 2011-04-13 21:18:28 UTC (rev 2135)
@@ -1,7 +1,7 @@
## @file
# Generate AutoGen.h, AutoGen.c and *.depex files
#
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2011, 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
@@ -53,6 +53,39 @@
gAutoGenStringFormFileName = "%(module_name)sStrDefs.hpk"
gAutoGenDepexFileName = "%(module_name)s.depex"
+#
+# Template string to generic AsBuilt INF
+#
+gAsBuiltInfHeaderString = TemplateString("""## @file
+# ${module_name}
+#
+# DO NOT EDIT
+# FILE auto-generated Binary INF
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010016
+ BASE_NAME = ${module_name}
+ FILE_GUID = ${module_guid}
+ MODULE_TYPE = ${module_module_type}
+ VERSION_STRING = ${module_version_string}${BEGIN}
+ UEFI_SPECIFICATION_VERSION = ${module_uefi_specification_version}${END}${BEGIN}
+ PI_SPECIFICATION_VERSION = ${module_pi_specification_version}${END}
+
+[Packages]${BEGIN}
+ ${package_item}${END}
+
+[Binaries.${module_arch}]${BEGIN}
+ ${binary_item}${END}
+
+[PcdEx]${BEGIN}
+ ${pcd_item}${END}
+
+## @AsBuilt${BEGIN}
+## ${flags_item}${END}
+""")
+
## Base class for AutoGen
#
# This class just implements the cache mechanism of AutoGen objects.
@@ -540,6 +573,7 @@
Ma = ModuleAutoGen(self.Workspace, ModuleFile, self.BuildTarget,
self.ToolChain, self.Arch, self.MetaFile)
Ma.CreateMakeFile(True)
+ Ma.CreateAsBuiltInf()
# no need to create makefile for the platform more than once
if self.IsMakeFileCreated:
@@ -1642,6 +1676,8 @@
self.IsMakeFileCreated = False
self.IsCodeFileCreated = False
+ self.IsAsBuiltInfCreated = False
+ self.DepexGenerated = False
self.BuildDatabase = self.Workspace.BuildDatabase
@@ -2260,6 +2296,107 @@
self._IncludePathList.append(str(Inc))
return self._IncludePathList
+ ## Create AsBuilt INF file the module
+ #
+ def CreateAsBuiltInf(self):
+ if self.IsAsBuiltInfCreated:
+ return
+
+ # Skip the following code for EDK I inf
+ if self.AutoGenVersion < 0x00010005:
+ return
+
+ # Skip the following code for libraries
+ if self.IsLibrary:
+ return
+
+ # Skip the following code for modules with no source files
+ if self.SourceFileList == None or self.SourceFileList == []:
+ return
+
+ # Skip the following code for modules without any binary files
+ if self.BinaryFileList <> None and self.BinaryFileList <> []:
+ return
+
+ ### TODO: How to handles mixed source and binary modules
+
+ # Find all DynamicEx PCDs used by this module and dependent libraries
+ # Also find all packages that the DynamicEx PCDs depend on
+ Pcds = []
+ Packages = []
+ for Pcd in self.ModulePcdList + self.LibraryPcdList:
+ if Pcd.Type in GenC.gDynamicExPcd:
+ if Pcd not in Pcds:
+ Pcds += [Pcd]
+ for Package in self.DerivedPackageList:
+ if Package not in Packages:
+ if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, 'DynamicEx') in Package.Pcds:
+ Packages += [Package]
+ elif (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, 'Dynamic') in Package.Pcds:
+ Packages += [Package]
+
+ ModuleType = self.ModuleType
+ if ModuleType == 'UEFI_DRIVER' and self.DepexGenerated:
+ ModuleType = 'DXE_DRIVER'
+
+ AsBuiltInfDict = {
+ 'module_name' : self.Name,
+ 'module_guid' : self.Guid,
+ 'module_module_type' : ModuleType,
+ 'module_version_string' : self.Version,
+ 'module_uefi_specification_version' : [],
+ 'module_pi_specification_version' : [],
+ 'module_arch' : self.Arch,
+ 'package_item' : ['%s' % (Package.MetaFile.File.replace('\\','/')) for Package in Packages],
+ 'binary_item' : [],
+ 'pcd_item' : [],
+ 'flags_item' : []
+ }
+
+ if 'UEFI_SPECIFICATION_VERSION' in self.Specification:
+ AsBuiltInfDict['module_uefi_specification_version'] += [self.Specification['UEFI_SPECIFICATION_VERSION']]
+ if 'PI_SPECIFICATION_VERSION' in self.Specification:
+ AsBuiltInfDict['module_pi_specification_version'] += [self.Specification['PI_SPECIFICATION_VERSION']]
+
+ OutputDir = self.OutputDir.replace('\\','/').strip('/')
+ if self.ModuleType in ['BASE', 'USER_DEFINED']:
+ for Item in self.CodaTargetList:
+ File = Item.Target.Path.replace('\\','/').strip('/').replace(OutputDir,'').strip('/')
+ if Item.Target.Ext.lower() == '.aml':
+ AsBuiltInfDict['binary_item'] += ['ASL|' + File]
+ elif Item.Target.Ext.lower() == '.acpi':
+ AsBuiltInfDict['binary_item'] += ['ACPI|' + File]
+ else:
+ AsBuiltInfDict['binary_item'] += ['BIN|' + File]
+ else:
+ for Item in self.CodaTargetList:
+ File = Item.Target.Path.replace('\\','/').strip('/').replace(OutputDir,'').strip('/')
+ if Item.Target.Ext.lower() == '.efi':
+ AsBuiltInfDict['binary_item'] += ['PE32|' + self.Name + '.efi']
+ else:
+ AsBuiltInfDict['binary_item'] += ['BIN|' + File]
+ if self.DepexGenerated:
+ if self.ModuleType in ['PEIM']:
+ AsBuiltInfDict['binary_item'] += ['PEI_DEPEX|' + self.Name + '.depex']
+ if self.ModuleType in ['DXE_DRIVER','DXE_RUNTIME_DRIVER','DXE_SAL_DRIVER','UEFI_DRIVER']:
+ AsBuiltInfDict['binary_item'] += ['DXE_DEPEX|' + self.Name + '.depex']
+ if self.ModuleType in ['DXE_SMM_DRIVER']:
+ AsBuiltInfDict['binary_item'] += ['SMM_DEPEX|' + self.Name + '.depex']
+
+ for Pcd in Pcds:
+ AsBuiltInfDict['pcd_item'] += [Pcd.TokenSpaceGuidCName + '.' + Pcd.TokenCName]
+
+ for Item in self.BuildOption:
+ if 'FLAGS' in self.BuildOption[Item]:
+ AsBuiltInfDict['flags_item'] += ['%s:%s_%s_%s_%s_FLAGS = %s' % (self.ToolChainFamily, self.BuildTarget, self.ToolChain, self.Arch, Item, self.BuildOption[Item]['FLAGS'].strip())]
+
+ AsBuiltInf = TemplateString()
+ AsBuiltInf.Append(gAsBuiltInfHeaderString.Replace(AsBuiltInfDict))
+
+ SaveFileOnChange(os.path.join(self.OutputDir, self.Name + '.inf'), str(AsBuiltInf), False)
+
+ self.IsAsBuiltInfCreated = True
+
## Create makefile for the module and its dependent libraries
#
# @param CreateLibraryMakeFile Flag indicating if or not the makefiles of
@@ -2324,6 +2461,9 @@
Dpx = GenDepex.DependencyExpression(self.DepexList[ModuleType], ModuleType, True)
DpxFile = gAutoGenDepexFileName % {"module_name" : self.Name}
+ if len(Dpx.PostfixNotation) <> 0:
+ self.DepexGenerated = True
+
if Dpx.Generate(path.join(self.OutputDir, DpxFile)):
AutoGenList.append(str(DpxFile))
else:
Modified: trunk/BaseTools/Source/Python/AutoGen/GenC.py
===================================================================
--- trunk/BaseTools/Source/Python/AutoGen/GenC.py 2011-04-11 00:35:23 UTC (rev 2134)
+++ trunk/BaseTools/Source/Python/AutoGen/GenC.py 2011-04-13 21:18:28 UTC (rev 2135)
@@ -1,7 +1,7 @@
## @file
# Routines for generating AutoGen.h and AutoGen.c
#
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2011, 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
@@ -1106,6 +1106,10 @@
ExtraData="[%s]" % str(Info))
TokenNumber = PcdTokenNumber[TokenCName, TokenSpaceGuidCName]
+ # If PCD is DynamicEx, then use TokenNumber declared in DEC file
+ if Pcd.Type in gDynamicExPcd:
+ TokenNumber = int(Pcd.TokenValue, 0)
+
if Pcd.Type not in gItemTypeStringDatabase:
EdkLogger.error("build", AUTOGEN_ERROR,
"Unknown PCD type [%s] of PCD %s.%s" % (Pcd.Type, Pcd.TokenSpaceGuidCName, Pcd.TokenCName),
@@ -1685,11 +1689,11 @@
if 'PI_SPECIFICATION_VERSION' in Info.Module.Specification:
PiSpecVersion = Info.Module.Specification['PI_SPECIFICATION_VERSION']
else:
- PiSpecVersion = 0
+ PiSpecVersion = '0x00000000'
if 'UEFI_SPECIFICATION_VERSION' in Info.Module.Specification:
UefiSpecVersion = Info.Module.Specification['UEFI_SPECIFICATION_VERSION']
else:
- UefiSpecVersion = 0
+ UefiSpecVersion = '0x00000000'
Dict = {
'Function' : Info.Module.ModuleEntryPointList,
'PiSpecVersion' : PiSpecVersion,
@@ -1697,14 +1701,15 @@
}
if Info.ModuleType in ['PEI_CORE', 'DXE_CORE', 'SMM_CORE']:
- if NumEntryPoints != 1:
- EdkLogger.error(
- "build",
- AUTOGEN_ERROR,
- '%s must have exactly one entry point' % Info.ModuleType,
- File=str(Info),
- ExtraData= ", ".join(Info.Module.ModuleEntryPointList)
- )
+ if Info.SourceFileList <> None and Info.SourceFileList <> []:
+ if NumEntryPoints != 1:
+ EdkLogger.error(
+ "build",
+ AUTOGEN_ERROR,
+ '%s must have exactly one entry point' % Info.ModuleType,
+ File=str(Info),
+ ExtraData= ", ".join(Info.Module.ModuleEntryPointList)
+ )
if Info.ModuleType == 'PEI_CORE':
AutoGenC.Append(gPeiCoreEntryPointString.Replace(Dict))
AutoGenH.Append(gPeiCoreEntryPointPrototype.Replace(Dict))
@@ -1835,6 +1840,23 @@
# @param AutoGenH The TemplateString object for header file
#
def CreatePcdCode(Info, AutoGenC, AutoGenH):
+
+ # Collect Token Space GUIDs used by DynamicEc PCDs
+ TokenSpaceList = []
+ for Pcd in Info.ModulePcdList:
+ if Pcd.Type in gDynamicExPcd and Pcd.TokenSpaceGuidCName not in TokenSpaceList:
+ TokenSpaceList += [Pcd.TokenSpaceGuidCName]
+
+ # Add extern declarations to AutoGen.h if one or more Token Space GUIDs were found
+ if TokenSpaceList <> []:
+ AutoGenH.Append("\n// Definition of PCD Token Space GUIDs used in this module\n\n")
+ if Info.ModuleType in ["USER_DEFINED", "BASE"]:
+ GuidType = "GUID"
+ else:
+ GuidType = "EFI_GUID"
+ for Item in TokenSpaceList:
+ AutoGenH.Append('extern %s %s;\n' % (GuidType, Item))
+
if Info.IsLibrary:
if Info.ModulePcdList:
AutoGenH.Append("\n// PCD definitions\n")
Modified: trunk/BaseTools/Source/Python/GenFds/FfsInfStatement.py
===================================================================
--- trunk/BaseTools/Source/Python/GenFds/FfsInfStatement.py 2011-04-11 00:35:23 UTC (rev 2134)
+++ trunk/BaseTools/Source/Python/GenFds/FfsInfStatement.py 2011-04-13 21:18:28 UTC (rev 2135)
@@ -1,7 +1,7 @@
## @file
# process FFS generation from INF statement
#
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2011, 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
@@ -52,7 +52,7 @@
self.KeepRelocFromRule = None
self.InDsc = True
self.OptRomDefs = {}
- self.PiSpecVersion = 0
+ self.PiSpecVersion = '0x00000000'
## __InfParse() method
#
@@ -123,7 +123,7 @@
if len(self.SourceFileList) != 0 and not self.InDsc:
EdkLogger.warn("GenFds", GENFDS_ERROR, "Module %s NOT found in DSC file; Is it really a binary module?" % (self.InfFileName))
- if self.ModuleType == 'SMM_CORE' and self.PiSpecVersion < 0x0001000A:
+ if self.ModuleType == 'SMM_CORE' and int(self.PiSpecVersion, 16) < 0x0001000A:
EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "SMM_CORE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x0001000A", File=self.InfFileName)
if Inf._Defs != None and len(Inf._Defs) > 0:
@@ -179,13 +179,13 @@
#
# Convert Fv File Type for PI1.1 SMM driver.
#
- if self.ModuleType == 'DXE_SMM_DRIVER' and self.PiSpecVersion >= 0x0001000A:
+ if self.ModuleType == 'DXE_SMM_DRIVER' and int(self.PiSpecVersion, 16) >= 0x0001000A:
if Rule.FvFileType == 'DRIVER':
Rule.FvFileType = 'SMM'
#
# Framework SMM Driver has no SMM FV file type
#
- if self.ModuleType == 'DXE_SMM_DRIVER' and self.PiSpecVersion < 0x0001000A:
+ if self.ModuleType == 'DXE_SMM_DRIVER' and int(self.PiSpecVersion, 16) < 0x0001000A:
if Rule.FvFileType == 'SMM' or Rule.FvFileType == 'SMM_CORE':
EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM or SMM_CORE FV file type", File=self.InfFileName)
#
@@ -411,9 +411,9 @@
GenSecInputFile = None
if Rule.FileName != None:
GenSecInputFile = self.__ExtendMacro__(Rule.FileName)
- if os.path.isabs(GenSecInputFile):
- GenSecInputFile = os.path.normpath(GenSecInputFile)
- else:
+ if os.path.isabs(GenSecInputFile):
+ GenSecInputFile = os.path.normpath(GenSecInputFile)
+ else:
GenSecInputFile = os.path.normpath(os.path.join(self.EfiOutputPath, GenSecInputFile))
else:
FileList, IsSect = Section.Section.GetFileList(self, '', Rule.FileExtension)
@@ -423,13 +423,13 @@
#
# Convert Fv Section Type for PI1.1 SMM driver.
#
- if self.ModuleType == 'DXE_SMM_DRIVER' and self.PiSpecVersion >= 0x0001000A:
+ if self.ModuleType == 'DXE_SMM_DRIVER' and int(self.PiSpecVersion, 16) >= 0x0001000A:
if SectionType == 'DXE_DEPEX':
SectionType = 'SMM_DEPEX'
#
# Framework SMM Driver has no SMM_DEPEX section type
#
- if self.ModuleType == 'DXE_SMM_DRIVER' and self.PiSpecVersion < 0x0001000A:
+ if self.ModuleType == 'DXE_SMM_DRIVER' and int(self.PiSpecVersion, 16) < 0x0001000A:
if SectionType == 'SMM_DEPEX':
EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM_DEPEX section type", File=self.InfFileName)
NoStrip = True
@@ -592,13 +592,13 @@
#
# Convert Fv Section Type for PI1.1 SMM driver.
#
- if self.ModuleType == 'DXE_SMM_DRIVER' and self.PiSpecVersion >= 0x0001000A:
+ if self.ModuleType == 'DXE_SMM_DRIVER' and int(self.PiSpecVersion, 16) >= 0x0001000A:
if Sect.SectionType == 'DXE_DEPEX':
Sect.SectionType = 'SMM_DEPEX'
#
# Framework SMM Driver has no SMM_DEPEX section type
#
- if self.ModuleType == 'DXE_SMM_DRIVER' and self.PiSpecVersion < 0x0001000A:
+ if self.ModuleType == 'DXE_SMM_DRIVER' and int(self.PiSpecVersion, 16) < 0x0001000A:
if Sect.SectionType == 'SMM_DEPEX':
EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM_DEPEX section type", File=self.InfFileName)
#
Modified: trunk/BaseTools/Source/Python/GenFds/Section.py
===================================================================
--- trunk/BaseTools/Source/Python/GenFds/Section.py 2011-04-11 00:35:23 UTC (rev 2134)
+++ trunk/BaseTools/Source/Python/GenFds/Section.py 2011-04-13 21:18:28 UTC (rev 2135)
@@ -1,7 +1,7 @@
## @file
# section base class
#
-# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007-2011, 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
@@ -129,7 +129,7 @@
if FileType != None:
for File in FfsInf.BinFileList:
if File.Arch == "COMMON" or FfsInf.CurrentArch == File.Arch:
- if File.Type == FileType or (FfsInf.PiSpecVersion >= 0x0001000A and FileType == 'DXE_DPEX'and File.Type == 'SMM_DEPEX'):
+ if File.Type == FileType or (int(FfsInf.PiSpecVersion, 16) >= 0x0001000A and FileType == 'DXE_DPEX'and File.Type == 'SMM_DEPEX'):
if '*' in FfsInf.TargetOverrideList or File.Target == '*' or File.Target in FfsInf.TargetOverrideList or FfsInf.TargetOverrideList == []:
FileList.append(File.Path)
else:
Modified: trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
===================================================================
--- trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py 2011-04-11 00:35:23 UTC (rev 2134)
+++ trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py 2011-04-13 21:18:28 UTC (rev 2135)
@@ -1,7 +1,7 @@
## @file
# This file is used to create a database used by build tool
#
-# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2008 - 2011, 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
@@ -1471,7 +1471,7 @@
EdkLogger.error("build", FORMAT_NOT_SUPPORTED,
"MODULE_TYPE %s is not supported for EDK II, valid values are:\n %s" % (self._ModuleType,' '.join(l for l in SUP_MODULE_LIST)),
File=self.MetaFile, Line=LineNo)
- if (self._Specification == None) or (not 'PI_SPECIFICATION_VERSION' in self._Specification) or (self._Specification['PI_SPECIFICATION_VERSION'] < 0x0001000A):
+ if (self._Specification == None) or (not 'PI_SPECIFICATION_VERSION' in self._Specification) or (int(self._Specification['PI_SPECIFICATION_VERSION'], 16) < 0x0001000A):
if self._ModuleType == SUP_MODULE_SMM_CORE:
EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "SMM_CORE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x0001000A", File=self.MetaFile)
if self._Defs and 'PCI_DEVICE_ID' in self._Defs and 'PCI_VENDOR_ID' in self._Defs \
@@ -1939,7 +1939,12 @@
if self._Depex == None:
self._Depex = tdict(False, 2)
RecordList = self._RawData[MODEL_EFI_DEPEX, self._Arch]
-
+
+ # If the module has only Binaries and no Sources, then ignore [Depex]
+ if self.Sources == None or self.Sources == []:
+ if self.Binaries <> None and self.Binaries <> []:
+ return self._Depex
+
# PEIM and DXE drivers must have a valid [Depex] section
if len(self.LibraryClass) == 0 and len(RecordList) == 0:
if self.ModuleType == 'DXE_DRIVER' or self.ModuleType == 'PEIM' or self.ModuleType == 'DXE_SMM_DRIVER' or \
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gi...@us...> - 2011-08-05 01:51:19
|
Revision: 2228
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2228&view=rev
Author: gikidy
Date: 2011-08-05 01:51:13 +0000 (Fri, 05 Aug 2011)
Log Message:
-----------
1)Fix a bug during only update flash image will report error;
2)Fix a bug GenFds tool will parse un-related platform DSC file;
Signed-off-by: gikidy
Reviewed-by: lhauch
Modified Paths:
--------------
trunk/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
trunk/BaseTools/Source/Python/build/build.py
Modified: trunk/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
===================================================================
--- trunk/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py 2011-08-05 01:46:23 UTC (rev 2227)
+++ trunk/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py 2011-08-05 01:51:13 UTC (rev 2228)
@@ -459,17 +459,21 @@
PcdValue = ''
for Platform in GenFdsGlobalVariable.WorkSpace.PlatformList:
- PcdDict = Platform.Pcds
- for Key in PcdDict:
- PcdObj = PcdDict[Key]
- if (PcdObj.TokenCName == TokenCName) and (PcdObj.TokenSpaceGuidCName == TokenSpace):
- if PcdObj.Type != 'FixedAtBuild':
- EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not FixedAtBuild type." % PcdPattern)
- if PcdObj.DatumType != 'VOID*':
- EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not VOID* datum type." % PcdPattern)
-
- PcdValue = PcdObj.DefaultValue
- return PcdValue
+ #
+ # Only process platform which match current build option.
+ #
+ if Platform.MetaFile == GenFdsGlobalVariable.ActivePlatform:
+ PcdDict = Platform.Pcds
+ for Key in PcdDict:
+ PcdObj = PcdDict[Key]
+ if (PcdObj.TokenCName == TokenCName) and (PcdObj.TokenSpaceGuidCName == TokenSpace):
+ if PcdObj.Type != 'FixedAtBuild':
+ EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not FixedAtBuild type." % PcdPattern)
+ if PcdObj.DatumType != 'VOID*':
+ EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not VOID* datum type." % PcdPattern)
+
+ PcdValue = PcdObj.DefaultValue
+ return PcdValue
for Package in GenFdsGlobalVariable.WorkSpace.PackageList:
PcdDict = Package.Pcds
Modified: trunk/BaseTools/Source/Python/build/build.py
===================================================================
--- trunk/BaseTools/Source/Python/build/build.py 2011-08-05 01:46:23 UTC (rev 2227)
+++ trunk/BaseTools/Source/Python/build/build.py 2011-08-05 01:51:13 UTC (rev 2228)
@@ -1242,13 +1242,13 @@
# Create MAP file when Load Fix Address is enabled.
if self.Target in ["", "all", "fds"]:
- for Arch in wa.ArchList:
+ for Arch in Wa.ArchList:
GlobalData.gGlobalDefines['ARCH'] = Arch
#
# Check whether the set fix address is above 4G for 32bit image.
#
if (Arch == 'IA32' or Arch == 'ARM') and self.LoadFixAddress != 0xFFFFFFFFFFFFFFFF and self.LoadFixAddress >= 0x100000000:
- EdkLogger.error("build", PARAMETER_INVALID, "FIX_LOAD_TOP_MEMORY_ADDRESS can't be set to larger than or equal to 4G for the platorm with IA32 or ARM arch modules")
+ EdkLogger.error("build", PARAMETER_INVALID, "FIX_LOAD_TOP_MEMORY_ADDRESS can't be set to larger than or equal to 4G for the platform with IA32 or ARM arch modules")
#
# Get Module List
#
@@ -1805,8 +1805,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
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gi...@us...> - 2011-08-15 05:05:30
|
Revision: 2249
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2249&view=rev
Author: gikidy
Date: 2011-08-15 05:05:23 +0000 (Mon, 15 Aug 2011)
Log Message:
-----------
1) Fix a incremental build issue that our tools cache mechanism will get previous build data even it's not needed.
2) A minor fix that during build if no component information found for EDK1 INF file, will report error but not crash.
Signed-off-by: gikidy
Reviewed-by: yingke
Reviewed-by: jsu1
Modified Paths:
--------------
trunk/BaseTools/Source/Python/AutoGen/AutoGen.py
trunk/BaseTools/Source/Python/Common/Misc.py
trunk/BaseTools/Source/Python/GenFds/Fd.py
trunk/BaseTools/Source/Python/GenFds/FfsFileStatement.py
trunk/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
trunk/BaseTools/Source/Python/Workspace/MetaDataTable.py
trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
Modified: trunk/BaseTools/Source/Python/AutoGen/AutoGen.py
===================================================================
--- trunk/BaseTools/Source/Python/AutoGen/AutoGen.py 2011-08-12 05:23:15 UTC (rev 2248)
+++ trunk/BaseTools/Source/Python/AutoGen/AutoGen.py 2011-08-15 05:05:23 UTC (rev 2249)
@@ -155,7 +155,7 @@
class WorkspaceAutoGen(AutoGen):
## Real constructor of WorkspaceAutoGen
#
- # This method behaves the same as __init__ except that it needs explict invoke
+ # This method behaves the same as __init__ except that it needs explicit invoke
# (in super class's __new__ method)
#
# @param WorkspaceDir Root directory of workspace
@@ -386,8 +386,8 @@
# @return None
#
def _CheckAllPcdsTokenValueConflict(self):
- if len(self.BuildDatabase.WorkspaceDb.PackageList) >= 1:
- for Package in self.BuildDatabase.WorkspaceDb.PackageList:
+ for Pa in self.AutoGenObjectList:
+ for Package in Pa.PackageList:
PcdList = Package.Pcds.values()
PcdList.sort(lambda x, y: cmp(x.TokenValue, y.TokenValue))
Count = 0
Modified: trunk/BaseTools/Source/Python/Common/Misc.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/Misc.py 2011-08-12 05:23:15 UTC (rev 2248)
+++ trunk/BaseTools/Source/Python/Common/Misc.py 2011-08-15 05:05:23 UTC (rev 2249)
@@ -1465,7 +1465,7 @@
self.SectionHeaderList = []
self.ErrorInfo = ''
try:
- PeObject = open(PeFile, 'rb')
+ PeObject = open(PeFile, 'rb')
except:
self.ErrorInfo = self.FileName + ' can not be found\n'
return
Modified: trunk/BaseTools/Source/Python/GenFds/Fd.py
===================================================================
--- trunk/BaseTools/Source/Python/GenFds/Fd.py 2011-08-12 05:23:15 UTC (rev 2248)
+++ trunk/BaseTools/Source/Python/GenFds/Fd.py 2011-08-15 05:05:23 UTC (rev 2249)
@@ -71,11 +71,11 @@
for RegionObj in self.RegionList :
if RegionObj.RegionType == 'CAPSULE':
- continue
+ continue
if RegionObj.Offset + RegionObj.Size <= PreviousRegionStart:
- pass
+ pass
elif RegionObj.Offset <= PreviousRegionStart or (RegionObj.Offset >=PreviousRegionStart and RegionObj.Offset < PreviousRegionStart + PreviousRegionSize):
- pass
+ pass
elif RegionObj.Offset > PreviousRegionStart + PreviousRegionSize:
GenFdsGlobalVariable.InfLogger('Padding region starting from offset 0x%X, with size 0x%X' %(PreviousRegionStart + PreviousRegionSize, RegionObj.Offset - (PreviousRegionStart + PreviousRegionSize)))
PadRegion = Region.Region()
@@ -88,7 +88,7 @@
# Call each region's AddToBuffer function
#
if PreviousRegionSize > self.Size:
- pass
+ pass
GenFdsGlobalVariable.VerboseLogger('Call each region\'s AddToBuffer function')
RegionObj.AddToBuffer (TempFdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFds.ImageBinDict, self.vtfRawDict, self.DefineVarDict)
Modified: trunk/BaseTools/Source/Python/GenFds/FfsFileStatement.py
===================================================================
--- trunk/BaseTools/Source/Python/GenFds/FfsFileStatement.py 2011-08-12 05:23:15 UTC (rev 2248)
+++ trunk/BaseTools/Source/Python/GenFds/FfsFileStatement.py 2011-08-15 05:05:23 UTC (rev 2249)
@@ -67,7 +67,7 @@
OutputDir = os.path.join(GenFdsGlobalVariable.FfsDir, self.NameGuid)
if not os.path.exists(OutputDir):
- os.makedirs(OutputDir)
+ os.makedirs(OutputDir)
Dict.update(self.DefineVarDict)
SectionAlignments = None
Modified: trunk/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
===================================================================
--- trunk/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py 2011-08-12 05:23:15 UTC (rev 2248)
+++ trunk/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py 2011-08-15 05:05:23 UTC (rev 2249)
@@ -647,12 +647,25 @@
TokenCName = PcdPair[1]
PcdValue = ''
- for Platform in GenFdsGlobalVariable.WorkSpace.PlatformList:
- #
- # Only process platform which match current build option.
- #
- if Platform.MetaFile == GenFdsGlobalVariable.ActivePlatform:
- PcdDict = Platform.Pcds
+ for Arch in GenFdsGlobalVariable.ArchList:
+ Platform = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
+ PcdDict = Platform.Pcds
+ for Key in PcdDict:
+ PcdObj = PcdDict[Key]
+ if (PcdObj.TokenCName == TokenCName) and (PcdObj.TokenSpaceGuidCName == TokenSpace):
+ if PcdObj.Type != 'FixedAtBuild':
+ EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not FixedAtBuild type." % PcdPattern)
+ if PcdObj.DatumType != 'VOID*':
+ EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not VOID* datum type." % PcdPattern)
+
+ PcdValue = PcdObj.DefaultValue
+ return PcdValue
+
+ for Package in GenFdsGlobalVariable.WorkSpace.GetPackageList(GenFdsGlobalVariable.ActivePlatform,
+ Arch,
+ GenFdsGlobalVariable.TargetName,
+ GenFdsGlobalVariable.ToolChainTag):
+ PcdDict = Package.Pcds
for Key in PcdDict:
PcdObj = PcdDict[Key]
if (PcdObj.TokenCName == TokenCName) and (PcdObj.TokenSpaceGuidCName == TokenSpace):
@@ -664,19 +677,6 @@
PcdValue = PcdObj.DefaultValue
return PcdValue
- for Package in GenFdsGlobalVariable.WorkSpace.PackageList:
- PcdDict = Package.Pcds
- for Key in PcdDict:
- PcdObj = PcdDict[Key]
- if (PcdObj.TokenCName == TokenCName) and (PcdObj.TokenSpaceGuidCName == TokenSpace):
- if PcdObj.Type != 'FixedAtBuild':
- EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not FixedAtBuild type." % PcdPattern)
- if PcdObj.DatumType != 'VOID*':
- EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not VOID* datum type." % PcdPattern)
-
- PcdValue = PcdObj.DefaultValue
- return PcdValue
-
return PcdValue
SetDir = staticmethod(SetDir)
Modified: trunk/BaseTools/Source/Python/Workspace/MetaDataTable.py
===================================================================
--- trunk/BaseTools/Source/Python/Workspace/MetaDataTable.py 2011-08-12 05:23:15 UTC (rev 2248)
+++ trunk/BaseTools/Source/Python/Workspace/MetaDataTable.py 2011-08-15 05:05:23 UTC (rev 2249)
@@ -140,6 +140,10 @@
def SetEndFlag(self):
self.Exec("insert into %s values(%s)" % (self.Table, self._DUMMY_))
+ #
+ # Need to execution commit for table data changed.
+ #
+ self.Cur.connection.commit()
def IsIntegral(self):
Result = self.Exec("select min(ID) from %s" % (self.Table))
Modified: trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
===================================================================
--- trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py 2011-08-12 05:23:15 UTC (rev 2248)
+++ trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py 2011-08-15 05:05:23 UTC (rev 2249)
@@ -1482,11 +1482,11 @@
self._BuildType = 'UEFI_HII'
else:
self._BuildType = self._ModuleType.upper()
- else:
- self._BuildType = self._ComponentType.upper()
+ else:
if not self._ComponentType:
EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE,
"COMPONENT_TYPE is not given", File=self.MetaFile)
+ self._BuildType = self._ComponentType.upper()
if self._ComponentType in self._MODULE_TYPE_:
self._ModuleType = self._MODULE_TYPE_[self._ComponentType]
if self._ComponentType == 'LIBRARY':
@@ -1942,8 +1942,8 @@
# If the module has only Binaries and no Sources, then ignore [Depex]
if self.Sources == None or self.Sources == []:
- if self.Binaries <> None and self.Binaries <> []:
- return self._Depex
+ if self.Binaries != None and self.Binaries != []:
+ return self._Depex
# PEIM and DXE drivers must have a valid [Depex] section
if len(self.LibraryClass) == 0 and len(RecordList) == 0:
@@ -2331,6 +2331,7 @@
# create table for internal uses
self.TblDataModel = TableDataModel(self.Cur)
self.TblFile = TableFile(self.Cur)
+ self.Platform = None
# conversion object for build or file format conversion purpose
self.BuildObject = WorkspaceDatabase.BuildObjectFactory(self)
@@ -2428,12 +2429,27 @@
## Summarize all packages in the database
- def _GetPackageList(self):
- PackageList = []
- for Module in self.ModuleList:
- for Package in Module.Packages:
+ def GetPackageList(self, Platform, Arch, TargetName, ToolChainTag):
+ self.Platform = Platform
+ PackageList =[]
+ Pa = self.BuildObject[self.Platform, 'COMMON']
+ #
+ # Get Package related to Modules
+ #
+ for Module in Pa.Modules:
+ ModuleObj = self.BuildObject[Module, Arch, TargetName, ToolChainTag]
+ for Package in ModuleObj.Packages:
if Package not in PackageList:
PackageList.append(Package)
+ #
+ # Get Packages related to Libraries
+ #
+ for Lib in Pa.LibraryInstances:
+ LibObj = self.BuildObject[Lib, Arch, TargetName, ToolChainTag]
+ for Package in LibObj.Packages:
+ if Package not in PackageList:
+ PackageList.append(Package)
+
return PackageList
## Summarize all platforms in the database
@@ -2448,21 +2464,7 @@
PlatformList.append(Platform)
return PlatformList
- ## Summarize all modules in the database
- def _GetModuleList(self):
- ModuleList = []
- for ModuleFile in self.TblFile.GetFileList(MODEL_FILE_INF):
- try:
- Module = self.BuildObject[PathClass(ModuleFile), 'COMMON']
- except:
- Module = None
- if Module != None:
- ModuleList.append(Module)
- return ModuleList
-
PlatformList = property(_GetPlatformList)
- PackageList = property(_GetPackageList)
- ModuleList = property(_GetModuleList)
##
#
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gi...@us...> - 2011-08-22 07:55:28
|
Revision: 2264
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2264&view=rev
Author: gikidy
Date: 2011-08-22 07:55:22 +0000 (Mon, 22 Aug 2011)
Log Message:
-----------
Remove the data cache in Conf directory while build target is ?\226?\128?\156cleanall?\226?\128?\157.
Signed-off-by: gikidy
Reviewed-by: jsu1
Modified Paths:
--------------
trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
trunk/BaseTools/Source/Python/build/build.py
Modified: trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
===================================================================
--- trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py 2011-08-22 07:08:35 UTC (rev 2263)
+++ trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py 2011-08-22 07:55:22 UTC (rev 2264)
@@ -2303,6 +2303,7 @@
# @prarm RenewDb=False Create new database file if it's already there
#
def __init__(self, DbPath, RenewDb=False):
+ self._DbClosedFlag = False
if not DbPath:
DbPath = os.path.normpath(os.path.join(GlobalData.gWorkspace, self._DB_PATH_))
@@ -2423,11 +2424,12 @@
# Close the connection and cursor
#
def Close(self):
- self.Conn.commit()
- self.Cur.close()
- self.Conn.close()
+ if not self._DbClosedFlag:
+ self.Conn.commit()
+ self.Cur.close()
+ self.Conn.close()
+ self._DbClosedFlag = True
-
## Summarize all packages in the database
def GetPackageList(self, Platform, Arch, TargetName, ToolChainTag):
self.Platform = Platform
Modified: trunk/BaseTools/Source/Python/build/build.py
===================================================================
--- trunk/BaseTools/Source/Python/build/build.py 2011-08-22 07:08:35 UTC (rev 2263)
+++ trunk/BaseTools/Source/Python/build/build.py 2011-08-22 07:55:22 UTC (rev 2264)
@@ -912,6 +912,11 @@
try:
#os.rmdir(AutoGenObject.BuildDir)
RemoveDirectory(AutoGenObject.BuildDir, True)
+ #
+ # First should close DB.
+ #
+ self.Db.Close()
+ RemoveDirectory(gBuildCacheDir, True)
except WindowsError, X:
EdkLogger.error("build", FILE_DELETE_FAILURE, ExtraData=str(X))
return True
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2011-08-26 03:28:31
|
Revision: 2273
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2273&view=rev
Author: jsu1
Date: 2011-08-26 03:28:25 +0000 (Fri, 26 Aug 2011)
Log Message:
-----------
Add support for DPX_SOURCE in [Defines] section for EDKII modules
Signed-off-by: jsu1
Reviewed-by: lhauch
Modified Paths:
--------------
trunk/BaseTools/Source/Python/AutoGen/AutoGen.py
trunk/BaseTools/Source/Python/Common/DataType.py
trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
Modified: trunk/BaseTools/Source/Python/AutoGen/AutoGen.py
===================================================================
--- trunk/BaseTools/Source/Python/AutoGen/AutoGen.py 2011-08-25 21:35:12 UTC (rev 2272)
+++ trunk/BaseTools/Source/Python/AutoGen/AutoGen.py 2011-08-26 03:28:25 UTC (rev 2273)
@@ -1838,6 +1838,10 @@
def _GetBaseName(self):
return self.Module.BaseName
+ ## Return the module DxsFile if exist
+ def _GetDxsFile(self):
+ return self.Module.DxsFile
+
## Return the module SourceOverridePath
def _GetSourceOverridePath(self):
return self.Module.SourceOverridePath
@@ -1957,7 +1961,7 @@
def _GetDepexTokenList(self):
if self._DepexList == None:
self._DepexList = {}
- if self.IsLibrary or TAB_DEPENDENCY_EXPRESSION_FILE in self.FileTypes:
+ if self.DxsFile or self.IsLibrary or TAB_DEPENDENCY_EXPRESSION_FILE in self.FileTypes:
return self._DepexList
self._DepexList[self.ModuleType] = []
@@ -1993,7 +1997,7 @@
def _GetDepexExpressionTokenList(self):
if self._DepexExpressionList == None:
self._DepexExpressionList = {}
- if self.IsLibrary or TAB_DEPENDENCY_EXPRESSION_FILE in self.FileTypes:
+ if self.DxsFile or self.IsLibrary or TAB_DEPENDENCY_EXPRESSION_FILE in self.FileTypes:
return self._DepexExpressionList
self._DepexExpressionList[self.ModuleType] = ''
@@ -2197,7 +2201,7 @@
self._BuildTargets = {}
self._FileTypes = {}
- #TRICK: call _GetSourceFileList to apply build rule for binary files
+ #TRICK: call _GetSourceFileList to apply build rule for source files
if self.SourceFileList:
pass
@@ -2616,6 +2620,7 @@
ProtocolList = property(_GetProtocolList)
PpiList = property(_GetPpiList)
DepexList = property(_GetDepexTokenList)
+ DxsFile = property(_GetDxsFile)
DepexExpressionList = property(_GetDepexExpressionTokenList)
BuildOption = property(_GetModuleBuildOption)
BuildCommand = property(_GetBuildCommand)
Modified: trunk/BaseTools/Source/Python/Common/DataType.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/DataType.py 2011-08-25 21:35:12 UTC (rev 2272)
+++ trunk/BaseTools/Source/Python/Common/DataType.py 2011-08-26 03:28:25 UTC (rev 2273)
@@ -302,6 +302,7 @@
TAB_INF_DEFINES_LIBRARY_CLASS = 'LIBRARY_CLASS'
TAB_INF_DEFINES_COMPONENT_TYPE = 'COMPONENT_TYPE'
TAB_INF_DEFINES_MAKEFILE_NAME = 'MAKEFILE_NAME'
+TAB_INF_DEFINES_DPX_SOURCE = 'DPX_SOURCE'
TAB_INF_DEFINES_BUILD_NUMBER = 'BUILD_NUMBER'
TAB_INF_DEFINES_BUILD_TYPE = 'BUILD_TYPE'
TAB_INF_DEFINES_FFS_EXT = 'FFS_EXT'
Modified: trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
===================================================================
--- trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py 2011-08-25 21:35:12 UTC (rev 2272)
+++ trunk/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py 2011-08-26 03:28:25 UTC (rev 2273)
@@ -1224,6 +1224,7 @@
TAB_INF_DEFINES_COMPONENT_TYPE : "_ComponentType",
TAB_INF_DEFINES_MAKEFILE_NAME : "_MakefileName",
#TAB_INF_DEFINES_CUSTOM_MAKEFILE : "_CustomMakefile",
+ TAB_INF_DEFINES_DPX_SOURCE :"_DxsFile",
TAB_INF_DEFINES_VERSION_NUMBER : "_Version",
TAB_INF_DEFINES_VERSION_STRING : "_Version",
TAB_INF_DEFINES_VERSION : "_Version",
@@ -1305,6 +1306,7 @@
self._Header_ = None
self._AutoGenVersion = None
self._BaseName = None
+ self._DxsFile = None
self._ModuleType = None
self._ComponentType = None
self._BuildType = None
@@ -1482,6 +1484,17 @@
self._BuildType = 'UEFI_HII'
else:
self._BuildType = self._ModuleType.upper()
+
+ if self._DxsFile:
+ File = PathClass(NormPath(self._DxsFile), self._ModuleDir, Arch=self._Arch)
+ # check the file validation
+ ErrorCode, ErrorInfo = File.Validate(".dxs", CaseSensitive=False)
+ if ErrorCode != 0:
+ EdkLogger.error('build', ErrorCode, ExtraData=ErrorInfo,
+ File=self.MetaFile, Line=LineNo)
+ if self.Sources == None:
+ self._Sources = []
+ self._Sources.append(File)
else:
if not self._ComponentType:
EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE,
@@ -1565,6 +1578,15 @@
EdkLogger.error('build', ATTRIBUTE_NOT_AVAILABLE, "No BASE_NAME name", File=self.MetaFile)
return self._BaseName
+ ## Retrieve DxsFile
+ def _GetDxsFile(self):
+ if self._DxsFile == None:
+ if self._Header_ == None:
+ self._GetHeaderInfo()
+ if self._DxsFile == None:
+ self._DxsFile = ''
+ return self._DxsFile
+
## Retrieve MODULE_TYPE
def _GetModuleType(self):
if self._ModuleType == None:
@@ -1934,7 +1956,7 @@
self._BuildOptions[ToolChainFamily, ToolChain] = OptionString + " " + Option
return self._BuildOptions
- ## Retrieve depedency expression
+ ## Retrieve dependency expression
def _GetDepex(self):
if self._Depex == None:
self._Depex = tdict(False, 2)
@@ -2166,7 +2188,8 @@
ConstructorList = property(_GetConstructor)
DestructorList = property(_GetDestructor)
Defines = property(_GetDefines)
-
+ DxsFile = property(_GetDxsFile)
+
Binaries = property(_GetBinaryFiles)
Sources = property(_GetSourceFiles)
LibraryClasses = property(_GetLibraryClassUses)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <yi...@us...> - 2011-09-13 06:58:41
|
Revision: 2309
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2309&view=rev
Author: yingke
Date: 2011-09-13 06:58:31 +0000 (Tue, 13 Sep 2011)
Log Message:
-----------
Fix a crash issue if a module is not defined in DSC file, but as binary defined in FDF File.
Signed-off-by: yingke
Reviewed-by: gikidy
Reviewed-by: lgao4
Modified Paths:
--------------
trunk/BaseTools/Source/Python/GenFds/FfsInfStatement.py
trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py
Modified: trunk/BaseTools/Source/Python/GenFds/FfsInfStatement.py
===================================================================
--- trunk/BaseTools/Source/Python/GenFds/FfsInfStatement.py 2011-09-13 06:47:39 UTC (rev 2308)
+++ trunk/BaseTools/Source/Python/GenFds/FfsInfStatement.py 2011-09-13 06:58:31 UTC (rev 2309)
@@ -73,22 +73,27 @@
and not self.InfModule.DxsFile and not self.InfModule.LibraryClass:
ModuleType = self.InfModule.ModuleType
PlatformDataBase = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, self.CurrentArch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
- PlatformModule = PlatformDataBase.Modules[str(self.InfModule)]
if ModuleType != DataType.SUP_MODULE_USER_DEFINED:
for LibraryClass in PlatformDataBase.LibraryClasses.GetKeys():
if LibraryClass.startswith("NULL") and PlatformDataBase.LibraryClasses[LibraryClass, ModuleType]:
self.InfModule.LibraryClasses[LibraryClass] = PlatformDataBase.LibraryClasses[LibraryClass, ModuleType]
- for LibraryClass in PlatformModule.LibraryClasses:
- if LibraryClass.startswith("NULL"):
- self.InfModule.LibraryClasses[LibraryClass] = PlatformModule.LibraryClasses[LibraryClass]
+ StrModule = str(self.InfModule)
+ PlatformModule = None
+ if StrModule in PlatformDataBase.Modules:
+ PlatformModule = PlatformDataBase.Modules[StrModule]
+ for LibraryClass in PlatformModule.LibraryClasses:
+ if LibraryClass.startswith("NULL"):
+ self.InfModule.LibraryClasses[LibraryClass] = PlatformModule.LibraryClasses[LibraryClass]
DependencyList = [self.InfModule]
LibraryInstance = {}
DepexList = []
while len(DependencyList) > 0:
Module = DependencyList.pop(0)
+ if not Module:
+ continue
for Dep in Module.Depex[self.CurrentArch, ModuleType]:
if DepexList != []:
DepexList.append('AND')
@@ -102,7 +107,7 @@
for LibName in Module.LibraryClasses:
if LibName in LibraryInstance:
continue
- if LibName in PlatformModule.LibraryClasses:
+ if PlatformModule and LibName in PlatformModule.LibraryClasses:
LibraryPath = PlatformModule.LibraryClasses[LibName]
else:
LibraryPath = PlatformDataBase.LibraryClasses[LibName, ModuleType]
Modified: trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py
===================================================================
--- trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py 2011-09-13 06:47:39 UTC (rev 2308)
+++ trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py 2011-09-13 06:58:31 UTC (rev 2309)
@@ -884,7 +884,10 @@
EdkLogger.error('Parser', FORMAT_INVALID, "No value specified",
ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
if not self._ValueList[1] in self.DefineKeywords:
- EdkLogger.error('Parser', FORMAT_INVALID, "Unknown name: %s" % self._ValueList[1],
+ 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)
self._Defines[self._ValueList[1]] = self._ValueList[2]
self._ItemType = self.DataType[TAB_DSC_DEFINES.upper()]
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2011-09-27 09:06:22
|
Revision: 2331
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2331&view=rev
Author: jsu1
Date: 2011-09-27 09:06:16 +0000 (Tue, 27 Sep 2011)
Log Message:
-----------
Enhance build tool to generate same release efi/FD/FV binaries for same development tree
Signed-off-by: jsu1
Reviewed-by: gikidy
Modified Paths:
--------------
trunk/BaseTools/Source/Python/AutoGen/AutoGen.py
trunk/BaseTools/Source/Python/Common/Misc.py
Modified: trunk/BaseTools/Source/Python/AutoGen/AutoGen.py
===================================================================
--- trunk/BaseTools/Source/Python/AutoGen/AutoGen.py 2011-09-27 09:05:38 UTC (rev 2330)
+++ trunk/BaseTools/Source/Python/AutoGen/AutoGen.py 2011-09-27 09:06:16 UTC (rev 2331)
@@ -2340,7 +2340,7 @@
#
def _GetLibraryPcdList(self):
if self._LibraryPcdList == None:
- Pcds = {}
+ Pcds = sdict()
if not self.IsLibrary:
# get PCDs from dependent libraries
for Library in self.DependentLibraryList:
Modified: trunk/BaseTools/Source/Python/Common/Misc.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/Misc.py 2011-09-27 09:05:38 UTC (rev 2330)
+++ trunk/BaseTools/Source/Python/Common/Misc.py 2011-09-27 09:06:16 UTC (rev 2331)
@@ -1396,6 +1396,27 @@
else:
return self.Path == str(Other)
+ ## Override __cmp__ function
+ #
+ # Customize the comparsion operation of two PathClass
+ #
+ # @retval 0 The two PathClass are different
+ # @retval -1 The first PathClass is less than the second PathClass
+ # @retval 1 The first PathClass is Bigger than the second PathClass
+ def __cmp__(self, Other):
+ if type(Other) == type(self):
+ OtherKey = Other.Path
+ else:
+ OtherKey = str(Other)
+
+ SelfKey = self.Path
+ if SelfKey == OtherKey:
+ return 0
+ elif SelfKey > OtherKey:
+ return 1
+ else:
+ return -1
+
## Override __hash__ function
#
# Use Path as key in hash table
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gi...@us...> - 2011-10-01 03:43:06
|
Revision: 2346
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2346&view=rev
Author: gikidy
Date: 2011-10-01 03:42:59 +0000 (Sat, 01 Oct 2011)
Log Message:
-----------
Enhancement for GenFds tool to report error when it finds the duplicated INFs specified in a [FV] section
Signed-off-by: gikidy
Reviewed-by: lgao4
Reviewed-by: djboyer
Reviewed-by: lhauch
Modified Paths:
--------------
trunk/BaseTools/Source/Python/AutoGen/AutoGen.py
trunk/BaseTools/Source/Python/GenFds/FdfParser.py
trunk/BaseTools/Source/Python/GenFds/FfsFileStatement.py
trunk/BaseTools/Source/Python/GenFds/FfsInfStatement.py
Modified: trunk/BaseTools/Source/Python/AutoGen/AutoGen.py
===================================================================
--- trunk/BaseTools/Source/Python/AutoGen/AutoGen.py 2011-09-30 07:16:25 UTC (rev 2345)
+++ trunk/BaseTools/Source/Python/AutoGen/AutoGen.py 2011-10-01 03:42:59 UTC (rev 2346)
@@ -285,6 +285,9 @@
#
self._CheckPcdDefineAndType()
+ if self.FdfFile:
+ self._CheckDuplicateInFV(Fdf)
+
self._BuildDir = None
self._FvDir = None
self._MakeFileDir = None
@@ -292,6 +295,126 @@
return True
+ ## _CheckDuplicateInFV() method
+ #
+ # Check whether there is duplicate modules/files exist in FV section.
+ # The check base on the file GUID;
+ #
+ def _CheckDuplicateInFV(self, Fdf):
+ for Fv in Fdf.Profile.FvDict:
+ _GuidDict = {}
+ for FfsFile in Fdf.Profile.FvDict[Fv].FfsList:
+ if FfsFile.InfFileName and FfsFile.NameGuid == None:
+ #
+ # Get INF file GUID
+ #
+ InfFoundFlag = False
+ for Pa in self.AutoGenObjectList:
+ for Module in Pa.ModuleAutoGenList:
+ if path.normpath(Module.MetaFile.File) == path.normpath(FfsFile.InfFileName):
+ InfFoundFlag = True
+ if not Module.Guid.upper() in _GuidDict.keys():
+ _GuidDict[Module.Guid.upper()] = FfsFile
+ else:
+ EdkLogger.error("build",
+ FORMAT_INVALID,
+ "Duplicate GUID found for these lines: Line %d: %s and Line %d: %s. GUID: %s"%(FfsFile.CurrentLineNum,
+ FfsFile.CurrentLineContent,
+ _GuidDict[Module.Guid.upper()].CurrentLineNum,
+ _GuidDict[Module.Guid.upper()].CurrentLineContent,
+ Module.Guid.upper()),
+ ExtraData=self.FdfFile)
+ #
+ # Some INF files not have entity in DSC file.
+ #
+ if not InfFoundFlag:
+ if FfsFile.InfFileName.find('$') == -1:
+ InfPath = NormPath(FfsFile.InfFileName)
+ if not os.path.exists(InfPath):
+ EdkLogger.error('build', GENFDS_ERROR, "Non-existant Module %s !" % (FfsFile.InfFileName))
+
+ PathClassObj = PathClass(FfsFile.InfFileName, self.WorkspaceDir)
+ #
+ # Here we just need to get FILE_GUID from INF file, use 'COMMON' as ARCH attribute. and use
+ # BuildObject from one of AutoGenObjectList is enough.
+ #
+ InfObj = self.AutoGenObjectList[0].BuildDatabase.WorkspaceDb.BuildObject[PathClassObj, 'COMMON', self.BuildTarget, self.ToolChain]
+ if not InfObj.Guid.upper() in _GuidDict.keys():
+ _GuidDict[InfObj.Guid.upper()] = FfsFile
+ else:
+ EdkLogger.error("build",
+ FORMAT_INVALID,
+ "Duplicate GUID found for these lines: Line %d: %s and Line %d: %s. GUID: %s"%(FfsFile.CurrentLineNum,
+ FfsFile.CurrentLineContent,
+ _GuidDict[InfObj.Guid.upper()].CurrentLineNum,
+ _GuidDict[InfObj.Guid.upper()].CurrentLineContent,
+ InfObj.Guid.upper()),
+ ExtraData=self.FdfFile)
+ InfFoundFlag = False
+
+ if FfsFile.NameGuid != None:
+ _CheckPCDAsGuidPattern = re.compile("^PCD\(.+\..+\)$")
+
+ #
+ # If the NameGuid reference a PCD name.
+ # The style must match: PCD(xxxx.yyy)
+ #
+ if _CheckPCDAsGuidPattern.match(FfsFile.NameGuid):
+ #
+ # Replace the PCD value.
+ #
+ _PcdName = FfsFile.NameGuid.lstrip("PCD(").rstrip(")")
+ for Pa in self.AutoGenObjectList:
+ for PcdItem in Pa.AllPcdList:
+ if (PcdItem.TokenSpaceGuidCName + "." + PcdItem.TokenCName) == _PcdName:
+ #
+ # First convert from CFormatGuid to GUID string
+ #
+ _PcdGuidString = GuidStructureStringToGuidString(PcdItem.DefaultValue)
+
+ if not _PcdGuidString:
+ #
+ # Then try Byte array.
+ #
+ _PcdGuidString = GuidStructureByteArrayToGuidString(PcdItem.DefaultValue)
+
+ if not _PcdGuidString:
+ #
+ # Not Byte array or CFormat GUID, raise error.
+ #
+ EdkLogger.error("build",
+ FORMAT_INVALID,
+ "The format of PCD value is incorrect. PCD: %s , Value: %s\n"%(_PcdName, PcdItem.DefaultValue),
+ ExtraData=self.FdfFile)
+
+ if not _PcdGuidString.upper() in _GuidDict.keys():
+ _GuidDict[_PcdGuidString.upper()] = FfsFile
+ else:
+ EdkLogger.error("build",
+ FORMAT_INVALID,
+ "Duplicate GUID found for these lines: Line %d: %s and Line %d: %s. GUID: %s"%(FfsFile.CurrentLineNum,
+ FfsFile.CurrentLineContent,
+ _GuidDict[_PcdGuidString.upper()].CurrentLineNum,
+ _GuidDict[_PcdGuidString.upper()].CurrentLineContent,
+ FfsFile.NameGuid.upper()),
+ ExtraData=self.FdfFile)
+
+ if not FfsFile.NameGuid.upper() in _GuidDict.keys():
+ _GuidDict[FfsFile.NameGuid.upper()] = FfsFile
+ else:
+ #
+ # Two raw file GUID conflict.
+ #
+ EdkLogger.error("build",
+ FORMAT_INVALID,
+ "Duplicate GUID found for these lines: Line %d: %s and Line %d: %s. GUID: %s"%(FfsFile.CurrentLineNum,
+ FfsFile.CurrentLineContent,
+ _GuidDict[FfsFile.NameGuid.upper()].CurrentLineNum,
+ _GuidDict[FfsFile.NameGuid.upper()].CurrentLineContent,
+ FfsFile.NameGuid.upper()),
+ ExtraData=self.FdfFile)
+
+
def _CheckPcdDefineAndType(self):
PcdTypeList = [
"FixedAtBuild", "PatchableInModule", "FeatureFlag",
@@ -2584,7 +2707,7 @@
DpxFile = gAutoGenDepexFileName % {"module_name" : self.Name}
if len(Dpx.PostfixNotation) <> 0:
- self.DepexGenerated = True
+ self.DepexGenerated = True
if Dpx.Generate(path.join(self.OutputDir, DpxFile)):
AutoGenList.append(str(DpxFile))
Modified: trunk/BaseTools/Source/Python/GenFds/FdfParser.py
===================================================================
--- trunk/BaseTools/Source/Python/GenFds/FdfParser.py 2011-09-30 07:16:25 UTC (rev 2345)
+++ trunk/BaseTools/Source/Python/GenFds/FdfParser.py 2011-10-01 03:42:59 UTC (rev 2346)
@@ -2173,7 +2173,10 @@
ffsInf.KeepReloc = True
else:
raise Warning("Unknown reloc strip flag '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)
-
+
+ ffsInf.CurrentLineNum = self.CurrentLineNumber
+ ffsInf.CurrentLineContent = self.__CurrentLine()
+
if ForCapsule:
capsuleFfs = CapsuleData.CapsuleFfs()
capsuleFfs.Ffs = ffsInf
@@ -2283,7 +2286,10 @@
self.__Token = 'PCD('+PcdPair[1]+'.'+PcdPair[0]+')'
FfsFileObj.NameGuid = self.__Token
-
+
+ FfsFileObj.CurrentLineNum = self.CurrentLineNumber
+ FfsFileObj.CurrentLineContent = self.__CurrentLine()
+
self.__GetFilePart( FfsFileObj, MacroDict.copy())
if ForCapsule:
Modified: trunk/BaseTools/Source/Python/GenFds/FfsFileStatement.py
===================================================================
--- trunk/BaseTools/Source/Python/GenFds/FfsFileStatement.py 2011-09-30 07:16:25 UTC (rev 2345)
+++ trunk/BaseTools/Source/Python/GenFds/FfsFileStatement.py 2011-10-01 03:42:59 UTC (rev 2346)
@@ -39,6 +39,10 @@
#
def __init__(self):
FileStatementClassObject.__init__(self)
+ self.CurrentLineNum = None
+ self.CurrentLineContent = None
+ self.FileName = None
+ self.InfFileName = None
## GenFfs() method
#
Modified: trunk/BaseTools/Source/Python/GenFds/FfsInfStatement.py
===================================================================
--- trunk/BaseTools/Source/Python/GenFds/FfsInfStatement.py 2011-09-30 07:16:25 UTC (rev 2345)
+++ trunk/BaseTools/Source/Python/GenFds/FfsInfStatement.py 2011-10-01 03:42:59 UTC (rev 2346)
@@ -56,6 +56,10 @@
self.PiSpecVersion = '0x00000000'
self.InfModule = None
self.FinalTargetSuffixMap = {}
+ self.CurrentLineNum = None
+ self.CurrentLineContent = None
+ self.FileName = None
+ self.InfFileName = None
## GetFinalTargetSuffixMap() method
#
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2011-10-09 07:44:52
|
Revision: 2357
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2357&view=rev
Author: jsu1
Date: 2011-10-09 07:44:46 +0000 (Sun, 09 Oct 2011)
Log Message:
-----------
Update the ?\226?\128?\147d MACRO semantics and empty string expression handle
Signed-off-by: jsu1
Reviewed-by: gikidy
Reviewed-by: yingke
Modified Paths:
--------------
trunk/BaseTools/Source/Python/Common/Expression.py
trunk/BaseTools/Source/Python/GenFds/GenFds.py
trunk/BaseTools/Source/Python/build/build.py
Modified: trunk/BaseTools/Source/Python/Common/Expression.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/Expression.py 2011-10-09 05:32:27 UTC (rev 2356)
+++ trunk/BaseTools/Source/Python/Common/Expression.py 2011-10-09 07:44:46 UTC (rev 2357)
@@ -90,7 +90,10 @@
# $(ARCH) is replaced with "IA32 X64"
RetStr += '"' + Macros[Macro] + '"'
else:
- RetStr += Macros[Macro]
+ if Macros[Macro].strip() != "":
+ RetStr += Macros[Macro]
+ else:
+ RetStr += '""'
RetStr += String[MacroEndPos+1:]
String = RetStr
MacroStartPos = String.find('$(')
@@ -173,13 +176,20 @@
return Val
def __init__(self, Expression, SymbolTable={}):
+ self._NoProcess = False
if type(Expression) != type(''):
self._Expr = Expression
+ self._NoProcess = True
return
self._Expr = ReplaceExprMacro(Expression.strip(),
SymbolTable,
['TARGET', 'TOOL_CHAIN_TAG', 'ARCH'])
+
+ if not self._Expr.strip():
+ self._NoProcess = True
+ return
+
#
# The symbol table including PCD and macro mapping
#
@@ -194,7 +204,7 @@
# Public entry for this class
def __call__(self):
- if type(self._Expr) != type(''):
+ if self._NoProcess:
return self._Expr
Val = self._OrExpr()
Modified: trunk/BaseTools/Source/Python/GenFds/GenFds.py
===================================================================
--- trunk/BaseTools/Source/Python/GenFds/GenFds.py 2011-10-09 05:32:27 UTC (rev 2356)
+++ trunk/BaseTools/Source/Python/GenFds/GenFds.py 2011-10-09 07:44:46 UTC (rev 2357)
@@ -172,7 +172,7 @@
else:
GlobalData.gCommandLineDefines[List[0].strip()] = List[1].strip()
else:
- GlobalData.gCommandLineDefines[List[0].strip()] = ""
+ GlobalData.gCommandLineDefines[List[0].strip()] = "TRUE"
os.environ["WORKSPACE"] = Workspace
"""call Workspace build create database"""
Modified: trunk/BaseTools/Source/Python/build/build.py
===================================================================
--- trunk/BaseTools/Source/Python/build/build.py 2011-10-09 05:32:27 UTC (rev 2356)
+++ trunk/BaseTools/Source/Python/build/build.py 2011-10-09 07:44:46 UTC (rev 2357)
@@ -1625,7 +1625,7 @@
ExtraData=DefineTokenList[0])
if len(DefineTokenList) == 1:
- DefineDict[DefineTokenList[0]] = ""
+ DefineDict[DefineTokenList[0]] = "TRUE"
else:
DefineDict[DefineTokenList[0]] = DefineTokenList[1].strip()
return DefineDict
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2011-10-13 08:47:22
|
Revision: 2369
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2369&view=rev
Author: jsu1
Date: 2011-10-13 08:47:16 +0000 (Thu, 13 Oct 2011)
Log Message:
-----------
Update expression evaluation according following rule:
1. +/- with Boolean involved will be evaluated but report warning message, and the result will be same as regarding TRUE as 1 and FALSE as 0.
2. Comparison between string and number/Boolean:
== will always return FALSE, and warning message given
!= will always return TRUE, and warning message given
Others are not supported and error message given
3. Comparison between number and Boolean will be evaluated success, and the result will be same as regarding TRUE as 1 and FALSE as 0.
Reviewed-by: yingke
Signed-off-by: jsu1
Modified Paths:
--------------
trunk/BaseTools/Source/Python/Common/Expression.py
trunk/BaseTools/Source/Python/CommonDataClass/Exceptions.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 2011-10-13 05:20:11 UTC (rev 2368)
+++ trunk/BaseTools/Source/Python/Common/Expression.py 2011-10-13 08:47:16 UTC (rev 2369)
@@ -15,6 +15,7 @@
from Common.GlobalData import *
from CommonDataClass.Exceptions import BadExpression
from CommonDataClass.Exceptions import SymbolNotFound
+from CommonDataClass.Exceptions import WrnExpression
from Misc import GuidStringToGuidStructureString
ERR_STRING_EXPR = 'This operator cannot be used in string expression: [%s].'
@@ -28,7 +29,10 @@
ERR_EXPR_TYPE = 'Different types found in expression.'
ERR_OPERATOR_UNSUPPORT = 'Unsupported operator: [%s]'
ERR_REL_NOT_IN = 'Expect "IN" after "not" operator.'
-ERR_BOOL_EXPR = 'Operand of boolean type cannot be used in arithmetic expression.'
+WRN_BOOL_EXPR = 'Operand of boolean type cannot be used in arithmetic expression.'
+WRN_EQCMP_STR_OTHERS = '== Comparison between Operand of string type and Boolean/Number Type always return False.'
+WRN_NECMP_STR_OTHERS = '!= Comparison between Operand of string type and Boolean/Number Type always return True.'
+ERR_RELCMP_STR_OTHERS = 'Operator taking Operand of string type and Boolean/Number Type is not allowed: [%s].'
ERR_STRING_CMP = 'Unicode string and general string cannot be compared: [%s %s %s]'
ERR_ARRAY_TOKEN = 'Bad C array or C format GUID token: [%s].'
ERR_ARRAY_ELE = 'This must be HEX value for NList or Array: [%s].'
@@ -128,13 +132,12 @@
@staticmethod
def Eval(Operator, Oprand1, Oprand2 = None):
+ WrnExp = None
+
if Operator not in ["==", "!=", ">=", "<=", ">", "<", "in", "not in"] and \
(type(Oprand1) == type('') or type(Oprand2) == type('')):
raise BadExpression(ERR_STRING_EXPR % Operator)
- if type(Oprand1) == type(True) and Operator in ['+', '-', '&', '|', '^']:
- raise BadExpression(ERR_BOOL_EXPR)
-
TypeDict = {
type(0) : 0,
type(0L) : 0,
@@ -148,9 +151,31 @@
raise BadExpression(ERR_STRING_EXPR % Operator)
EvalStr = 'not Oprand1'
else:
- if TypeDict[type(Oprand1)] != TypeDict[type(Oprand2)]:
- raise BadExpression(ERR_EXPR_TYPE)
- if type(Oprand1) == type(''):
+ if Operator in ["+", "-"] and (type(True) in [type(Oprand1), type(Oprand2)]):
+ # Boolean in '+'/'-' will be evaluated but raise warning
+ WrnExp = WrnExpression(WRN_BOOL_EXPR)
+ elif type('') in [type(Oprand1), type(Oprand2)] and type(Oprand1)!= type(Oprand2):
+ # == between string and number/boolean will always return False, != return True
+ if Operator == "==":
+ WrnExp = WrnExpression(WRN_EQCMP_STR_OTHERS)
+ WrnExp.result = False
+ raise WrnExp
+ elif Operator == "!=":
+ WrnExp = WrnExpression(WRN_EQCMP_STR_OTHERS)
+ WrnExp.result = True
+ raise WrnExp
+ else:
+ raise BadExpression(ERR_RELCMP_STR_OTHERS % Operator)
+ elif TypeDict[type(Oprand1)] != TypeDict[type(Oprand2)]:
+ if Operator in ["==", "!=", ">=", "<=", ">", "<"] and set((TypeDict[type(Oprand1)], TypeDict[type(Oprand2)])) == set((TypeDict[type(True)], TypeDict[type(0)])):
+ # comparison between number and boolean is allowed
+ pass
+ if Operator in ['&', '|', '^', "&&", "||"] and set((TypeDict[type(Oprand1)], TypeDict[type(Oprand2)])) == set((TypeDict[type(True)], TypeDict[type(0)])):
+ # bitwise and logical operation between number and boolean is allowed
+ pass
+ else:
+ raise BadExpression(ERR_EXPR_TYPE)
+ if type(Oprand1) == type('') and type(Oprand2) == type(''):
if (Oprand1.startswith('L"') and not Oprand2.startswith('L"')) or \
(not Oprand1.startswith('L"') and Oprand2.startswith('L"')):
raise BadExpression(ERR_STRING_CMP % (Oprand1, Operator, Oprand2))
@@ -173,6 +198,10 @@
Val = True
else:
Val = False
+
+ if WrnExp:
+ WrnExp.result = Val
+ raise WrnExp
return Val
def __init__(self, Expression, SymbolTable={}):
Modified: trunk/BaseTools/Source/Python/CommonDataClass/Exceptions.py
===================================================================
--- trunk/BaseTools/Source/Python/CommonDataClass/Exceptions.py 2011-10-13 05:20:11 UTC (rev 2368)
+++ trunk/BaseTools/Source/Python/CommonDataClass/Exceptions.py 2011-10-13 08:47:16 UTC (rev 2369)
@@ -10,12 +10,6 @@
# 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 Common.EdkLogger as EdkLogger
-
-
## Exceptions used in Expression
class EvaluationException(Exception):
pass
@@ -23,6 +17,9 @@
class BadExpression(EvaluationException):
pass
+class WrnExpression(Exception):
+ pass
+
## Exceptions used in macro replacements
class MacroException(Exception):
pass
Modified: trunk/BaseTools/Source/Python/GenFds/FdfParser.py
===================================================================
--- trunk/BaseTools/Source/Python/GenFds/FdfParser.py 2011-10-13 05:20:11 UTC (rev 2368)
+++ trunk/BaseTools/Source/Python/GenFds/FdfParser.py 2011-10-13 08:47:16 UTC (rev 2369)
@@ -712,6 +712,15 @@
return ValueExpression(Expression, InputMacroDict)()
except SymbolNotFound:
return False
+ except WrnExpression, Excpt:
+ #
+ # Catch expression evaluation warning here. We need to report
+ # the precise number of line and return the evaluation result
+ #
+ EdkLogger.warn('Parser', "Suspicious expression: %s" % str(Excpt),
+ File=self.FileName, ExtraData=self.__CurrentLine(),
+ Line=Line)
+ return Excpt.result
except Exception, Excpt:
raise Warning("Invalid expression", *FileLineTuple)
else:
Modified: trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py
===================================================================
--- trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py 2011-10-13 05:20:11 UTC (rev 2368)
+++ trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py 2011-10-13 08:47:16 UTC (rev 2369)
@@ -1182,6 +1182,15 @@
except SymbolNotFound, Exc:
EdkLogger.debug(EdkLogger.DEBUG_5, str(Exc), self._ValueList[1])
Result = False
+ except WrnExpression, Excpt:
+ #
+ # Catch expression evaluation warning here. We need to report
+ # the precise number of line and return the evaluation result
+ #
+ EdkLogger.warn('Parser', "Suspicious expression: %s" % str(Excpt),
+ File=self._FileWithError, ExtraData=' '.join(self._ValueList),
+ Line=self._LineIndex+1)
+ Result = Excpt.result
if self._ItemType in [MODEL_META_DATA_CONDITIONAL_STATEMENT_IF,
MODEL_META_DATA_CONDITIONAL_STATEMENT_IFDEF,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2011-10-24 06:11:26
|
Revision: 2375
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2375&view=rev
Author: jsu1
Date: 2011-10-24 06:11:20 +0000 (Mon, 24 Oct 2011)
Log Message:
-----------
Add DSC PCD value macro support and update expression warning
Reviewed-by: gikidy
Reviewed-by: yingke
Signed-off-by: jsu1
Modified Paths:
--------------
trunk/BaseTools/Source/Python/Common/Expression.py
trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py
Modified: trunk/BaseTools/Source/Python/Common/Expression.py
===================================================================
--- trunk/BaseTools/Source/Python/Common/Expression.py 2011-10-19 09:39:37 UTC (rev 2374)
+++ trunk/BaseTools/Source/Python/Common/Expression.py 2011-10-24 06:11:20 UTC (rev 2375)
@@ -161,7 +161,7 @@
WrnExp.result = False
raise WrnExp
elif Operator == "!=":
- WrnExp = WrnExpression(WRN_EQCMP_STR_OTHERS)
+ WrnExp = WrnExpression(WRN_NECMP_STR_OTHERS)
WrnExp.result = True
raise WrnExp
else:
@@ -170,7 +170,7 @@
if Operator in ["==", "!=", ">=", "<=", ">", "<"] and set((TypeDict[type(Oprand1)], TypeDict[type(Oprand2)])) == set((TypeDict[type(True)], TypeDict[type(0)])):
# comparison between number and boolean is allowed
pass
- if Operator in ['&', '|', '^', "&&", "||"] and set((TypeDict[type(Oprand1)], TypeDict[type(Oprand2)])) == set((TypeDict[type(True)], TypeDict[type(0)])):
+ elif Operator in ['&', '|', '^', "&&", "||"] and set((TypeDict[type(Oprand1)], TypeDict[type(Oprand2)])) == set((TypeDict[type(True)], TypeDict[type(0)])):
# bitwise and logical operation between number and boolean is allowed
pass
else:
Modified: trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py
===================================================================
--- trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py 2011-10-19 09:39:37 UTC (rev 2374)
+++ trunk/BaseTools/Source/Python/Workspace/MetaFileParser.py 2011-10-24 06:11:20 UTC (rev 2375)
@@ -1169,6 +1169,13 @@
self._SectionLocalMacros[Name] = Value
elif self._ItemType == MODEL_META_DATA_GLOBAL_DEFINE:
GlobalData.gEdkGlobal[Name] = Value
+
+ #
+ # Keyword in [Defines] section can be used as Macros
+ #
+ if (self._ItemType == MODEL_META_DATA_HEADER) and (self._SectionType == MODEL_META_DATA_HEADER):
+ self._FileLocalMacros[Name] = Value
+
self._ValueList = [Type, Name, Value]
def __ProcessDirective(self):
@@ -1271,9 +1278,11 @@
ValueList = GetSplitValueList(self._ValueList[2])
if len(ValueList) > 1 and ValueList[1] == 'VOID*':
PcdValue = ValueList[0]
+ ValueList[0] = str(ValueExpression(PcdValue, self._Macros)())
else:
PcdValue = ValueList[-1]
- PcdValue = str(ValueExpression(PcdValue, self._Macros)())
+ ValueList[-1] = str(ValueExpression(PcdValue, self._Macros)())
+
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.
|