|
From: <js...@us...> - 2011-08-11 09:23:37
|
Revision: 2246
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2246&view=rev
Author: jsu1
Date: 2011-08-11 08:08:37 +0000 (Thu, 11 Aug 2011)
Log Message:
-----------
Support distribution file relative path to current working directory during install.
Signed-off-by: jsu1
Reviewed-by: gikidy
Reviewed-by: yingke
Modified Paths:
--------------
trunk/BaseTools/Source/Python/UPT/InstallPkg.py
trunk/BaseTools/Source/Python/UPT/Logger/StringTable.py
trunk/BaseTools/Source/Python/UPT/UPT.py
Modified: trunk/BaseTools/Source/Python/UPT/InstallPkg.py
===================================================================
--- trunk/BaseTools/Source/Python/UPT/InstallPkg.py 2011-08-10 02:19:55 UTC (rev 2245)
+++ trunk/BaseTools/Source/Python/UPT/InstallPkg.py 2011-08-11 08:08:37 UTC (rev 2246)
@@ -136,7 +136,7 @@
def UnZipDp(WorkspaceDir, Options, DataBase):
ContentZipFile = None
Logger.Quiet(ST.MSG_UZIP_PARSE_XML)
- DpPkgFileName = os.path.normpath(os.path.join(WorkspaceDir, Options.PackageFile))
+ DpPkgFileName = Options.PackageFile
DistFile = PackageFile(DpPkgFileName)
DpDescFileName, ContentFileName = GetDPFile(DistFile.GetZipFile())
Modified: trunk/BaseTools/Source/Python/UPT/Logger/StringTable.py
===================================================================
--- trunk/BaseTools/Source/Python/UPT/Logger/StringTable.py 2011-08-10 02:19:55 UTC (rev 2245)
+++ trunk/BaseTools/Source/Python/UPT/Logger/StringTable.py 2011-08-11 08:08:37 UTC (rev 2246)
@@ -543,6 +543,8 @@
ERR_INSTALL_FILE_DEC_FILE_ERROR = _("Could not obtain the TokenSpaceGuidCName and the PcdCName from the DEC files "
"that the package depends on for this pcd entry: TokenValue: %s Token: %s")
ERR_NOT_SUPPORTED_SA_MODULE = _("Stand-alone module distribution does not allow EDK 1 INF")
+ERR_INSTALL_DIST_NOT_FOUND = \
+_("Distribution file to be installed is not found in current working directory or workspace: %s")
#
# Expression error message
Modified: trunk/BaseTools/Source/Python/UPT/UPT.py
===================================================================
--- trunk/BaseTools/Source/Python/UPT/UPT.py 2011-08-10 02:19:55 UTC (rev 2245)
+++ trunk/BaseTools/Source/Python/UPT/UPT.py 2011-08-11 08:08:37 UTC (rev 2246)
@@ -178,6 +178,27 @@
elif Opt.PackFileToInstall:
if not Opt.PackFileToInstall.endswith('.dist'):
Logger.Error("InstallPkg", FILE_TYPE_MISMATCH, ExtraData=ST.ERR_DIST_EXT_ERROR % Opt.PackFileToInstall)
+
+ #
+ # check file existence, if not absolute path, then try current working directory, then $(WORKSPACE)
+ #
+ Existed = True
+ if os.path.isabs(Opt.PackFileToInstall):
+ if not (os.path.exists(Opt.PackFileToInstall) and os.path.isfile(Opt.PackFileToInstall)):
+ Existed = False
+ else:
+ AbsPath = os.path.normpath(os.path.join(os.getcwd(), Opt.PackFileToInstall))
+ if not (os.path.exists(AbsPath) and os.path.isfile(AbsPath)):
+ AbsPath = os.path.normpath(os.path.join(WorkspaceDir, Opt.PackFileToInstall))
+ if not (os.path.exists(AbsPath) and os.path.isfile(AbsPath)):
+ Existed = False
+
+ if Existed:
+ Opt.PackFileToInstall = AbsPath
+
+ if not Existed:
+ Logger.Error("InstallPkg", FILE_NOT_FOUND, ST.ERR_INSTALL_DIST_NOT_FOUND % Opt.PackFileToInstall)
+
setattr(Opt, 'PackageFile', Opt.PackFileToInstall)
RunModule = InstallPkg.Main
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2011-11-21 08:41:10
|
Revision: 2421
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2421&view=rev
Author: jsu1
Date: 2011-11-21 08:40:57 +0000 (Mon, 21 Nov 2011)
Log Message:
-----------
Update UPT to not break on EDKI style comment for EDKI INFs
Reviewed-by: yingke
Reviewed-by: djboyer
Signed-off-by: jsu1
Modified Paths:
--------------
trunk/BaseTools/Source/Python/UPT/Library/Misc.py
trunk/BaseTools/Source/Python/UPT/Logger/StringTable.py
trunk/BaseTools/Source/Python/UPT/Parser/InfParser.py
Modified: trunk/BaseTools/Source/Python/UPT/Library/Misc.py
===================================================================
--- trunk/BaseTools/Source/Python/UPT/Library/Misc.py 2011-11-21 07:00:55 UTC (rev 2420)
+++ trunk/BaseTools/Source/Python/UPT/Library/Misc.py 2011-11-21 08:40:57 UTC (rev 2421)
@@ -834,6 +834,59 @@
return NewList
+## ProcessEdkComment
+#
+# Process EDK style comment in LineList: c style /* */ comment or cpp style // comment
+#
+#
+# @param LineList The LineList need to be processed.
+#
+# @return LineList The LineList been processed.
+# @return FirstPos Where Edk comment is first found, -1 if not found
+#
+def ProcessEdkComment(LineList):
+ FindEdkBlockComment = False
+ Count = 0
+ StartPos = -1
+ EndPos = -1
+ FirstPos = -1
+
+ while(Count < len(LineList)):
+ Line = LineList[Count].strip()
+ if Line.startswith("/*"):
+ #
+ # handling c style comment
+ #
+ StartPos = Count
+ while Count < len(LineList):
+ Line = LineList[Count].strip()
+ if Line.endswith("*/"):
+ if (Count == StartPos) and Line.strip() == '/*/':
+ Count = Count + 1
+ continue
+ EndPos = Count
+ FindEdkBlockComment = True
+ break
+ Count = Count + 1
+
+ if FindEdkBlockComment:
+ if FirstPos == -1:
+ FirstPos = StartPos
+ for Index in xrange(StartPos, EndPos+1):
+ LineList[Index] = ''
+ FindEdkBlockComment = False
+ elif Line.find("//") != -1:
+ #
+ # handling cpp style comment
+ #
+ LineList[Count] = Line.replace("//", '#')
+ if FirstPos == -1:
+ FirstPos = Count
+
+ Count = Count + 1
+
+ return LineList, FirstPos
+
## GetLibInstanceInfo
#
# Get the information from Library Instance INF file.
Modified: trunk/BaseTools/Source/Python/UPT/Logger/StringTable.py
===================================================================
--- trunk/BaseTools/Source/Python/UPT/Logger/StringTable.py 2011-11-21 07:00:55 UTC (rev 2420)
+++ trunk/BaseTools/Source/Python/UPT/Logger/StringTable.py 2011-11-21 08:40:57 UTC (rev 2421)
@@ -196,6 +196,7 @@
_("The INF file %s defines both VERSION_NUMBER and VERSION_STRING, "
"using VERSION_STRING")
ERR_INF_PARSER_NOT_SUPPORT_EDKI_INF = _("EDKI INF is not supported")
+ERR_INF_PARSER_EDKI_COMMENT_IN_EDKII = _("The EDKI style comment is not supported in EDKII modules")
ERR_INF_PARSER_FEATUREPCD_USAGE_INVALID = _("The usage for FeaturePcd can only"
" be type of \"CONSUMES\".")
Modified: trunk/BaseTools/Source/Python/UPT/Parser/InfParser.py
===================================================================
--- trunk/BaseTools/Source/Python/UPT/Parser/InfParser.py 2011-11-21 07:00:55 UTC (rev 2420)
+++ trunk/BaseTools/Source/Python/UPT/Parser/InfParser.py 2011-11-21 08:40:57 UTC (rev 2421)
@@ -26,6 +26,7 @@
from Library.String import GetSplitValueList
from Library.String import ConvertSpecialChar
from Library.Misc import ProcessLineExtender
+from Library.Misc import ProcessEdkComment
from Library.Parsing import NormPath
from Library.ParserValidate import IsValidInfMoudleTypeList
from Library.ParserValidate import IsValidArch
@@ -165,6 +166,12 @@
FileLinesList = ProcessLineExtender(FileLinesList)
#
+ # Process EdkI INF style comment if found
+ #
+ OrigLines = [Line for Line in FileLinesList]
+ FileLinesList, EdkCommentStartPos = ProcessEdkComment(FileLinesList)
+
+ #
# Judge whether the INF file is Binary INF or not
#
if IsBinaryInf(FileLinesList):
@@ -339,6 +346,17 @@
File=self.FullPath)
#
+ # EDKII INF should not have EDKI style comment
+ #
+ if EdkCommentStartPos != -1:
+ Logger.Error("InfParser",
+ FORMAT_INVALID,
+ ST.ERR_INF_PARSER_EDKI_COMMENT_IN_EDKII,
+ File=self.FullPath,
+ Line=EdkCommentStartPos + 1,
+ ExtraData=OrigLines[EdkCommentStartPos])
+
+ #
# extract [Event] [Hob] [BootMode] sections
#
self._ExtractEventHobBootMod(FileLinesList)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2011-11-28 02:01:02
|
Revision: 2433
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2433&view=rev
Author: jsu1
Date: 2011-11-28 02:00:55 +0000 (Mon, 28 Nov 2011)
Log Message:
-----------
Update UPT to report error if integrity error exception raised during updating database
Update UPT to use guid/version/name/path as module unique identity
Reviewed-by: hchen30
Signed-off-by: jsu1
Modified Paths:
--------------
trunk/BaseTools/Source/Python/UPT/Core/DependencyRules.py
trunk/BaseTools/Source/Python/UPT/Core/DistributionPackageClass.py
trunk/BaseTools/Source/Python/UPT/Core/IpiDb.py
trunk/BaseTools/Source/Python/UPT/InstallPkg.py
trunk/BaseTools/Source/Python/UPT/Logger/StringTable.py
trunk/BaseTools/Source/Python/UPT/Logger/ToolError.py
trunk/BaseTools/Source/Python/UPT/Xml/PackageSurfaceAreaXml.py
trunk/BaseTools/Source/Python/UPT/Xml/XmlParser.py
Modified: trunk/BaseTools/Source/Python/UPT/Core/DependencyRules.py
===================================================================
--- trunk/BaseTools/Source/Python/UPT/Core/DependencyRules.py 2011-11-25 08:57:47 UTC (rev 2432)
+++ trunk/BaseTools/Source/Python/UPT/Core/DependencyRules.py 2011-11-28 02:00:55 UTC (rev 2433)
@@ -55,12 +55,12 @@
# @param Guid: Guid of a module
# @param Version: Version of a module
#
- def CheckModuleExists(self, Guid, Version, ReturnCode=DEPEX_CHECK_SUCCESS):
+ def CheckModuleExists(self, Guid, Version, Name, Path, ReturnCode=DEPEX_CHECK_SUCCESS):
if ReturnCode:
pass
Logger.Verbose(ST.MSG_CHECK_MODULE_EXIST)
- ModuleList = self.IpiDb.GetModInPackage(Guid, Version)
- ModuleList.extend(self.IpiDb.GetStandaloneModule(Guid, Version))
+ ModuleList = self.IpiDb.GetModInPackage(Guid, Version, Name, Path)
+ ModuleList.extend(self.IpiDb.GetStandaloneModule(Guid, Version, Name, Path))
Logger.Verbose(ST.MSG_CHECK_MODULE_EXIST_FINISH)
if len(ModuleList) > 0:
return True
Modified: trunk/BaseTools/Source/Python/UPT/Core/DistributionPackageClass.py
===================================================================
--- trunk/BaseTools/Source/Python/UPT/Core/DistributionPackageClass.py 2011-11-25 08:57:47 UTC (rev 2432)
+++ trunk/BaseTools/Source/Python/UPT/Core/DistributionPackageClass.py 2011-11-28 02:00:55 UTC (rev 2433)
@@ -95,7 +95,7 @@
#
self.PackageSurfaceArea = Sdict()
#
- # {(Guid, Version, Path) : ModuleObj}
+ # {(Guid, Version, Name, Path) : ModuleObj}
#
self.ModuleSurfaceArea = Sdict()
self.Tools = MiscFileObject()
@@ -149,6 +149,7 @@
ModuleDict = PackageObj.GetModuleDict()
ModuleDict[(ModuleObj.GetGuid(), \
ModuleObj.GetVersion(), \
+ ModuleObj.GetName(), \
ModuleObj.GetCombinePath())] = ModuleObj
PackageObj.SetModuleDict(ModuleDict)
except FatalError, ErrCode:
@@ -172,10 +173,11 @@
try:
ModuleObj = InfPomAlignment(ModuleFileFullPath,
WorkspaceDir)
- self.ModuleSurfaceArea[(ModuleObj.GetGuid(), \
- ModuleObj.GetVersion(), \
- ModuleObj.GetCombinePath())] = \
- ModuleObj
+ ModuleKey = (ModuleObj.GetGuid(),
+ ModuleObj.GetVersion(),
+ ModuleObj.GetName(),
+ ModuleObj.GetCombinePath())
+ self.ModuleSurfaceArea[ModuleKey] = ModuleObj
except FatalError, ErrCode:
if ErrCode.message == EDK1_INF_ERROR:
Logger.Error("UPT",
@@ -207,16 +209,16 @@
Module = None
ModuleDict = Package.GetModuleDict()
- for Guid, Version, Path in ModuleDict:
- Module = ModuleDict[Guid, Version, Path]
+ for Guid, Version, Name, Path in ModuleDict:
+ Module = ModuleDict[Guid, Version, Name, Path]
ModulePath = Module.GetModulePath()
FullPath = Module.GetFullPath()
PkgRelPath = os.path.normpath(os.path.join(PackagePath, ModulePath))
MetaDataFileList.append(Path)
self.FileList += GetNonMetaDataFiles(os.path.dirname(FullPath), ['CVS', '.svn'], False, PkgRelPath)
- for Guid, Version, Path in self.ModuleSurfaceArea:
- Module = self.ModuleSurfaceArea[Guid, Version, Path]
+ for Guid, Version, Name, Path in self.ModuleSurfaceArea:
+ Module = self.ModuleSurfaceArea[Guid, Version, Name, Path]
ModulePath = Module.GetModulePath()
FullPath = Module.GetFullPath()
MetaDataFileList.append(Path)
Modified: trunk/BaseTools/Source/Python/UPT/Core/IpiDb.py
===================================================================
--- trunk/BaseTools/Source/Python/UPT/Core/IpiDb.py 2011-11-25 08:57:47 UTC (rev 2432)
+++ trunk/BaseTools/Source/Python/UPT/Core/IpiDb.py 2011-11-28 02:00:55 UTC (rev 2433)
@@ -26,6 +26,7 @@
import Logger.Log as Logger
from Logger import StringTable as ST
from Logger.ToolError import UPT_ALREADY_RUNNING_ERROR
+from Logger.ToolError import UPT_DB_UPDATE_ERROR
## IpiDb
#
@@ -118,11 +119,12 @@
create table IF NOT EXISTS %s (
ModuleGuid TEXT NOT NULL,
ModuleVersion TEXT NOT NULL,
+ ModuleName TEXT NOT NULL,
InstallTime REAL NOT NULL,
PackageGuid TEXT,
PackageVersion TEXT,
InstallPath TEXT NOT NULL,
- PRIMARY KEY (ModuleGuid, ModuleVersion, InstallPath)
+ PRIMARY KEY (ModuleGuid, ModuleVersion, ModuleName, InstallPath)
)""" % self.ModInPkgTable
self.Cur.execute(SqlCommand)
@@ -130,11 +132,12 @@
create table IF NOT EXISTS %s (
ModuleGuid TEXT NOT NULL,
ModuleVersion TEXT NOT NULL,
+ ModuleName TEXT NOT NULL,
InstallTime REAL NOT NULL,
DpGuid TEXT,
DpVersion TEXT,
InstallPath TEXT NOT NULL,
- PRIMARY KEY (ModuleGuid, ModuleVersion, InstallPath)
+ PRIMARY KEY (ModuleGuid, ModuleVersion, ModuleName, InstallPath)
)""" % self.StandaloneModTable
self.Cur.execute(SqlCommand)
@@ -142,6 +145,7 @@
create table IF NOT EXISTS %s (
ModuleGuid TEXT NOT NULL,
ModuleVersion TEXT NOT NULL,
+ ModuleName TEXT NOT NULL,
InstallPath TEXT NOT NULL,
DepexGuid TEXT,
DepexVersion TEXT
@@ -160,64 +164,72 @@
# @param RePackage: A RePackage
#
def AddDPObject(self, DpObj, NewDpPkgFileName, DpPkgFileName, RePackage):
-
- for PkgKey in DpObj.PackageSurfaceArea.keys():
- PkgGuid = PkgKey[0]
- PkgVersion = PkgKey[1]
- PkgInstallPath = PkgKey[2]
- self._AddPackage(PkgGuid, PkgVersion, DpObj.Header.GetGuid(), \
- DpObj.Header.GetVersion(), PkgInstallPath)
- PkgObj = DpObj.PackageSurfaceArea[PkgKey]
- for ModKey in PkgObj.GetModuleDict().keys():
+ try:
+ for PkgKey in DpObj.PackageSurfaceArea.keys():
+ PkgGuid = PkgKey[0]
+ PkgVersion = PkgKey[1]
+ PkgInstallPath = PkgKey[2]
+ self._AddPackage(PkgGuid, PkgVersion, DpObj.Header.GetGuid(), \
+ DpObj.Header.GetVersion(), PkgInstallPath)
+ PkgObj = DpObj.PackageSurfaceArea[PkgKey]
+ for ModKey in PkgObj.GetModuleDict().keys():
+ ModGuid = ModKey[0]
+ ModVersion = ModKey[1]
+ ModName = ModKey[2]
+ ModInstallPath = ModKey[3]
+ ModInstallPath = \
+ os.path.normpath(os.path.join(PkgInstallPath, ModInstallPath))
+ self._AddModuleInPackage(ModGuid, ModVersion, ModName, PkgGuid, \
+ PkgVersion, ModInstallPath)
+ ModObj = PkgObj.GetModuleDict()[ModKey]
+ for Dep in ModObj.GetPackageDependencyList():
+ DepexGuid = Dep.GetGuid()
+ DepexVersion = Dep.GetVersion()
+ self._AddModuleDepex(ModGuid, ModVersion, ModName, ModInstallPath, \
+ DepexGuid, DepexVersion)
+ for (FilePath, Md5Sum) in PkgObj.FileList:
+ self._AddDpFilePathList(DpObj.Header.GetGuid(), \
+ DpObj.Header.GetVersion(), FilePath, \
+ Md5Sum)
+
+ for ModKey in DpObj.ModuleSurfaceArea.keys():
ModGuid = ModKey[0]
ModVersion = ModKey[1]
- ModInstallPath = ModKey[2]
- ModInstallPath = \
- os.path.normpath(os.path.join(PkgInstallPath, ModInstallPath))
- self._AddModuleInPackage(ModGuid, ModVersion, PkgGuid, \
- PkgVersion, ModInstallPath)
- ModObj = PkgObj.GetModuleDict()[ModKey]
+ ModName = ModKey[2]
+ ModInstallPath = ModKey[3]
+ self._AddStandaloneModule(ModGuid, ModVersion, ModName, \
+ DpObj.Header.GetGuid(), \
+ DpObj.Header.GetVersion(), \
+ ModInstallPath)
+ ModObj = DpObj.ModuleSurfaceArea[ModKey]
for Dep in ModObj.GetPackageDependencyList():
DepexGuid = Dep.GetGuid()
DepexVersion = Dep.GetVersion()
- self._AddModuleDepex(ModGuid, ModVersion, ModInstallPath, \
+ self._AddModuleDepex(ModGuid, ModVersion, ModName, ModInstallPath, \
DepexGuid, DepexVersion)
- for (FilePath, Md5Sum) in PkgObj.FileList:
+ for (Path, Md5Sum) in ModObj.FileList:
+ self._AddDpFilePathList(DpObj.Header.GetGuid(), \
+ DpObj.Header.GetVersion(), \
+ Path, Md5Sum)
+
+ #
+ # add tool/misc files
+ #
+ for (Path, Md5Sum) in DpObj.FileList:
self._AddDpFilePathList(DpObj.Header.GetGuid(), \
- DpObj.Header.GetVersion(), FilePath, \
- Md5Sum)
+ DpObj.Header.GetVersion(), Path, Md5Sum)
+
+ self._AddDp(DpObj.Header.GetGuid(), DpObj.Header.GetVersion(), \
+ NewDpPkgFileName, DpPkgFileName, RePackage)
+
+ self.Conn.commit()
+ except sqlite3.IntegrityError, DetailMsg:
+ Logger.Error("UPT",
+ UPT_DB_UPDATE_ERROR,
+ ST.ERR_UPT_DB_UPDATE_ERROR,
+ ExtraData = DetailMsg
+ )
- for ModKey in DpObj.ModuleSurfaceArea.keys():
- ModGuid = ModKey[0]
- ModVersion = ModKey[1]
- ModInstallPath = ModKey[2]
- self._AddStandaloneModule(ModGuid, ModVersion, \
- DpObj.Header.GetGuid(), \
- DpObj.Header.GetVersion(), \
- ModInstallPath)
- ModObj = DpObj.ModuleSurfaceArea[ModKey]
- for Dep in ModObj.GetPackageDependencyList():
- DepexGuid = Dep.GetGuid()
- DepexVersion = Dep.GetVersion()
- self._AddModuleDepex(ModGuid, ModVersion, ModInstallPath, \
- DepexGuid, DepexVersion)
- for (Path, Md5Sum) in ModObj.FileList:
- self._AddDpFilePathList(DpObj.Header.GetGuid(), \
- DpObj.Header.GetVersion(), \
- Path, Md5Sum)
-
- #
- # add tool/misc files
- #
- for (Path, Md5Sum) in DpObj.FileList:
- self._AddDpFilePathList(DpObj.Header.GetGuid(), \
- DpObj.Header.GetVersion(), Path, Md5Sum)
-
- self._AddDp(DpObj.Header.GetGuid(), DpObj.Header.GetVersion(), \
- NewDpPkgFileName, DpPkgFileName, RePackage)
-
- self.Conn.commit()
-
## Add a distribution install information
#
# @param Guid Guid of the distribution package
@@ -290,12 +302,14 @@
## Add a module that from a package install information
#
- # @param Guid: A package guid
- # @param Version: A package version
- # @param PkgGuid: A package guid
- # @param PkgFileName: A package File Name
+ # @param Guid: Module Guid
+ # @param Version: Module version
+ # @param Name: Module Name
+ # @param PkgGuid: Package Guid
+ # @param PkgVersion: Package version
+ # @param Path: Package relative path that module installs
#
- def _AddModuleInPackage(self, Guid, Version, PkgGuid=None, \
+ def _AddModuleInPackage(self, Guid, Version, Name, PkgGuid=None, \
PkgVersion=None, Path=''):
if Version == None or len(Version.strip()) == 0:
@@ -312,8 +326,8 @@
#
CurrentTime = time.time()
SqlCommand = \
- """insert into %s values('%s', '%s', %s, '%s', '%s', '%s')""" % \
- (self.ModInPkgTable, Guid, Version, CurrentTime, PkgGuid, PkgVersion, \
+ """insert into %s values('%s', '%s', '%s', %s, '%s', '%s', '%s')""" % \
+ (self.ModInPkgTable, Guid, Version, Name, CurrentTime, PkgGuid, PkgVersion, \
Path)
self.Cur.execute(SqlCommand)
@@ -321,11 +335,12 @@
#
# @param Guid: a module Guid
# @param Version: a module Version
+ # @param Name: a module name
# @param DpGuid: a DpGuid
# @param DpVersion: a DpVersion
# @param Path: path
#
- def _AddStandaloneModule(self, Guid, Version, DpGuid=None, \
+ def _AddStandaloneModule(self, Guid, Version, Name, DpGuid=None, \
DpVersion=None, Path=''):
if Version == None or len(Version.strip()) == 0:
@@ -342,8 +357,8 @@
#
CurrentTime = time.time()
SqlCommand = \
- """insert into %s values('%s', '%s', %s, '%s', '%s', '%s')""" % \
- (self.StandaloneModTable, Guid, Version, CurrentTime, DpGuid, \
+ """insert into %s values('%s', '%s', '%s', %s, '%s', '%s', '%s')""" % \
+ (self.StandaloneModTable, Guid, Version, Name, CurrentTime, DpGuid, \
DpVersion, Path)
self.Cur.execute(SqlCommand)
@@ -351,10 +366,11 @@
#
# @param Guid: a module Guid
# @param Version: a module Version
+ # @param Name: a module name
# @param DepexGuid: a module DepexGuid
# @param DepexVersion: a module DepexVersion
#
- def _AddModuleDepex(self, Guid, Version, Path, DepexGuid=None, \
+ def _AddModuleDepex(self, Guid, Version, Name, Path, DepexGuid=None, \
DepexVersion=None):
if DepexGuid == None or len(DepexGuid.strip()) == 0:
@@ -366,8 +382,8 @@
#
# Add module depex information to DB.
#
- SqlCommand = """insert into %s values('%s', '%s', '%s', '%s', '%s')"""\
- % (self.ModDepexTable, Guid, Version, Path, DepexGuid, DepexVersion)
+ SqlCommand = """insert into %s values('%s', '%s', '%s', '%s', '%s', '%s')"""\
+ % (self.ModDepexTable, Guid, Version, Name, Path, DepexGuid, DepexVersion)
self.Cur.execute(SqlCommand)
## Remove a distribution install information, if no version specified,
@@ -389,10 +405,13 @@
and ModDepexInfo.ModuleVersion in
(select ModuleVersion from StandaloneModInfo as B
where B.DpGuid = '%s' and B.DpVersion = '%s')
+ and ModDepexInfo.ModuleName in
+ (select ModuleName from StandaloneModInfo as B
+ where B.DpGuid = '%s' and B.DpVersion = '%s')
and ModDepexInfo.InstallPath in
(select InstallPath from StandaloneModInfo as B
where B.DpGuid = '%s' and B.DpVersion = '%s') """ % \
- (DpGuid, DpVersion, DpGuid, DpVersion, DpGuid, DpVersion)
+ (DpGuid, DpVersion, DpGuid, DpVersion, DpGuid, DpVersion, DpGuid, DpVersion)
self.Cur.execute(SqlCommand)
#
@@ -409,11 +428,15 @@
(select ModuleVersion from ModInPkgInfo
where ModInPkgInfo.PackageGuid ='%s' and
ModInPkgInfo.PackageVersion = '%s')
+ and ModDepexInfo.ModuleName in
+ (select ModuleName from ModInPkgInfo
+ where ModInPkgInfo.PackageGuid ='%s' and
+ ModInPkgInfo.PackageVersion = '%s')
and ModDepexInfo.InstallPath in
(select InstallPath from ModInPkgInfo where
ModInPkgInfo.PackageGuid ='%s'
and ModInPkgInfo.PackageVersion = '%s')""" \
- % (Pkg[0], Pkg[1],Pkg[0], Pkg[1],Pkg[0], Pkg[1])
+ % (Pkg[0], Pkg[1], Pkg[0], Pkg[1], Pkg[0], Pkg[1],Pkg[0], Pkg[1])
self.Cur.execute(SqlCommand)
#
@@ -627,23 +650,21 @@
# @param Guid: A module guid
# @param Version: A module version
#
- def GetModInPackage(self, Guid, Version, PkgGuid='', PkgVersion=''):
-
+ def GetModInPackage(self, Guid, Version, Name, Path, PkgGuid='', PkgVersion=''):
+ (ModuleGuid, ModuleVersion, ModuleName, InstallPath) = (Guid, Version, Name, Path)
if PkgVersion == '' or PkgGuid == '':
-
- (ModuleGuid, ModuleVersion) = (Guid, Version)
SqlCommand = """select * from %s where ModuleGuid ='%s' and
- ModuleVersion = '%s'""" % (self.ModInPkgTable, ModuleGuid, \
- ModuleVersion)
+ ModuleVersion = '%s' and InstallPath = '%s'
+ and ModuleName = '%s'""" % (self.ModInPkgTable, ModuleGuid, \
+ ModuleVersion, InstallPath, ModuleName)
self.Cur.execute(SqlCommand)
-
else:
- (ModuleGuid, ModuleVersion) = (Guid, Version)
SqlCommand = """select * from %s where ModuleGuid ='%s' and
- ModuleVersion = '%s' and PackageGuid ='%s'
+ ModuleVersion = '%s' and InstallPath = '%s'
+ and ModuleName = '%s' and PackageGuid ='%s'
and PackageVersion = '%s'
""" % (self.ModInPkgTable, ModuleGuid, \
- ModuleVersion, PkgGuid, PkgVersion)
+ ModuleVersion, InstallPath, ModuleName, PkgGuid, PkgVersion)
self.Cur.execute(SqlCommand)
ModList = []
@@ -662,21 +683,20 @@
# @param Guid: A module guid
# @param Version: A module version
#
- def GetStandaloneModule(self, Guid, Version, DpGuid='', DpVersion=''):
-
+ def GetStandaloneModule(self, Guid, Version, Name, Path, DpGuid='', DpVersion=''):
+ (ModuleGuid, ModuleVersion, ModuleName, InstallPath) = (Guid, Version, Name, Path)
if DpGuid == '':
- (ModuleGuid, ModuleVersion) = (Guid, Version)
SqlCommand = """select * from %s where ModuleGuid ='%s' and
- ModuleVersion = '%s'""" % (self.StandaloneModTable, ModuleGuid, \
- ModuleVersion)
+ ModuleVersion = '%s' and InstallPath = '%s'
+ and ModuleName = '%s'""" % (self.StandaloneModTable, ModuleGuid, \
+ ModuleVersion, InstallPath, ModuleName)
self.Cur.execute(SqlCommand)
else:
- (ModuleGuid, ModuleVersion) = (Guid, Version)
SqlCommand = """select * from %s where ModuleGuid ='%s' and
- ModuleVersion = '%s' and DpGuid ='%s' and DpVersion = '%s'
+ ModuleVersion = '%s' and InstallPath = '%s' and ModuleName = '%s' and DpGuid ='%s' and DpVersion = '%s'
""" % (self.StandaloneModTable, ModuleGuid, \
- ModuleVersion, DpGuid, DpVersion)
+ ModuleVersion, ModuleName, InstallPath, DpGuid, DpVersion)
self.Cur.execute(SqlCommand)
ModList = []
Modified: trunk/BaseTools/Source/Python/UPT/InstallPkg.py
===================================================================
--- trunk/BaseTools/Source/Python/UPT/InstallPkg.py 2011-11-25 08:57:47 UTC (rev 2432)
+++ trunk/BaseTools/Source/Python/UPT/InstallPkg.py 2011-11-28 02:00:55 UTC (rev 2433)
@@ -265,11 +265,11 @@
#
Module = None
NewDict = Sdict()
- for Guid, Version, Path in DistPkg.ModuleSurfaceArea:
+ for Guid, Version, Name, Path in DistPkg.ModuleSurfaceArea:
ModulePath = Path
- Module = DistPkg.ModuleSurfaceArea[Guid, Version, Path]
+ Module = DistPkg.ModuleSurfaceArea[Guid, Version, Name, Path]
Logger.Info(ST.MSG_INSTALL_MODULE % Module.GetName())
- if Dep.CheckModuleExists(Guid, Version):
+ if Dep.CheckModuleExists(Guid, Version, Name, Path):
Logger.Quiet(ST.WRN_MODULE_EXISTED %Path)
#
# here check for the multiple inf share the same module path cases:
@@ -291,7 +291,7 @@
#
Module.SetModulePath(Module.GetModulePath().replace(Path, NewModulePath, 1))
- NewDict[Guid, Version, Module.GetModulePath()] = Module
+ NewDict[Guid, Version, Name, Module.GetModulePath()] = Module
#
# generate all inf for modules
@@ -737,8 +737,8 @@
#
Module = None
ModuleDict = Package.GetModuleDict()
- for ModuleGuid, ModuleVersion, ModulePath in ModuleDict:
- Module = ModuleDict[ModuleGuid, ModuleVersion, ModulePath]
+ for ModuleGuid, ModuleVersion, ModuleName, ModulePath in ModuleDict:
+ Module = ModuleDict[ModuleGuid, ModuleVersion, ModuleName, ModulePath]
InstallModuleContent(FromPath, ToPath, ModulePath, Module,
ContentZipFile, WorkspaceDir, ModuleList, Package, ReadOnly)
Modified: trunk/BaseTools/Source/Python/UPT/Logger/StringTable.py
===================================================================
--- trunk/BaseTools/Source/Python/UPT/Logger/StringTable.py 2011-11-25 08:57:47 UTC (rev 2432)
+++ trunk/BaseTools/Source/Python/UPT/Logger/StringTable.py 2011-11-28 02:00:55 UTC (rev 2433)
@@ -524,6 +524,7 @@
ERR_UPT_ALREADY_INSTALLED_ERROR = _("Already installed")
ERR_UPT_ENVIRON_MISSING_ERROR = _("Environ missing")
ERR_UPT_REPKG_ERROR = _("File not allowed for RePackage")
+ERR_UPT_DB_UPDATE_ERROR = _("Update database did not complete successfully")
ERR_UPT_INI_PARSE_ERROR = _("INI file parse error")
ERR_COPYRIGHT_MISSING = \
_("Header comment section must have copyright information")
Modified: trunk/BaseTools/Source/Python/UPT/Logger/ToolError.py
===================================================================
--- trunk/BaseTools/Source/Python/UPT/Logger/ToolError.py 2011-11-25 08:57:47 UTC (rev 2432)
+++ trunk/BaseTools/Source/Python/UPT/Logger/ToolError.py 2011-11-28 02:00:55 UTC (rev 2433)
@@ -97,6 +97,7 @@
UPT_REPKG_ERROR = 0xD002
UPT_ALREADY_RUNNING_ERROR = 0xD003
UPT_MUL_DEC_ERROR = 0xD004
+UPT_DB_UPDATE_ERROR = 0xD005
UPT_INI_PARSE_ERROR = 0xE000
## Error message of each error code
Modified: trunk/BaseTools/Source/Python/UPT/Xml/PackageSurfaceAreaXml.py
===================================================================
--- trunk/BaseTools/Source/Python/UPT/Xml/PackageSurfaceAreaXml.py 2011-11-25 08:57:47 UTC (rev 2432)
+++ trunk/BaseTools/Source/Python/UPT/Xml/PackageSurfaceAreaXml.py 2011-11-28 02:00:55 UTC (rev 2433)
@@ -273,7 +273,8 @@
for SubItem in XmlList(Item, '/PackageSurfaceArea/Modules/ModuleSurfaceArea'):
Tmp = ModuleSurfaceAreaXml()
Module = Tmp.FromXml(SubItem, 'ModuleSurfaceArea')
- Package.ModuleDict[(Module.GetGuid(), Module.GetVersion(), Module.GetModulePath())] = Module
+ ModuleDictKey = (Module.GetGuid(), Module.GetVersion(), Module.GetName(), Module.GetModulePath())
+ Package.ModuleDict[ModuleDictKey] = Module
#
# MiscellaneousFile
#
Modified: trunk/BaseTools/Source/Python/UPT/Xml/XmlParser.py
===================================================================
--- trunk/BaseTools/Source/Python/UPT/Xml/XmlParser.py 2011-11-25 08:57:47 UTC (rev 2432)
+++ trunk/BaseTools/Source/Python/UPT/Xml/XmlParser.py 2011-11-28 02:00:55 UTC (rev 2433)
@@ -180,7 +180,9 @@
for Item in XmlList(self.Pkg, '/DistributionPackage/ModuleSurfaceArea'):
Msa = ModuleSurfaceAreaXml()
Module = Msa.FromXml(Item, 'ModuleSurfaceArea', True)
- self.DistP.ModuleSurfaceArea[(Module.GetGuid(), Module.GetVersion(), Module.GetModulePath())] = Module
+ ModuleKey = (Module.GetGuid(), Module.GetVersion(), Module.GetName(), Module.GetModulePath())
+ self.DistP.ModuleSurfaceArea[ModuleKey] = Module
+
#
# Parse Tools
#
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2011-12-16 05:48:52
|
Revision: 2473
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2473&view=rev
Author: jsu1
Date: 2011-12-16 05:48:46 +0000 (Fri, 16 Dec 2011)
Log Message:
-----------
Update UPT to fix the issue that reported by pylint
Reviewed-by: hchen30
Signed-off-by: jsu1
Modified Paths:
--------------
trunk/BaseTools/Source/Python/UPT/BuildVersion.py
trunk/BaseTools/Source/Python/UPT/Library/String.py
Modified: trunk/BaseTools/Source/Python/UPT/BuildVersion.py
===================================================================
--- trunk/BaseTools/Source/Python/UPT/BuildVersion.py 2011-12-16 03:16:40 UTC (rev 2472)
+++ trunk/BaseTools/Source/Python/UPT/BuildVersion.py 2011-12-16 05:48:46 UTC (rev 2473)
@@ -1,3 +1,20 @@
-#This file is for build version number auto generation
+## @file
#
+# This file is for build version number auto generation
+#
+# Copyright (c) 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
+# 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.
+#
+
+'''
+Build version information
+'''
+
gBUILD_VERSION = ""
Modified: trunk/BaseTools/Source/Python/UPT/Library/String.py
===================================================================
--- trunk/BaseTools/Source/Python/UPT/Library/String.py 2011-12-16 03:16:40 UTC (rev 2472)
+++ trunk/BaseTools/Source/Python/UPT/Library/String.py 2011-12-16 05:48:46 UTC (rev 2473)
@@ -643,35 +643,6 @@
def ConvertToSqlString2(String):
return String.replace("'", "''")
-## RemoveBlockComment
-#
-# Remove comment block
-#
-# @param Lines: Block Comment Lines
-#
-def RemoveBlockComment(Lines):
- IsFindBlockComment = False
- ReservedLine = ''
- NewLines = []
-
- for Line in Lines:
- Line = Line.strip()
- #
- # Remove comment block
- #
- if Line.find(DataType.TAB_COMMENT_EDK1_START) > -1:
- ReservedLine = GetSplitList(Line, DataType.TAB_COMMENT_EDK1_START, 1)[0]
- IsFindBlockComment = True
- if Line.find(DataType.TAB_COMMENT_EDK1_END) > -1:
- Line = ReservedLine + GetSplitList(Line, DataType.TAB_COMMENT_EDK1_END, 1)[1]
- ReservedLine = ''
- IsFindBlockComment = False
- if IsFindBlockComment:
- NewLines.append('')
- continue
- NewLines.append(Line)
- return NewLines
-
## GetStringOfList
#
# Get String of a List
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <hc...@us...> - 2013-04-07 01:50:59
|
Revision: 2579
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2579&view=rev
Author: hchen30
Date: 2013-04-07 01:50:50 +0000 (Sun, 07 Apr 2013)
Log Message:
-----------
1. Support library instance specified by GUID and Version
signed-off-by: Hess Chen (hes...@in...)
reviewed-by: Fei Chen (fei...@in...)
Modified Paths:
--------------
trunk/BaseTools/Source/Python/UPT/Library/GlobalData.py
trunk/BaseTools/Source/Python/UPT/Parser/InfAsBuiltProcess.py
trunk/BaseTools/Source/Python/UPT/Parser/InfLibrarySectionParser.py
Modified: trunk/BaseTools/Source/Python/UPT/Library/GlobalData.py
===================================================================
--- trunk/BaseTools/Source/Python/UPT/Library/GlobalData.py 2013-04-07 01:45:20 UTC (rev 2578)
+++ trunk/BaseTools/Source/Python/UPT/Library/GlobalData.py 2013-04-07 01:50:50 UTC (rev 2579)
@@ -92,3 +92,8 @@
# Flag used to mark whether the INF file is Binary INF or not.
#
gIS_BINARY_INF = False
+#
+# Used by Library instance parser
+# {FilePath: FileObj}
+#
+gLIBINSTANCEDICT = {}
\ No newline at end of file
Modified: trunk/BaseTools/Source/Python/UPT/Parser/InfAsBuiltProcess.py
===================================================================
--- trunk/BaseTools/Source/Python/UPT/Parser/InfAsBuiltProcess.py 2013-04-07 01:45:20 UTC (rev 2578)
+++ trunk/BaseTools/Source/Python/UPT/Parser/InfAsBuiltProcess.py 2013-04-07 01:50:50 UTC (rev 2579)
@@ -42,12 +42,12 @@
# @param WorkSpace. The WorkSpace directory used to combined with INF file path.
#
# @return GUID, Version
-def GetLibInstanceInfo(String, WorkSpace, LineNo):
-
+def GetLibInstanceInfo(String, WorkSpace, LineNo, CurrentInfFileName):
+
FileGuidString = ""
VerString = ""
-
- OrignalString = String
+
+ OrignalString = String
String = String.strip()
if not String:
return None, None
@@ -56,28 +56,48 @@
#
String = GetHelpStringByRemoveHashKey(String)
String = String.strip()
-
+
+ #
+ # To deal with library instance specified by GUID and version
+ #
+ RegFormatGuidPattern = re.compile("\s*([0-9a-fA-F]){8}-"
+ "([0-9a-fA-F]){4}-"
+ "([0-9a-fA-F]){4}-"
+ "([0-9a-fA-F]){4}-"
+ "([0-9a-fA-F]){12}\s*")
+ VersionPattern = re.compile('[\t\s]*\d+(\.\d+)?[\t\s]*')
+ GuidMatchedObj = RegFormatGuidPattern.search(String)
+
+ if String.upper().startswith('GUID') and GuidMatchedObj and 'Version' in String:
+ VersionStr = String[String.upper().find('VERSION') + 8:]
+ VersionMatchedObj = VersionPattern.search(VersionStr)
+ if VersionMatchedObj:
+ Guid = GuidMatchedObj.group().strip()
+ Version = VersionMatchedObj.group().strip()
+ return GetGuidVerFormLibInstance(Guid, Version, WorkSpace, CurrentInfFileName)
+
+ #
+ # To deal with library instance specified by file name
+ #
FileLinesList = GetFileLineContent(String, WorkSpace, LineNo, OrignalString)
-
+
ReFindFileGuidPattern = re.compile("^\s*FILE_GUID\s*=.*$")
ReFindVerStringPattern = re.compile("^\s*VERSION_STRING\s*=.*$")
-
- FileLinesList = ProcessLineExtender(FileLinesList)
for Line in FileLinesList:
if ReFindFileGuidPattern.match(Line):
FileGuidString = Line
if ReFindVerStringPattern.match(Line):
VerString = Line
-
+
if FileGuidString:
FileGuidString = GetSplitValueList(FileGuidString, '=', 1)[1]
if VerString:
VerString = GetSplitValueList(VerString, '=', 1)[1]
-
+
return FileGuidString, VerString
-
+
## GetPackageListInfo
#
# Get the package information from INF file.
@@ -184,36 +204,97 @@
#
# Validate file exist/format.
#
- if IsValidPath(FileName, WorkSpace):
- IsValidFileFlag = True
- else:
+ if not IsValidPath(FileName, WorkSpace):
Logger.Error("InfParser",
ToolError.FORMAT_INVALID,
ST.ERR_INF_PARSER_FILE_NOT_EXIST_OR_NAME_INVALID%(FileName),
File=GlobalData.gINF_MODULE_NAME,
Line=LineNo,
ExtraData=OriginalString)
- return False
FileLinesList = []
- if IsValidFileFlag:
+ try:
+ FullFileName = FullFileName.replace('\\', '/')
+ Inputfile = open(FullFileName, "rb", 0)
try:
- FullFileName = FullFileName.replace('\\', '/')
- Inputfile = open(FullFileName, "rb", 0)
- try:
- FileLinesList = Inputfile.readlines()
- except BaseException:
- Logger.Error("InfParser", ToolError.FILE_READ_FAILURE, ST.ERR_FILE_OPEN_FAILURE, File=FullFileName)
- finally:
- Inputfile.close()
+ FileLinesList = Inputfile.readlines()
except BaseException:
- Logger.Error("InfParser",
- ToolError.FILE_READ_FAILURE,
- ST.ERR_FILE_OPEN_FAILURE,
- File=FullFileName)
-
- FileLinesList = ProcessLineExtender(FileLinesList)
+ Logger.Error("InfParser", ToolError.FILE_READ_FAILURE, ST.ERR_FILE_OPEN_FAILURE, File=FullFileName)
+ finally:
+ Inputfile.close()
+ except BaseException:
+ Logger.Error("InfParser",
+ ToolError.FILE_READ_FAILURE,
+ ST.ERR_FILE_OPEN_FAILURE,
+ File=FullFileName)
+ FileLinesList = ProcessLineExtender(FileLinesList)
+
return FileLinesList
-
\ No newline at end of file
+
+##
+# Get all INF files from current workspace
+#
+#
+def GetInfsFromWorkSpace(WorkSpace):
+ InfFiles = []
+ for top, dirs, files in os.walk(WorkSpace):
+ dirs = dirs # just for pylint
+ for File in files:
+ if File.upper().endswith(".INF"):
+ InfFiles.append(os.path.join(top, File))
+
+ return InfFiles
+
+##
+# Get GUID and version from library instance file
+#
+#
+def GetGuidVerFormLibInstance(Guid, Version, WorkSpace, CurrentInfFileName):
+ for InfFile in GetInfsFromWorkSpace(WorkSpace):
+ try:
+ if InfFile.strip().upper() == CurrentInfFileName.strip().upper():
+ continue
+ InfFile = InfFile.replace('\\', '/')
+ if InfFile not in GlobalData.gLIBINSTANCEDICT:
+ InfFileObj = open(InfFile, "rb", 0)
+ GlobalData.gLIBINSTANCEDICT[InfFile] = InfFileObj
+ else:
+ InfFileObj = GlobalData.gLIBINSTANCEDICT[InfFile]
+
+ except BaseException:
+ Logger.Error("InfParser",
+ ToolError.FILE_READ_FAILURE,
+ ST.ERR_FILE_OPEN_FAILURE,
+ File=InfFile)
+ try:
+ FileLinesList = InfFileObj.readlines()
+ FileLinesList = ProcessLineExtender(FileLinesList)
+
+ ReFindFileGuidPattern = re.compile("^\s*FILE_GUID\s*=.*$")
+ ReFindVerStringPattern = re.compile("^\s*VERSION_STRING\s*=.*$")
+
+ for Line in FileLinesList:
+ if ReFindFileGuidPattern.match(Line):
+ FileGuidString = Line
+ if ReFindVerStringPattern.match(Line):
+ VerString = Line
+
+ if FileGuidString:
+ FileGuidString = GetSplitValueList(FileGuidString, '=', 1)[1]
+ if VerString:
+ VerString = GetSplitValueList(VerString, '=', 1)[1]
+
+ if FileGuidString.strip().upper() == Guid.upper() and \
+ VerString.strip().upper() == Version.upper():
+ return Guid, Version
+
+ except BaseException:
+ Logger.Error("InfParser", ToolError.FILE_READ_FAILURE, ST.ERR_FILE_OPEN_FAILURE, File=InfFile)
+ finally:
+ InfFileObj.close()
+
+ return '', ''
+
+
Modified: trunk/BaseTools/Source/Python/UPT/Parser/InfLibrarySectionParser.py
===================================================================
--- trunk/BaseTools/Source/Python/UPT/Parser/InfLibrarySectionParser.py 2013-04-07 01:45:20 UTC (rev 2578)
+++ trunk/BaseTools/Source/Python/UPT/Parser/InfLibrarySectionParser.py 2013-04-07 01:50:50 UTC (rev 2579)
@@ -170,28 +170,29 @@
File=FileName,
Line=LineNo,
ExtraData=LineContent)
-
+
if IsLibInstanceInfo(LineContent):
LibInsFlag = True
continue
-
+
if LibInsFlag:
- LibGuid, LibVer = GetLibInstanceInfo(LineContent, GlobalData.gWORKSPACE, LineNo)
+ LibGuid, LibVer = GetLibInstanceInfo(LineContent, GlobalData.gWORKSPACE, LineNo, FileName)
#
# If the VERSION_STRING is missing from the INF file, tool should default to "0".
#
if LibVer == '':
LibVer = '0'
if LibGuid != '':
- LibraryList.append((LibGuid, LibVer))
+ if (LibGuid, LibVer) not in LibraryList:
+ LibraryList.append((LibGuid, LibVer))
else:
- Logger.Error('InfParser',
+ Logger.Error('InfParser',
FORMAT_INVALID,
- ST.ERR_LIB_INSTANCE_MISS_GUID,
- File=FileName,
- Line=LineNo,
- ExtraData=LineContent)
-
+ ST.ERR_LIB_INSTANCE_MISS_GUID,
+ File=FileName,
+ Line=LineNo,
+ ExtraData=LineContent)
+
#
# Current section archs
#
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <hc...@us...> - 2013-12-16 07:30:13
|
Revision: 2627
http://sourceforge.net/p/edk2-buildtools/code/2627
Author: hchen30
Date: 2013-12-16 07:30:08 +0000 (Mon, 16 Dec 2013)
Log Message:
-----------
1. Deploy a full check for file header issues to make sure that the same checkpoints on different file types keep consistent.
Signed-off-by: Hess Chen <hes...@in...>
Reviewed-by: Liu, Yingke D <yin...@in...>
Reviewed-by: Feng, Bob C <bob...@in...>
Modified Paths:
--------------
trunk/BaseTools/Source/Python/UPT/Library/DataType.py
trunk/BaseTools/Source/Python/UPT/Logger/StringTable.py
trunk/BaseTools/Source/Python/UPT/Parser/DecParser.py
trunk/BaseTools/Source/Python/UPT/Parser/InfParser.py
Modified: trunk/BaseTools/Source/Python/UPT/Library/DataType.py
===================================================================
--- trunk/BaseTools/Source/Python/UPT/Library/DataType.py 2013-12-11 07:49:55 UTC (rev 2626)
+++ trunk/BaseTools/Source/Python/UPT/Library/DataType.py 2013-12-16 07:30:08 UTC (rev 2627)
@@ -1,7 +1,7 @@
## @file
# This file is used to define class for data type structure
#
-# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2011 - 2013, 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
@@ -340,6 +340,7 @@
TAB_BACK_SLASH = '/'
TAB_SPECIAL_COMMENT = '##'
TAB_HEADER_COMMENT = '@file'
+TAB_BINARY_HEADER_COMMENT = '@BinaryHeader'
TAB_STAR = "*"
TAB_EDK_SOURCE = '$(EDK_SOURCE)'
@@ -735,7 +736,12 @@
TAB_INF_PCD = 'Pcd'
TAB_INF_PCD_EX = 'PcdEx'
TAB_INF_GUIDTYPE_VAR = 'Variable'
-
+TAB_INF_ABSTRACT = 'STR_MODULE_ABSTRACT'
+TAB_INF_DESCRIPTION = 'STR_MODULE_DESCRIPTION'
+TAB_INF_LICENSE = 'STR_MODULE_LICENSE'
+TAB_INF_BINARY_ABSTRACT = 'STR_MODULE_BINARY_ABSTRACT'
+TAB_INF_BINARY_DESCRIPTION = 'STR_MODULE_BINARY_DESCRIPTION'
+TAB_INF_BINARY_LICENSE = 'STR_MODULE_BINARY_LICENSE'
#
# Dec Definitions
#
@@ -745,7 +751,12 @@
TAB_DEC_DEFINES_PACKAGE_GUID = 'PACKAGE_GUID'
TAB_DEC_DEFINES_PACKAGE_VERSION = 'PACKAGE_VERSION'
TAB_DEC_DEFINES_PKG_UNI_FILE = 'PKG_UNI_FILE'
-
+TAB_DEC_PACKAGE_ABSTRACT = 'STR_PACKAGE_ABSTRACT'
+TAB_DEC_PACKAGE_DESCRIPTION = 'STR_PACKAGE_DESCRIPTION'
+TAB_DEC_PACKAGE_LICENSE = 'STR_PACKAGE_LICENSE'
+TAB_DEC_BINARY_ABSTRACT = 'STR_PACKAGE_BINARY_ABSTRACT'
+TAB_DEC_BINARY_DESCRIPTION = 'STR_PACKAGE_BINARY_DESCRIPTION'
+TAB_DEC_BINARY_LICENSE = 'STR_PACKAGE_ASBUILT_LICENSE'
#
# Dsc Definitions
#
@@ -814,6 +825,8 @@
TAB_HEADER_DESCRIPTION = 'Description'
TAB_HEADER_COPYRIGHT = 'Copyright'
TAB_HEADER_LICENSE = 'License'
+TAB_BINARY_HEADER_IDENTIFIER = 'BinaryHeader'
+TAB_BINARY_HEADER_USERID = 'TianoCore'
#
# Build database path
#
Modified: trunk/BaseTools/Source/Python/UPT/Logger/StringTable.py
===================================================================
--- trunk/BaseTools/Source/Python/UPT/Logger/StringTable.py 2013-12-11 07:49:55 UTC (rev 2626)
+++ trunk/BaseTools/Source/Python/UPT/Logger/StringTable.py 2013-12-16 07:30:08 UTC (rev 2627)
@@ -530,6 +530,10 @@
_("Header comment section must have copyright information")
ERR_LICENSE_MISSING = \
_("Header comment section must have license information")
+ERR_INVALID_BINARYHEADER_FORMAT = \
+_("Binary Header comment section must have abstract,description,copyright,license information")
+ERR_MULTIPLE_BINARYHEADER_EXIST = \
+_("the inf file at most support one BinaryHeader at the fileheader section.")
ERR_INVALID_COMMENT_FORMAT = _("Comment must start with #")
ERR_USER_ABORT = _("User has stopped the application")
ERR_DIST_EXT_ERROR = \
@@ -547,6 +551,8 @@
ERR_NOT_SUPPORTED_SA_MODULE = _("Stand-alone module distribution does not allow EDK 1 INF")
ERR_INSTALL_DIST_NOT_FOUND = \
_("Distribution file to be installed is not found in current working directory or workspace: %s")
+ERR_BINARY_HEADER_ORDER = _("Binary header must follow the file header.")
+ERR_NO_SOURCE_HEADER = _("File header statement \"## @file\" must exist at the first place.")
#
# Expression error message
Modified: trunk/BaseTools/Source/Python/UPT/Parser/DecParser.py
===================================================================
--- trunk/BaseTools/Source/Python/UPT/Parser/DecParser.py 2013-12-11 07:49:55 UTC (rev 2626)
+++ trunk/BaseTools/Source/Python/UPT/Parser/DecParser.py 2013-12-16 07:30:08 UTC (rev 2627)
@@ -1,7 +1,7 @@
## @file
# This file is used to parse DEC file. It will consumed by DecParser
#
-# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2011 - 2013, 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
@@ -19,6 +19,7 @@
from Logger.ToolError import FILE_PARSE_FAILURE
from Logger.ToolError import FILE_OPEN_FAILURE
from Logger import StringTable as ST
+from Logger.ToolError import FORMAT_INVALID
import Library.DataType as DT
from Library.ParserValidate import IsValidToken
@@ -735,6 +736,7 @@
_DecComments.__init__(self)
_DecBase.__init__(self, RawData)
+ self.BinaryHeadComment = []
self._Define = _DecDefine(RawData)
self._Include = _DecInclude(RawData)
self._Guid = _DecGuid(RawData)
@@ -778,8 +780,13 @@
# Parse DEC file
#
def ParseDecComment(self):
+ IsFileHeader = False
+ IsBinaryHeader = False
+ FileHeaderLineIndex = -1
+ BinaryHeaderLineIndex = -1
while not self._RawData.IsEndOfFile():
Line, Comment = CleanString(self._RawData.GetNextLine())
+
#
# Header must be pure comment
#
@@ -787,14 +794,55 @@
self._RawData.UndoNextLine()
break
- if Comment:
+ if Comment and Comment.startswith(DT.TAB_SPECIAL_COMMENT) and Comment.find(DT.TAB_HEADER_COMMENT) > 0 \
+ and not Comment[2:Comment.find(DT.TAB_HEADER_COMMENT)].strip():
+ IsFileHeader = True
+ IsBinaryHeader = False
+ FileHeaderLineIndex = self._RawData.LineIndex
+
+ #
+ # Get license information before '@file'
+ #
+ if not IsFileHeader and not IsBinaryHeader and Comment and Comment.startswith(DT.TAB_COMMENT_SPLIT) and \
+ DT.TAB_BINARY_HEADER_COMMENT not in Comment:
self._HeadComment.append((Comment, self._RawData.LineIndex))
+
+ if Comment and IsFileHeader and \
+ not(Comment.startswith(DT.TAB_SPECIAL_COMMENT) \
+ and Comment.find(DT.TAB_BINARY_HEADER_COMMENT) > 0):
+ self._HeadComment.append((Comment, self._RawData.LineIndex))
#
# Double '#' indicates end of header comments
#
- if not Comment or Comment == DT.TAB_SPECIAL_COMMENT:
+ if (not Comment or Comment == DT.TAB_SPECIAL_COMMENT) and IsFileHeader:
+ IsFileHeader = False
+ continue
+
+ if Comment and Comment.startswith(DT.TAB_SPECIAL_COMMENT) \
+ and Comment.find(DT.TAB_BINARY_HEADER_COMMENT) > 0:
+ IsBinaryHeader = True
+ IsFileHeader = False
+ BinaryHeaderLineIndex = self._RawData.LineIndex
+
+ if Comment and IsBinaryHeader:
+ self.BinaryHeadComment.append((Comment, self._RawData.LineIndex))
+ #
+ # Double '#' indicates end of header comments
+ #
+ if (not Comment or Comment == DT.TAB_SPECIAL_COMMENT) and IsBinaryHeader:
+ IsBinaryHeader = False
break
-
+
+ if FileHeaderLineIndex > -1 and not IsFileHeader and not IsBinaryHeader:
+ break
+
+ if FileHeaderLineIndex > BinaryHeaderLineIndex and FileHeaderLineIndex > -1 and BinaryHeaderLineIndex > -1:
+ self._LoggerError(ST.ERR_BINARY_HEADER_ORDER)
+
+ if FileHeaderLineIndex == -1:
+ Logger.Error(TOOL_NAME, FORMAT_INVALID,
+ ST.ERR_NO_SOURCE_HEADER,
+ File=self._RawData.Filename)
return
def _StopCurrentParsing(self, Line):
Modified: trunk/BaseTools/Source/Python/UPT/Parser/InfParser.py
===================================================================
--- trunk/BaseTools/Source/Python/UPT/Parser/InfParser.py 2013-12-11 07:49:55 UTC (rev 2626)
+++ trunk/BaseTools/Source/Python/UPT/Parser/InfParser.py 2013-12-16 07:30:08 UTC (rev 2627)
@@ -1,7 +1,7 @@
## @file
# This file contained the parser for INF file
#
-# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2011 - 2013, 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
@@ -128,6 +128,10 @@
#
HeaderCommentStart = False
HeaderCommentEnd = False
+ HeaderStarLineNo = -1
+ BinaryHeaderCommentStart = False
+ BinaryHeaderCommentEnd = False
+ BinaryHeaderStarLineNo = -1
#
# While Section ends. parse whole section contents.
@@ -196,22 +200,16 @@
#
if Line.startswith(DT.TAB_SPECIAL_COMMENT) and \
(Line.find(DT.TAB_HEADER_COMMENT) > -1) and \
- not HeaderCommentStart:
- if CurrentSection != DT.MODEL_UNKNOWN:
- Logger.Error("Parser",
- PARSER_ERROR,
- ST.ERR_INF_PARSER_HEADER_FILE,
- File=Filename,
- Line=LineNo,
- RaiseError = Logger.IS_RAISE_ERROR)
- else:
- CurrentSection = DT.MODEL_META_DATA_FILE_HEADER
- #
- # Append the first line to section lines.
- #
- SectionLines.append((Line, LineNo))
- HeaderCommentStart = True
- continue
+ not HeaderCommentStart and not HeaderCommentEnd:
+
+ CurrentSection = DT.MODEL_META_DATA_FILE_HEADER
+ #
+ # Append the first line to section lines.
+ #
+ HeaderStarLineNo = LineNo
+ SectionLines.append((Line, LineNo))
+ HeaderCommentStart = True
+ continue
#
# Collect Header content.
@@ -226,17 +224,72 @@
#
if (Line.startswith(DT.TAB_SPECIAL_COMMENT) or not Line.strip().startswith("#")) and HeaderCommentStart \
and not HeaderCommentEnd:
- SectionLines.append((Line, LineNo))
+ HeaderCommentEnd = True
+ BinaryHeaderCommentStart = False
+ BinaryHeaderCommentEnd = False
HeaderCommentStart = False
+ if Line.find(DT.TAB_BINARY_HEADER_COMMENT) > -1:
+ self.InfHeaderParser(SectionLines, self.InfHeader, self.FileName)
+ SectionLines = []
+ else:
+ SectionLines.append((Line, LineNo))
#
# Call Header comment parser.
#
self.InfHeaderParser(SectionLines, self.InfHeader, self.FileName)
SectionLines = []
+ continue
+
+ #
+ # check whether binary header comment section started
+ #
+ if Line.startswith(DT.TAB_SPECIAL_COMMENT) and \
+ (Line.find(DT.TAB_BINARY_HEADER_COMMENT) > -1) and \
+ not BinaryHeaderCommentStart:
+ SectionLines = []
+ CurrentSection = DT.MODEL_META_DATA_FILE_HEADER
+ #
+ # Append the first line to section lines.
+ #
+ BinaryHeaderStarLineNo = LineNo
+ SectionLines.append((Line, LineNo))
+ BinaryHeaderCommentStart = True
HeaderCommentEnd = True
continue
#
+ # check whether there are more than one binary header exist
+ #
+ if Line.startswith(DT.TAB_SPECIAL_COMMENT) and BinaryHeaderCommentStart and \
+ not BinaryHeaderCommentEnd and (Line.find(DT.TAB_BINARY_HEADER_COMMENT) > -1):
+ Logger.Error('Parser',
+ FORMAT_INVALID,
+ ST.ERR_MULTIPLE_BINARYHEADER_EXIST,
+ File=Filename)
+
+ #
+ # Collect Binary Header content.
+ #
+ if (Line.startswith(DT.TAB_COMMENT_SPLIT) and CurrentSection == DT.MODEL_META_DATA_FILE_HEADER) and\
+ BinaryHeaderCommentStart and not Line.startswith(DT.TAB_SPECIAL_COMMENT) and not\
+ BinaryHeaderCommentEnd and NextLine != '':
+ SectionLines.append((Line, LineNo))
+ continue
+ #
+ # Binary Header content end
+ #
+ if (Line.startswith(DT.TAB_SPECIAL_COMMENT) or not Line.strip().startswith(DT.TAB_COMMENT_SPLIT)) and \
+ BinaryHeaderCommentStart and not BinaryHeaderCommentEnd:
+ SectionLines.append((Line, LineNo))
+ BinaryHeaderCommentStart = False
+ #
+ # Call Binary Header comment parser.
+ #
+ self.InfHeaderParser(SectionLines, self.InfBinaryHeader, self.FileName, True)
+ SectionLines = []
+ BinaryHeaderCommentEnd = True
+ continue
+ #
# Find a new section tab
# Or at the last line of INF file,
# need to process the last section.
@@ -255,6 +308,10 @@
#
if (Line.startswith(DT.TAB_SECTION_START) and \
Line.find(DT.TAB_SECTION_END) > -1) or LastSectionFalg:
+
+ HeaderCommentEnd = True
+ BinaryHeaderCommentEnd = True
+
if not LastSectionFalg:
#
# check to prevent '#' inside section header
@@ -333,18 +390,17 @@
# Clear section lines
#
SectionLines = []
- #
- # End of for
- #
- #
- # Found the first section, No file header.
- #
- if DefineSectionParsedFlag and not HeaderCommentEnd:
+
+ if HeaderStarLineNo == -1:
Logger.Error("InfParser",
FORMAT_INVALID,
- ST.ERR_INF_PARSER_HEADER_MISSGING,
+ ST.ERR_NO_SOURCE_HEADER,
File=self.FullPath)
-
+ if BinaryHeaderStarLineNo > -1 and HeaderStarLineNo > -1 and HeaderStarLineNo > BinaryHeaderStarLineNo:
+ Logger.Error("InfParser",
+ FORMAT_INVALID,
+ ST.ERR_BINARY_HEADER_ORDER,
+ File=self.FullPath)
#
# EDKII INF should not have EDKI style comment
#
@@ -627,4 +683,4 @@
SectionType = gINF_SECTION_DEF[SectionName.upper()]
return SectionType
-
\ No newline at end of file
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <hc...@us...> - 2014-02-26 00:34:58
|
Revision: 2655
http://sourceforge.net/p/edk2-buildtools/code/2655
Author: hchen30
Date: 2014-02-26 00:34:46 +0000 (Wed, 26 Feb 2014)
Log Message:
-----------
[SVN commit log]
1. Support UPT to handle multiple arch in one section for binary files to find their PCDs
2. Support UPT to handle specific arch binary file to find PCDs defined in COMMON
Modified Paths:
--------------
trunk/BaseTools/Source/Python/UPT/Library/String.py
trunk/BaseTools/Source/Python/UPT/Xml/ModuleSurfaceAreaXml.py
Modified: trunk/BaseTools/Source/Python/UPT/Library/String.py
===================================================================
--- trunk/BaseTools/Source/Python/UPT/Library/String.py 2014-02-24 14:18:37 UTC (rev 2654)
+++ trunk/BaseTools/Source/Python/UPT/Library/String.py 2014-02-26 00:34:46 UTC (rev 2655)
@@ -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 @@
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
Modified: trunk/BaseTools/Source/Python/UPT/Xml/ModuleSurfaceAreaXml.py
===================================================================
--- trunk/BaseTools/Source/Python/UPT/Xml/ModuleSurfaceAreaXml.py 2014-02-24 14:18:37 UTC (rev 2654)
+++ trunk/BaseTools/Source/Python/UPT/Xml/ModuleSurfaceAreaXml.py 2014-02-26 00:34:46 UTC (rev 2655)
@@ -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 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 @@
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 @@
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:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|