summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python
diff options
context:
space:
mode:
authorGao, Liming <liming.gao@intel.com>2014-07-01 07:10:10 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2014-07-01 07:10:10 +0000
commite4ac870fe95adc7d178a79b73ad2792e0c8bfeb8 (patch)
tree7dc08edb8004fdb21d2450a88c1e7957246e8029 /BaseTools/Source/Python
parent148af3872273ef476230db1d0df5ea00167853a1 (diff)
downloadedk2-e4ac870fe95adc7d178a79b73ad2792e0c8bfeb8.tar.gz
edk2-e4ac870fe95adc7d178a79b73ad2792e0c8bfeb8.tar.bz2
edk2-e4ac870fe95adc7d178a79b73ad2792e0c8bfeb8.zip
Sync BaseTool trunk (version r2670) into EDKII BaseTools.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Gao, Liming <liming.gao@intel.com> Reviewed-by: Liu, Yingke D (yingke.d.liu@intel.com) git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15605 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/Python')
-rw-r--r--BaseTools/Source/Python/Common/BuildVersion.py2
-rw-r--r--BaseTools/Source/Python/Common/Parsing.py37
-rw-r--r--BaseTools/Source/Python/Ecc/Configuration.py5
-rw-r--r--BaseTools/Source/Python/Ecc/Ecc.py142
-rw-r--r--BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py4
-rw-r--r--BaseTools/Source/Python/Ecc/config.ini4
-rw-r--r--BaseTools/Source/Python/GenFds/GenFds.py13
-rw-r--r--BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py4
-rw-r--r--BaseTools/Source/Python/UPT/BuildVersion.py2
-rw-r--r--BaseTools/Source/Python/UPT/Library/String.py28
-rw-r--r--BaseTools/Source/Python/UPT/Xml/ModuleSurfaceAreaXml.py15
-rw-r--r--BaseTools/Source/Python/Workspace/WorkspaceDatabase.py11
12 files changed, 200 insertions, 67 deletions
diff --git a/BaseTools/Source/Python/Common/BuildVersion.py b/BaseTools/Source/Python/Common/BuildVersion.py
index bfd4d43bb9..e178a4a618 100644
--- a/BaseTools/Source/Python/Common/BuildVersion.py
+++ b/BaseTools/Source/Python/Common/BuildVersion.py
@@ -13,4 +13,4 @@
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
-gBUILD_VERSION = "Build 2649"
+gBUILD_VERSION = "Build 2670"
diff --git a/BaseTools/Source/Python/Common/Parsing.py b/BaseTools/Source/Python/Common/Parsing.py
index 5bea6941fd..584fc7f3c3 100644
--- a/BaseTools/Source/Python/Common/Parsing.py
+++ b/BaseTools/Source/Python/Common/Parsing.py
@@ -1,7 +1,7 @@
## @file
# This file is used to define common parsing related functions used in parsing INF/DEC/DSC process
#
-# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2008 - 2014, 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
@@ -877,3 +877,38 @@ def GenMetaDatSectionItem(Key, Value, List):
List[Key] = [Value]
else:
List[Key].append(Value)
+
+## IsValidWord
+#
+# Check whether the word is valid.
+# <Word> ::= (a-zA-Z0-9_)(a-zA-Z0-9_-){0,} Alphanumeric characters with
+# optional
+# dash "-" and/or underscore "_" characters. No whitespace
+# characters are permitted.
+#
+# @param Word: The word string need to be checked.
+#
+def IsValidWord(Word):
+ if not Word:
+ return False
+ #
+ # The first char should be alpha, _ or Digit.
+ #
+ if not Word[0].isalnum() and \
+ not Word[0] == '_' and \
+ not Word[0].isdigit():
+ return False
+
+ LastChar = ''
+ for Char in Word[1:]:
+ if (not Char.isalpha()) and \
+ (not Char.isdigit()) and \
+ Char != '-' and \
+ Char != '_' and \
+ Char != '.':
+ return False
+ if Char == '.' and LastChar == '.':
+ return False
+ LastChar = Char
+
+ return True
diff --git a/BaseTools/Source/Python/Ecc/Configuration.py b/BaseTools/Source/Python/Ecc/Configuration.py
index 0ba8d732d7..4f93d79661 100644
--- a/BaseTools/Source/Python/Ecc/Configuration.py
+++ b/BaseTools/Source/Python/Ecc/Configuration.py
@@ -1,7 +1,7 @@
## @file
# This file is used to define class Configuration
#
-# Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2008 - 2014, 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
@@ -247,6 +247,9 @@ class Configuration(object):
# A list for binary file ext name
self.BinaryExtList = []
+
+ # A list for only scanned folders
+ self.ScanOnlyDirList = []
self.ParseConfig()
diff --git a/BaseTools/Source/Python/Ecc/Ecc.py b/BaseTools/Source/Python/Ecc/Ecc.py
index b1a0ab8272..b5d733e48e 100644
--- a/BaseTools/Source/Python/Ecc/Ecc.py
+++ b/BaseTools/Source/Python/Ecc/Ecc.py
@@ -1,7 +1,7 @@
## @file
# This file is used to be the main entrance of ECC tool
#
-# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2009 - 2014, 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
@@ -59,6 +59,7 @@ class Ecc(object):
self.ScanSourceCode = True
self.ScanMetaData = True
self.MetaFile = ''
+ self.OnlyScan = None
# Parse the options and args
self.ParseOption()
@@ -113,8 +114,9 @@ class Ecc(object):
GlobalData.gAllFiles = DirCache(GlobalData.gWorkspace)
# Build ECC database
- self.BuildDatabase()
-
+# self.BuildDatabase()
+ self.DetectOnlyScanDirs()
+
# Start to check
self.Check()
@@ -133,11 +135,30 @@ class Ecc(object):
return
self.ConfigFile = 'config.ini'
+
+ ## DetectOnlyScan
+ #
+ # Detect whether only scanned folders have been enabled
+ #
+ def DetectOnlyScanDirs(self):
+ if self.OnlyScan == True:
+ OnlyScanDirs = []
+ # Use regex here if multiple spaces or TAB exists in ScanOnlyDirList in config.ini file
+ for folder in re.finditer(r'\S+', EccGlobalData.gConfig.ScanOnlyDirList):
+ OnlyScanDirs.append(folder.group())
+ if len(OnlyScanDirs) != 0:
+ self.BuildDatabase(OnlyScanDirs)
+ else:
+ EdkLogger.error("ECC", BuildToolError.OPTION_VALUE_INVALID, ExtraData="Use -f option need to fill specific folders in config.ini file")
+ else:
+ self.BuildDatabase()
+
+
## BuildDatabase
#
# Build the database for target
#
- def BuildDatabase(self):
+ def BuildDatabase(self, SpeciDirs = None):
# Clean report table
EccGlobalData.gDb.TblReport.Drop()
EccGlobalData.gDb.TblReport.Create()
@@ -146,10 +167,14 @@ class Ecc(object):
if self.IsInit:
if self.ScanMetaData:
EdkLogger.quiet("Building database for Meta Data File ...")
- self.BuildMetaDataFileDatabase()
+ self.BuildMetaDataFileDatabase(SpeciDirs)
if self.ScanSourceCode:
EdkLogger.quiet("Building database for Meta Data File Done!")
- c.CollectSourceCodeDataIntoDB(EccGlobalData.gTarget)
+ if SpeciDirs == None:
+ c.CollectSourceCodeDataIntoDB(EccGlobalData.gTarget)
+ else:
+ for specificDir in SpeciDirs:
+ c.CollectSourceCodeDataIntoDB(os.path.join(EccGlobalData.gTarget, specificDir))
EccGlobalData.gIdentifierTableList = GetTableList((MODEL_FILE_C, MODEL_FILE_H), 'Identifier', EccGlobalData.gDb)
EccGlobalData.gCFileList = GetFileList(MODEL_FILE_C, EccGlobalData.gDb)
@@ -159,59 +184,67 @@ class Ecc(object):
#
# Build the database for meta data files
#
- def BuildMetaDataFileDatabase(self):
+ def BuildMetaDataFileDatabase(self, SpecificDirs = None):
+ ScanFolders = []
+ if SpecificDirs == None:
+ ScanFolders.append(EccGlobalData.gTarget)
+ else:
+ for specificDir in SpecificDirs:
+ ScanFolders.append(os.path.join(EccGlobalData.gTarget, specificDir))
EdkLogger.quiet("Building database for meta data files ...")
Op = open(EccGlobalData.gConfig.MetaDataFileCheckPathOfGenerateFileList, 'w+')
#SkipDirs = Read from config file
SkipDirs = EccGlobalData.gConfig.SkipDirList
SkipDirString = string.join(SkipDirs, '|')
- p = re.compile(r'.*[\\/](?:%s)[\\/]?.*' % SkipDirString)
- for Root, Dirs, Files in os.walk(EccGlobalData.gTarget):
- if p.match(Root.upper()):
- continue
- for Dir in Dirs:
- Dirname = os.path.join(Root, Dir)
- if os.path.islink(Dirname):
- Dirname = os.path.realpath(Dirname)
- if os.path.isdir(Dirname):
- # symlinks to directories are treated as directories
- Dirs.remove(Dir)
- Dirs.append(Dirname)
-
- for File in Files:
- if len(File) > 4 and File[-4:].upper() == ".DEC":
- Filename = os.path.normpath(os.path.join(Root, File))
- EdkLogger.quiet("Parsing %s" % Filename)
- Op.write("%s\r" % Filename)
- #Dec(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
- self.MetaFile = DecParser(Filename, MODEL_FILE_DEC, EccGlobalData.gDb.TblDec)
- self.MetaFile.Start()
- continue
- if len(File) > 4 and File[-4:].upper() == ".DSC":
- Filename = os.path.normpath(os.path.join(Root, File))
- EdkLogger.quiet("Parsing %s" % Filename)
- Op.write("%s\r" % Filename)
- #Dsc(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
- self.MetaFile = DscParser(PathClass(Filename, Root), MODEL_FILE_DSC, MetaFileStorage(EccGlobalData.gDb.TblDsc.Cur, Filename, MODEL_FILE_DSC, True))
- # alwasy do post-process, in case of macros change
- self.MetaFile.DoPostProcess()
- self.MetaFile.Start()
- self.MetaFile._PostProcess()
- continue
- if len(File) > 4 and File[-4:].upper() == ".INF":
- Filename = os.path.normpath(os.path.join(Root, File))
- EdkLogger.quiet("Parsing %s" % Filename)
- Op.write("%s\r" % Filename)
- #Inf(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
- self.MetaFile = InfParser(Filename, MODEL_FILE_INF, EccGlobalData.gDb.TblInf)
- self.MetaFile.Start()
- continue
- if len(File) > 4 and File[-4:].upper() == ".FDF":
- Filename = os.path.normpath(os.path.join(Root, File))
- EdkLogger.quiet("Parsing %s" % Filename)
- Op.write("%s\r" % Filename)
- Fdf(Filename, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
+# p = re.compile(r'.*[\\/](?:%s)[\\/]?.*' % SkipDirString)
+ p = re.compile(r'.*[\\/](?:%s^\S)[\\/]?.*' % SkipDirString)
+ for scanFolder in ScanFolders:
+ for Root, Dirs, Files in os.walk(scanFolder):
+ if p.match(Root.upper()):
continue
+ for Dir in Dirs:
+ Dirname = os.path.join(Root, Dir)
+ if os.path.islink(Dirname):
+ Dirname = os.path.realpath(Dirname)
+ if os.path.isdir(Dirname):
+ # symlinks to directories are treated as directories
+ Dirs.remove(Dir)
+ Dirs.append(Dirname)
+
+ for File in Files:
+ if len(File) > 4 and File[-4:].upper() == ".DEC":
+ Filename = os.path.normpath(os.path.join(Root, File))
+ EdkLogger.quiet("Parsing %s" % Filename)
+ Op.write("%s\r" % Filename)
+ #Dec(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
+ self.MetaFile = DecParser(Filename, MODEL_FILE_DEC, EccGlobalData.gDb.TblDec)
+ self.MetaFile.Start()
+ continue
+ if len(File) > 4 and File[-4:].upper() == ".DSC":
+ Filename = os.path.normpath(os.path.join(Root, File))
+ EdkLogger.quiet("Parsing %s" % Filename)
+ Op.write("%s\r" % Filename)
+ #Dsc(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
+ self.MetaFile = DscParser(PathClass(Filename, Root), MODEL_FILE_DSC, MetaFileStorage(EccGlobalData.gDb.TblDsc.Cur, Filename, MODEL_FILE_DSC, True))
+ # alwasy do post-process, in case of macros change
+ self.MetaFile.DoPostProcess()
+ self.MetaFile.Start()
+ self.MetaFile._PostProcess()
+ continue
+ if len(File) > 4 and File[-4:].upper() == ".INF":
+ Filename = os.path.normpath(os.path.join(Root, File))
+ EdkLogger.quiet("Parsing %s" % Filename)
+ Op.write("%s\r" % Filename)
+ #Inf(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
+ self.MetaFile = InfParser(Filename, MODEL_FILE_INF, EccGlobalData.gDb.TblInf)
+ self.MetaFile.Start()
+ continue
+ if len(File) > 4 and File[-4:].upper() == ".FDF":
+ Filename = os.path.normpath(os.path.join(Root, File))
+ EdkLogger.quiet("Parsing %s" % Filename)
+ Op.write("%s\r" % Filename)
+ Fdf(Filename, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
+ continue
Op.close()
# Commit to database
@@ -321,6 +354,8 @@ class Ecc(object):
self.ScanSourceCode = False
if Options.sourcecode != None:
self.ScanMetaData = False
+ if Options.folders != None:
+ self.OnlyScan = True
## SetLogLevel
#
@@ -371,6 +406,7 @@ class Ecc(object):
"and warning messages, etc.")
Parser.add_option("-d", "--debug", action="store", type="int", help="Enable debug messages at specified level.")
Parser.add_option("-w", "--workspace", action="store", type="string", dest='Workspace', help="Specify workspace.")
+ Parser.add_option("-f", "--folders", action="store_true", type=None, help="Only scanning specified folders which are recorded in config.ini file.")
(Opt, Args)=Parser.parse_args()
diff --git a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
index 6da2b6babe..405c5b5b03 100644
--- a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
@@ -1,7 +1,7 @@
## @file
# This file is used to parse meta files
#
-# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2008 - 2014, 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
@@ -1054,7 +1054,7 @@ class DscParser(MetaFileParser):
## Override parent's method since we'll do all macro replacements in parser
def _GetMacros(self):
- Macros = {}
+ Macros = dict( [('ARCH','IA32'), ('FAMILY','MSFT'),('TOOL_CHAIN_TAG','VS2008x86'),('TARGET','DEBUG')])
Macros.update(self._FileLocalMacros)
Macros.update(self._GetApplicableSectionMacro())
Macros.update(GlobalData.gEdkGlobal)
diff --git a/BaseTools/Source/Python/Ecc/config.ini b/BaseTools/Source/Python/Ecc/config.ini
index c55276fce7..436fe4b09b 100644
--- a/BaseTools/Source/Python/Ecc/config.ini
+++ b/BaseTools/Source/Python/Ecc/config.ini
@@ -2,7 +2,7 @@
# This file is used to set configuration of ECC tool
# For the items listed below, 1 means valid, 0 means invalid
#
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2014, 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
@@ -255,3 +255,5 @@ MetaDataFileCheckModuleFileGuidDuplication = 1
# A list for binary file ext name
BinaryExtList = EXE, EFI, FV, ROM, DLL, COM, BMP, GIF, PYD, CMP, BIN, JPG, UNI, RAW, COM2, LIB, DEPEX, SYS, DB
+# A list for only scanning dirs, the dirs should be the top folder(s) under workspace
+ScanOnlyDirList = ScanFolder1 ScanFolder2
diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Python/GenFds/GenFds.py
index 058fa0c6a0..c0762edf22 100644
--- a/BaseTools/Source/Python/GenFds/GenFds.py
+++ b/BaseTools/Source/Python/GenFds/GenFds.py
@@ -36,6 +36,7 @@ from Common import EdkLogger
from Common.String import *
from Common.Misc import DirCache,PathClass
from Common.Misc import SaveFileOnChange
+from Common.Misc import GuidStructureStringToGuidString
from Common.BuildVersion import gBUILD_VERSION
## Version and Copyright
@@ -511,11 +512,23 @@ class GenFds :
def GenerateGuidXRefFile(BuildDb, ArchList):
GuidXRefFileName = os.path.join(GenFdsGlobalVariable.FvDir, "Guid.xref")
GuidXRefFile = StringIO.StringIO('')
+ GuidDict = {}
for Arch in ArchList:
PlatformDataBase = BuildDb.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
for ModuleFile in PlatformDataBase.Modules:
Module = BuildDb.BuildObject[ModuleFile, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
GuidXRefFile.write("%s %s\n" % (Module.Guid, Module.BaseName))
+ for key, item in Module.Protocols.items():
+ GuidDict[key] = item
+ for key, item in Module.Guids.items():
+ GuidDict[key] = item
+ for key, item in Module.Ppis.items():
+ GuidDict[key] = item
+ # Append GUIDs, Protocols, and PPIs to the Xref file
+ GuidXRefFile.write("\n")
+ for key, item in GuidDict.items():
+ GuidXRefFile.write("%s %s\n" % (GuidStructureStringToGuidString(item).upper(), key))
+
if GuidXRefFile.getvalue():
SaveFileOnChange(GuidXRefFileName, GuidXRefFile.getvalue(), False)
GenFdsGlobalVariable.InfLogger("\nGUID cross reference file can be found at %s" % GuidXRefFileName)
diff --git a/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py b/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py
index b6227d24fb..9cfdad3171 100644
--- a/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py
+++ b/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py
@@ -53,7 +53,9 @@ def parsePcdInfoFromMapFile(mapfilepath, efifilepath):
return None
if len(lines) == 0: return None
- if lines[0].strip().find("Archive member included because of file (symbol)") != -1:
+ firstline = lines[0].strip()
+ if (firstline.startswith("Archive member included ") and
+ firstline.endswith(" file (symbol)")):
return _parseForGCC(lines, efifilepath)
return _parseGeneral(lines, efifilepath)
diff --git a/BaseTools/Source/Python/UPT/BuildVersion.py b/BaseTools/Source/Python/UPT/BuildVersion.py
index 8b86b37e30..2cf0923cf2 100644
--- a/BaseTools/Source/Python/UPT/BuildVersion.py
+++ b/BaseTools/Source/Python/UPT/BuildVersion.py
@@ -17,4 +17,4 @@
Build version information
'''
-gBUILD_VERSION = "Build 2649"
+gBUILD_VERSION = "Build 2670"
diff --git a/BaseTools/Source/Python/UPT/Library/String.py b/BaseTools/Source/Python/UPT/Library/String.py
index 0953e47cb1..f709ff1bce 100644
--- a/BaseTools/Source/Python/UPT/Library/String.py
+++ b/BaseTools/Source/Python/UPT/Library/String.py
@@ -2,7 +2,7 @@
# This file is used to define common string related functions used in parsing
# process
#
-# Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2011 - 2014, 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
@@ -937,3 +937,29 @@ def SplitPcdEntry(String):
return ['', '', ''], False
return ['', '', ''], False
+
+## Check if two arches matched?
+#
+# @param Arch1
+# @param Arch2
+#
+def IsMatchArch(Arch1, Arch2):
+ if 'COMMON' in Arch1 or 'COMMON' in Arch2:
+ return True
+ if isinstance(Arch1, basestring) and isinstance(Arch2, basestring):
+ if Arch1 == Arch2:
+ return True
+
+ if isinstance(Arch1, basestring) and isinstance(Arch2, list):
+ return Arch1 in Arch2
+
+ if isinstance(Arch2, basestring) and isinstance(Arch1, list):
+ return Arch2 in Arch1
+
+ if isinstance(Arch1, list) and isinstance(Arch2, list):
+ for Item1 in Arch1:
+ for Item2 in Arch2:
+ if Item1 == Item2:
+ return True
+
+ return False
diff --git a/BaseTools/Source/Python/UPT/Xml/ModuleSurfaceAreaXml.py b/BaseTools/Source/Python/UPT/Xml/ModuleSurfaceAreaXml.py
index a913a859f6..9e141cabb4 100644
--- a/BaseTools/Source/Python/UPT/Xml/ModuleSurfaceAreaXml.py
+++ b/BaseTools/Source/Python/UPT/Xml/ModuleSurfaceAreaXml.py
@@ -1,7 +1,7 @@
## @file
# This file is used to parse a Module file of .PKG file
#
-# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2011 - 2014, 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
@@ -20,6 +20,7 @@ from xml.dom import minidom
from Library.String import ConvertNEToNOTEQ
from Library.String import ConvertNOTEQToNE
from Library.String import GetStringOfList
+from Library.String import IsMatchArch
from Library.Xml.XmlRoutines import XmlElement
from Library.Xml.XmlRoutines import XmlAttribute
from Library.Xml.XmlRoutines import XmlNode
@@ -128,9 +129,11 @@ class BinaryFileXml(object):
pass
NodeList = []
FilenameList = BinaryFile.GetFileNameList()
+ SupportArch = None
for Filename in FilenameList:
Tmp = FilenameXml()
NodeList.append(Tmp.ToXml(Filename, 'Filename'))
+ SupportArch = Filename.SupArchList
if GlobalData.gIS_BINARY_INF:
AsBuildList = BinaryFile.GetAsBuiltList()
@@ -142,12 +145,14 @@ class BinaryFileXml(object):
AsBuiltNodeList = []
for Pcd in PatchPcdValueList:
- Tmp = PcdEntryXml()
- AsBuiltNodeList.append(Tmp.ToXml4(Pcd, 'PatchPcdValue'))
+ if IsMatchArch(Pcd.SupArchList, SupportArch):
+ Tmp = PcdEntryXml()
+ AsBuiltNodeList.append(Tmp.ToXml4(Pcd, 'PatchPcdValue'))
for Pcd in PcdExList:
- Tmp = PcdEntryXml()
- AsBuiltNodeList.append(Tmp.ToXml4(Pcd, 'PcdExValue'))
+ if IsMatchArch(Pcd.SupArchList, SupportArch):
+ Tmp = PcdEntryXml()
+ AsBuiltNodeList.append(Tmp.ToXml4(Pcd, 'PcdExValue'))
GuiVerElemList = []
for LibGuidVer in LibGuidVerList:
diff --git a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
index 3444e4f053..6ebb7ee87d 100644
--- a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
+++ b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
@@ -37,6 +37,7 @@ from BuildClassObject import *
from WorkspaceCommon import GetDeclaredPcd
from Common.Misc import AnalyzeDscPcd
import re
+from Common.Parsing import IsValidWord
## Platform build information from DSC file
#
@@ -893,13 +894,23 @@ class DscBuildData(PlatformBuildClassObject):
VariableName, VariableGuid, VariableOffset, DefaultValue = self._ValidatePcd(PcdCName, TokenSpaceGuid, Setting, Type, Dummy4)
ExceedMax = False
+ FormatCorrect = True
if VariableOffset.isdigit():
if int(VariableOffset,10) > 0xFFFF:
ExceedMax = True
elif re.match(r'[\t\s]*0[xX][a-fA-F0-9]+$',VariableOffset):
if int(VariableOffset,16) > 0xFFFF:
ExceedMax = True
+ # For Offset written in "A.B"
+ elif VariableOffset.find('.') > -1:
+ VariableOffsetList = VariableOffset.split(".")
+ if not (len(VariableOffsetList) == 2
+ and IsValidWord(VariableOffsetList[0])
+ and IsValidWord(VariableOffsetList[1])):
+ FormatCorrect = False
else:
+ FormatCorrect = False
+ if not FormatCorrect:
EdkLogger.error('Build', FORMAT_INVALID, "Invalid syntax or format of the variable offset value is incorrect for %s." % ".".join((TokenSpaceGuid,PcdCName)))
if ExceedMax: