From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.100; helo=mga07.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 340F42096966D for ; Mon, 14 May 2018 11:09:25 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 May 2018 11:09:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,401,1520924400"; d="scan'208";a="55814261" Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga001.jf.intel.com with ESMTP; 14 May 2018 11:09:23 -0700 From: Jaben Carsey To: edk2-devel@lists.01.org Cc: Liming Gao , Yonghong Zhu Date: Mon, 14 May 2018 11:09:12 -0700 Message-Id: X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [PATCH v1 03/11] BaseTools: remove unused code X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 May 2018 18:09:25 -0000 delete commented out code delete never used class/variable/function/import refactor to remove Ffs class dont construct class just for class attribute Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/AutoGen/GenMake.py | 17 ++-- BaseTools/Source/Python/CommonDataClass/DataClass.py | 47 +---------- BaseTools/Source/Python/Ecc/Database.py | 76 +---------------- BaseTools/Source/Python/Ecc/c.py | 1 - BaseTools/Source/Python/GenFds/CapsuleData.py | 1 - BaseTools/Source/Python/GenFds/CompressSection.py | 6 +- BaseTools/Source/Python/GenFds/DataSection.py | 4 +- BaseTools/Source/Python/GenFds/DepexSection.py | 1 - BaseTools/Source/Python/GenFds/EfiSection.py | 16 ++-- BaseTools/Source/Python/GenFds/Ffs.py | 88 ++++++++------------ BaseTools/Source/Python/GenFds/FfsFileStatement.py | 4 +- BaseTools/Source/Python/GenFds/FfsInfStatement.py | 10 +-- BaseTools/Source/Python/GenFds/Fv.py | 1 - BaseTools/Source/Python/GenFds/FvImageSection.py | 6 +- BaseTools/Source/Python/GenFds/GuidSection.py | 4 +- BaseTools/Source/Python/GenFds/OptRomInfStatement.py | 7 +- BaseTools/Source/Python/GenFds/UiSection.py | 6 +- BaseTools/Source/Python/GenFds/VerSection.py | 6 +- BaseTools/Source/Python/Workspace/WorkspaceDatabase.py | 18 ++-- BaseTools/Source/Python/build/build.py | 2 +- 20 files changed, 81 insertions(+), 240 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py index 68ec9a817133..1c8ab7fe1ec8 100644 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -74,8 +74,6 @@ class BuildFile(object): ## template used to generate the build file (i.e. makefile if using make) _TEMPLATE_ = TemplateString('') - _DEFAULT_FILE_NAME_ = "Makefile" - ## default file name for each type of build file _FILE_NAME_ = { "nmake" : "Makefile", @@ -151,23 +149,18 @@ class BuildFile(object): "gmake" : "test -f %(Src)s && $(CP) %(Src)s %(Dst)s" } - _CD_TEMPLATE_ = { - "nmake" : 'if exist %(dir)s cd %(dir)s', - "gmake" : "test -e %(dir)s && cd %(dir)s" - } - _MAKE_TEMPLATE_ = { "nmake" : 'if exist %(file)s "$(MAKE)" $(MAKE_FLAGS) -f %(file)s', "gmake" : 'test -e %(file)s && "$(MAKE)" $(MAKE_FLAGS) -f %(file)s' } - _INCLUDE_CMD_ = { - "nmake" : '!INCLUDE', - "gmake" : "include" + _INC_FLAG_ = { + "MSFT" : "/I", + "GCC" : "-I", + "INTEL" : "-I", + "RVCT" : "-I" } - _INC_FLAG_ = {"MSFT" : "/I", "GCC" : "-I", "INTEL" : "-I", "RVCT" : "-I"} - ## Constructor of BuildFile # # @param AutoGenObject Object of AutoGen class diff --git a/BaseTools/Source/Python/CommonDataClass/DataClass.py b/BaseTools/Source/Python/CommonDataClass/DataClass.py index 31ed46c7ec56..ddf3270ad8a5 100644 --- a/BaseTools/Source/Python/CommonDataClass/DataClass.py +++ b/BaseTools/Source/Python/CommonDataClass/DataClass.py @@ -1,7 +1,7 @@ ## @file # This file is used to define class for data structure used in ECC # -# Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.
# 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 @@ -290,51 +290,6 @@ class IdentifierClass(object): self.EndLine = EndLine self.EndColumn = EndColumn -## PcdClass -# -# This class defines a structure of a Pcd -# -# @param ID: ID of a Pcd -# @param CName: CName of a Pcd -# @param TokenSpaceGuidCName: TokenSpaceGuidCName of a Pcd -# @param Token: Token of a Pcd -# @param DatumType: DatumType of a Pcd -# @param Model: Model of a Pcd -# @param BelongsToFile: The Pcd belongs to which file -# @param BelongsToFunction: The Pcd belongs to which function -# @param StartLine: StartLine of a Pcd -# @param StartColumn: StartColumn of a Pcd -# @param EndLine: EndLine of a Pcd -# @param EndColumn: EndColumn of a Pcd -# -# @var ID: ID of a Pcd -# @var CName: CName of a Pcd -# @var TokenSpaceGuidCName: TokenSpaceGuidCName of a Pcd -# @var Token: Token of a Pcd -# @var DatumType: DatumType of a Pcd -# @var Model: Model of a Pcd -# @var BelongsToFile: The Pcd belongs to which file -# @var BelongsToFunction: The Pcd belongs to which function -# @var StartLine: StartLine of a Pcd -# @var StartColumn: StartColumn of a Pcd -# @var EndLine: EndLine of a Pcd -# @var EndColumn: EndColumn of a Pcd -# -class PcdDataClass(object): - def __init__(self, ID = -1, CName = '', TokenSpaceGuidCName = '', Token = '', DatumType = '', Model = MODEL_UNKNOWN, \ - BelongsToFile = -1, BelongsToFunction = -1, StartLine = -1, StartColumn = -1, EndLine = -1, EndColumn = -1): - self.ID = ID - self.CName = CName - self.TokenSpaceGuidCName = TokenSpaceGuidCName - self.Token = Token - self.DatumType = DatumType - self.BelongsToFile = BelongsToFile - self.BelongsToFunction = BelongsToFunction - self.StartLine = StartLine - self.StartColumn = StartColumn - self.EndLine = EndLine - self.EndColumn = EndColumn - ## FileClass # # This class defines a structure of a file diff --git a/BaseTools/Source/Python/Ecc/Database.py b/BaseTools/Source/Python/Ecc/Database.py index 204117512452..dbc699502934 100644 --- a/BaseTools/Source/Python/Ecc/Database.py +++ b/BaseTools/Source/Python/Ecc/Database.py @@ -1,7 +1,7 @@ ## @file # This file is used to create a database used by ECC tool # -# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
# 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 @@ -211,59 +211,6 @@ class Database(object): EdkLogger.verbose("Insert information from file %s ... DONE!" % File.FullPath) - ## UpdateIdentifierBelongsToFunction - # - # Update the field "BelongsToFunction" for each Indentifier - # - # - def UpdateIdentifierBelongsToFunction_disabled(self): - EdkLogger.verbose("Update 'BelongsToFunction' for Identifiers started ...") - - SqlCommand = """select ID, BelongsToFile, StartLine, EndLine, Model from Identifier""" - EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand) - self.Cur.execute(SqlCommand) - Records = self.Cur.fetchall() - for Record in Records: - IdentifierID = Record[0] - BelongsToFile = Record[1] - StartLine = Record[2] - EndLine = Record[3] - Model = Record[4] - - # - # Check whether an identifier belongs to a function - # - EdkLogger.debug(4, "For common identifiers ... ") - SqlCommand = """select ID from Function - where StartLine < %s and EndLine > %s - and BelongsToFile = %s""" % (StartLine, EndLine, BelongsToFile) - EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand) - self.Cur.execute(SqlCommand) - IDs = self.Cur.fetchall() - for ID in IDs: - SqlCommand = """Update Identifier set BelongsToFunction = %s where ID = %s""" % (ID[0], IdentifierID) - EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand) - self.Cur.execute(SqlCommand) - - # - # Check whether the identifier is a function header - # - EdkLogger.debug(4, "For function headers ... ") - if Model == DataClass.MODEL_IDENTIFIER_COMMENT: - SqlCommand = """select ID from Function - where StartLine = %s + 1 - and BelongsToFile = %s""" % (EndLine, BelongsToFile) - EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand) - self.Cur.execute(SqlCommand) - IDs = self.Cur.fetchall() - for ID in IDs: - SqlCommand = """Update Identifier set BelongsToFunction = %s, Model = %s where ID = %s""" % (ID[0], DataClass.MODEL_IDENTIFIER_FUNCTION_HEADER, IdentifierID) - EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand) - self.Cur.execute(SqlCommand) - - EdkLogger.verbose("Update 'BelongsToFunction' for Identifiers ... DONE") - - ## UpdateIdentifierBelongsToFunction # # Update the field "BelongsToFunction" for each Indentifier @@ -281,8 +228,6 @@ class Database(object): BelongsToFile = Record[1] StartLine = Record[2] EndLine = Record[3] - #Data1.append(("'file%s'" % BelongsToFile, FunctionID, BelongsToFile, StartLine, EndLine)) - #Data2.append(("'file%s'" % BelongsToFile, FunctionID, DataClass.MODEL_IDENTIFIER_FUNCTION_HEADER, BelongsToFile, DataClass.MODEL_IDENTIFIER_COMMENT, StartLine - 1)) SqlCommand = """Update Identifier%s set BelongsToFunction = %s where BelongsToFile = %s and StartLine > %s and EndLine < %s""" % \ (BelongsToFile, FunctionID, BelongsToFile, StartLine, EndLine) @@ -291,25 +236,6 @@ class Database(object): SqlCommand = """Update Identifier%s set BelongsToFunction = %s, Model = %s where BelongsToFile = %s and Model = %s and EndLine = %s""" % \ (BelongsToFile, FunctionID, DataClass.MODEL_IDENTIFIER_FUNCTION_HEADER, BelongsToFile, DataClass.MODEL_IDENTIFIER_COMMENT, StartLine - 1) self.TblIdentifier.Exec(SqlCommand) -# # -# # Check whether an identifier belongs to a function -# # -# print Data1 -# SqlCommand = """Update ? set BelongsToFunction = ? where BelongsToFile = ? and StartLine > ? and EndLine < ?""" -# print SqlCommand -# EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand) -# self.Cur.executemany(SqlCommand, Data1) -# -# # -# # Check whether the identifier is a function header -# # -# EdkLogger.debug(4, "For function headers ... ") -# SqlCommand = """Update ? set BelongsToFunction = ?, Model = ? where BelongsToFile = ? and Model = ? and EndLine = ?""" -# EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand) -# self.Cur.executemany(SqlCommand, Data2) -# -# EdkLogger.verbose("Update 'BelongsToFunction' for Identifiers ... DONE") - ## # diff --git a/BaseTools/Source/Python/Ecc/c.py b/BaseTools/Source/Python/Ecc/c.py index 93ee1990ba28..bc72abdce477 100644 --- a/BaseTools/Source/Python/Ecc/c.py +++ b/BaseTools/Source/Python/Ecc/c.py @@ -18,7 +18,6 @@ import string import CodeFragmentCollector import FileProfile from CommonDataClass import DataClass -import Database from Common import EdkLogger from EccToolError import * import EccGlobalData diff --git a/BaseTools/Source/Python/GenFds/CapsuleData.py b/BaseTools/Source/Python/GenFds/CapsuleData.py index b376d6b2e9be..dd4c27bd15c7 100644 --- a/BaseTools/Source/Python/GenFds/CapsuleData.py +++ b/BaseTools/Source/Python/GenFds/CapsuleData.py @@ -15,7 +15,6 @@ ## # Import Modules # -import Ffs from GenFdsGlobalVariable import GenFdsGlobalVariable import StringIO from struct import pack diff --git a/BaseTools/Source/Python/GenFds/CompressSection.py b/BaseTools/Source/Python/GenFds/CompressSection.py index 4ae14f27b3e1..cdae74c52fd9 100644 --- a/BaseTools/Source/Python/GenFds/CompressSection.py +++ b/BaseTools/Source/Python/GenFds/CompressSection.py @@ -1,7 +1,7 @@ ## @file # process compress section generation # -# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -15,7 +15,7 @@ ## # Import Modules # -from Ffs import Ffs +from Ffs import SectionSuffix import Section import subprocess import Common.LongFilePathOs as os @@ -85,7 +85,7 @@ class CompressSection (CompressSectionClassObject) : ModuleName + \ SUP_MODULE_SEC + \ SecNum + \ - Ffs.SectionSuffix['COMPRESS'] + SectionSuffix['COMPRESS'] OutputFile = os.path.normpath(OutputFile) DummyFile = OutputFile + '.dummy' GenFdsGlobalVariable.GenerateSection(DummyFile, SectFiles, InputAlign=SectAlign, IsMakefile=IsMakefile) diff --git a/BaseTools/Source/Python/GenFds/DataSection.py b/BaseTools/Source/Python/GenFds/DataSection.py index 29caa00c0d8d..f0e5efab4178 100644 --- a/BaseTools/Source/Python/GenFds/DataSection.py +++ b/BaseTools/Source/Python/GenFds/DataSection.py @@ -18,7 +18,7 @@ import Section from GenFdsGlobalVariable import GenFdsGlobalVariable import subprocess -from Ffs import Ffs +from Ffs import SectionSuffix import Common.LongFilePathOs as os from CommonDataClass.FdfClass import DataSectionClassObject from Common.Misc import PeImageClass @@ -120,7 +120,7 @@ class DataSection (DataSectionClassObject): ) self.SectFileName = TeFile - OutputFile = os.path.join (OutputPath, ModuleName + SUP_MODULE_SEC + SecNum + Ffs.SectionSuffix.get(self.SecType)) + OutputFile = os.path.join (OutputPath, ModuleName + 'SEC' + SecNum + SectionSuffix.get(self.SecType)) OutputFile = os.path.normpath(OutputFile) GenFdsGlobalVariable.GenerateSection(OutputFile, [self.SectFileName], Section.Section.SectionType.get(self.SecType), IsMakefile = IsMakefile) FileList = [OutputFile] diff --git a/BaseTools/Source/Python/GenFds/DepexSection.py b/BaseTools/Source/Python/GenFds/DepexSection.py index f42162d5a27e..6e63cb97e51d 100644 --- a/BaseTools/Source/Python/GenFds/DepexSection.py +++ b/BaseTools/Source/Python/GenFds/DepexSection.py @@ -18,7 +18,6 @@ import Section from GenFdsGlobalVariable import GenFdsGlobalVariable import subprocess -from Ffs import Ffs import Common.LongFilePathOs as os from CommonDataClass.FdfClass import DepexSectionClassObject from AutoGen.GenDepex import DependencyExpression diff --git a/BaseTools/Source/Python/GenFds/EfiSection.py b/BaseTools/Source/Python/GenFds/EfiSection.py index 5405d0a8da13..0064196a5a4e 100644 --- a/BaseTools/Source/Python/GenFds/EfiSection.py +++ b/BaseTools/Source/Python/GenFds/EfiSection.py @@ -19,7 +19,7 @@ from struct import * import Section from GenFdsGlobalVariable import GenFdsGlobalVariable import subprocess -from Ffs import Ffs +from Ffs import SectionSuffix import Common.LongFilePathOs as os from CommonDataClass.FdfClass import EfiSectionClassObject from Common import EdkLogger @@ -123,7 +123,7 @@ class EfiSection (EfiSectionClassObject): BuildNumTuple = tuple() Num = SecNum - OutputFile = os.path.join( OutputPath, ModuleName + SUP_MODULE_SEC + str(Num) + Ffs.SectionSuffix.get(SectionType)) + OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + str(Num) + SectionSuffix.get(SectionType)) GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_VERSION', #Ui=StringData, Ver=BuildNum, @@ -134,7 +134,7 @@ class EfiSection (EfiSectionClassObject): for File in FileList: Index = Index + 1 Num = '%s.%d' %(SecNum , Index) - OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + Num + Ffs.SectionSuffix.get(SectionType)) + OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + Num + SectionSuffix.get(SectionType)) f = open(File, 'r') VerString = f.read() f.close() @@ -163,7 +163,7 @@ class EfiSection (EfiSectionClassObject): else: EdkLogger.error("GenFds", GENFDS_ERROR, "File: %s miss Version Section value" %InfFileName) Num = SecNum - OutputFile = os.path.join( OutputPath, ModuleName + SUP_MODULE_SEC + str(Num) + Ffs.SectionSuffix.get(SectionType)) + OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + str(Num) + SectionSuffix.get(SectionType)) GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_VERSION', #Ui=VerString, Ver=BuildNum, @@ -184,7 +184,7 @@ class EfiSection (EfiSectionClassObject): Num = SecNum if IsMakefile and StringData == ModuleNameStr: StringData = "$(MODULE_NAME)" - OutputFile = os.path.join( OutputPath, ModuleName + SUP_MODULE_SEC + str(Num) + Ffs.SectionSuffix.get(SectionType)) + OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + str(Num) + SectionSuffix.get(SectionType)) GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_USER_INTERFACE', Ui=StringData, IsMakefile=IsMakefile) OutputFileList.append(OutputFile) @@ -193,7 +193,7 @@ class EfiSection (EfiSectionClassObject): for File in FileList: Index = Index + 1 Num = '%s.%d' %(SecNum , Index) - OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + Num + Ffs.SectionSuffix.get(SectionType)) + OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + Num + SectionSuffix.get(SectionType)) f = open(File, 'r') UiString = f.read() f.close() @@ -217,7 +217,7 @@ class EfiSection (EfiSectionClassObject): Num = SecNum if IsMakefile and StringData == ModuleNameStr: StringData = "$(MODULE_NAME)" - OutputFile = os.path.join( OutputPath, ModuleName + SUP_MODULE_SEC + str(Num) + Ffs.SectionSuffix.get(SectionType)) + OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + str(Num) + SectionSuffix.get(SectionType)) GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_SECTION_USER_INTERFACE', Ui=StringData, IsMakefile=IsMakefile) OutputFileList.append(OutputFile) @@ -238,7 +238,7 @@ class EfiSection (EfiSectionClassObject): """ Copy Map file to FFS output path """ Index = Index + 1 Num = '%s.%d' %(SecNum , Index) - OutputFile = os.path.join( OutputPath, ModuleName + SUP_MODULE_SEC + Num + Ffs.SectionSuffix.get(SectionType)) + OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + Num + SectionSuffix.get(SectionType)) File = GenFdsGlobalVariable.MacroExtend(File, Dict) #Get PE Section alignment when align is set to AUTO diff --git a/BaseTools/Source/Python/GenFds/Ffs.py b/BaseTools/Source/Python/GenFds/Ffs.py index df585f3d819b..12d4dfe1b04c 100644 --- a/BaseTools/Source/Python/GenFds/Ffs.py +++ b/BaseTools/Source/Python/GenFds/Ffs.py @@ -1,7 +1,7 @@ ## @file # process FFS generation # -# Copyright (c) 2007-2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -12,56 +12,40 @@ # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # -## -# Import Modules -# -from CommonDataClass.FdfClass import FDClassObject from Common.DataType import * +# mapping between FILE type in FDF and file type for GenFfs +FdfFvFileTypeToFileType = { + SUP_MODULE_SEC : 'EFI_FV_FILETYPE_SECURITY_CORE', + SUP_MODULE_PEI_CORE : 'EFI_FV_FILETYPE_PEI_CORE', + SUP_MODULE_PEIM : 'EFI_FV_FILETYPE_PEIM', + SUP_MODULE_DXE_CORE : 'EFI_FV_FILETYPE_DXE_CORE', + 'FREEFORM' : 'EFI_FV_FILETYPE_FREEFORM', + 'DRIVER' : 'EFI_FV_FILETYPE_DRIVER', + 'APPLICATION' : 'EFI_FV_FILETYPE_APPLICATION', + 'FV_IMAGE' : 'EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE', + 'RAW' : 'EFI_FV_FILETYPE_RAW', + 'PEI_DXE_COMBO' : 'EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER', + 'SMM' : 'EFI_FV_FILETYPE_SMM', + SUP_MODULE_SMM_CORE : 'EFI_FV_FILETYPE_SMM_CORE', + SUP_MODULE_MM_STANDALONE : 'EFI_FV_FILETYPE_MM_STANDALONE', + SUP_MODULE_MM_CORE_STANDALONE : 'EFI_FV_FILETYPE_MM_CORE_STANDALONE' +} -## generate FFS -# -# -class Ffs(FDClassObject): - # mapping between FILE type in FDF and file type for GenFfs - FdfFvFileTypeToFileType = { - SUP_MODULE_SEC : 'EFI_FV_FILETYPE_SECURITY_CORE', - SUP_MODULE_PEI_CORE : 'EFI_FV_FILETYPE_PEI_CORE', - SUP_MODULE_PEIM : 'EFI_FV_FILETYPE_PEIM', - SUP_MODULE_DXE_CORE : 'EFI_FV_FILETYPE_DXE_CORE', - 'FREEFORM' : 'EFI_FV_FILETYPE_FREEFORM', - 'DRIVER' : 'EFI_FV_FILETYPE_DRIVER', - 'APPLICATION' : 'EFI_FV_FILETYPE_APPLICATION', - 'FV_IMAGE' : 'EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE', - 'RAW' : 'EFI_FV_FILETYPE_RAW', - 'PEI_DXE_COMBO' : 'EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER', - 'SMM' : 'EFI_FV_FILETYPE_SMM', - SUP_MODULE_SMM_CORE : 'EFI_FV_FILETYPE_SMM_CORE', - SUP_MODULE_MM_STANDALONE : 'EFI_FV_FILETYPE_MM_STANDALONE', - SUP_MODULE_MM_CORE_STANDALONE : 'EFI_FV_FILETYPE_MM_CORE_STANDALONE' - } - - # mapping between section type in FDF and file suffix - SectionSuffix = { - BINARY_FILE_TYPE_PE32 : '.pe32', - BINARY_FILE_TYPE_PIC : '.pic', - BINARY_FILE_TYPE_TE : '.te', - BINARY_FILE_TYPE_DXE_DEPEX : '.dpx', - 'VERSION' : '.ver', - BINARY_FILE_TYPE_UI : '.ui', - 'COMPAT16' : '.com16', - 'RAW' : '.raw', - 'FREEFORM_SUBTYPE_GUID': '.guid', - 'SUBTYPE_GUID' : '.guid', - 'FV_IMAGE' : 'fv.sec', - 'COMPRESS' : '.com', - 'GUIDED' : '.guided', - BINARY_FILE_TYPE_PEI_DEPEX : '.dpx', - BINARY_FILE_TYPE_SMM_DEPEX : '.dpx' - } - - ## The constructor - # - # @param self The object pointer - # - def __init__(self): - FfsClassObject.__init__(self) +# mapping between section type in FDF and file suffix +SectionSuffix = { + BINARY_FILE_TYPE_PE32 : '.pe32', + BINARY_FILE_TYPE_PIC : '.pic', + BINARY_FILE_TYPE_TE : '.te', + BINARY_FILE_TYPE_DXE_DEPEX : '.dpx', + 'VERSION' : '.ver', + BINARY_FILE_TYPE_UI : '.ui', + 'COMPAT16' : '.com16', + 'RAW' : '.raw', + 'FREEFORM_SUBTYPE_GUID': '.guid', + 'SUBTYPE_GUID' : '.guid', + 'FV_IMAGE' : 'fv.sec', + 'COMPRESS' : '.com', + 'GUIDED' : '.guided', + BINARY_FILE_TYPE_PEI_DEPEX : '.dpx', + BINARY_FILE_TYPE_SMM_DEPEX : '.dpx' +} diff --git a/BaseTools/Source/Python/GenFds/FfsFileStatement.py b/BaseTools/Source/Python/GenFds/FfsFileStatement.py index ba8e0465ef34..871499d3d2ad 100644 --- a/BaseTools/Source/Python/GenFds/FfsFileStatement.py +++ b/BaseTools/Source/Python/GenFds/FfsFileStatement.py @@ -15,7 +15,7 @@ ## # Import Modules # -import Ffs +from Ffs import FdfFvFileTypeToFileType import Rule import Common.LongFilePathOs as os import StringIO @@ -167,7 +167,7 @@ class FileStatement (FileStatementClassObject) : # FfsFileOutput = os.path.join(OutputDir, self.NameGuid + '.ffs') GenFdsGlobalVariable.GenerateFfs(FfsFileOutput, SectionFiles, - Ffs.Ffs.FdfFvFileTypeToFileType.get(self.FvFileType), + FdfFvFileTypeToFileType.get(self.FvFileType), self.NameGuid, Fixed=self.Fixed, CheckSum=self.CheckSum, diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py b/BaseTools/Source/Python/GenFds/FfsInfStatement.py index c332eee6079d..f76563d736f6 100644 --- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py +++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py @@ -21,7 +21,7 @@ import Common.LongFilePathOs as os import StringIO from struct import * from GenFdsGlobalVariable import GenFdsGlobalVariable -import Ffs +from Ffs import FdfFvFileTypeToFileType,SectionSuffix import subprocess import sys import Section @@ -761,7 +761,7 @@ class FfsInfStatement(FfsInfStatementClassObject): SecNum = '%d' %Index GenSecOutputFile= self.__ExtendMacro__(Rule.NameGuid) + \ - Ffs.Ffs.SectionSuffix[SectionType] + SUP_MODULE_SEC + SecNum + SectionSuffix[SectionType] + 'SEC' + SecNum Index = Index + 1 OutputFile = os.path.join(self.OutputPath, GenSecOutputFile) File = GenFdsGlobalVariable.MacroExtend(File, Dict, self.CurrentArch) @@ -804,7 +804,7 @@ class FfsInfStatement(FfsInfStatementClassObject): else: SecNum = '%d' %Index GenSecOutputFile= self.__ExtendMacro__(Rule.NameGuid) + \ - Ffs.Ffs.SectionSuffix[SectionType] + SUP_MODULE_SEC + SecNum + SectionSuffix[SectionType] + 'SEC' + SecNum OutputFile = os.path.join(self.OutputPath, GenSecOutputFile) GenSecInputFile = GenFdsGlobalVariable.MacroExtend(GenSecInputFile, Dict, self.CurrentArch) @@ -883,7 +883,7 @@ class FfsInfStatement(FfsInfStatementClassObject): self.ModuleGuid = RegistryGuidStr GenFdsGlobalVariable.GenerateFfs(FfsOutput, InputSection, - Ffs.Ffs.FdfFvFileTypeToFileType[Rule.FvFileType], + FdfFvFileTypeToFileType[Rule.FvFileType], self.ModuleGuid, Fixed=Rule.Fixed, CheckSum=Rule.CheckSum, Align=Rule.Alignment, SectionAlign=SectionAlignments, @@ -1056,7 +1056,7 @@ class FfsInfStatement(FfsInfStatementClassObject): FfsOutput = os.path.join( self.OutputPath, self.ModuleGuid + '.ffs') GenFdsGlobalVariable.GenerateFfs(FfsOutput, InputFile, - Ffs.Ffs.FdfFvFileTypeToFileType[Rule.FvFileType], + FdfFvFileTypeToFileType[Rule.FvFileType], self.ModuleGuid, Fixed=Rule.Fixed, CheckSum=Rule.CheckSum, Align=Rule.Alignment, SectionAlign=Alignments, diff --git a/BaseTools/Source/Python/GenFds/Fv.py b/BaseTools/Source/Python/GenFds/Fv.py index 6714838f6fc9..29daba5a3a3e 100644 --- a/BaseTools/Source/Python/GenFds/Fv.py +++ b/BaseTools/Source/Python/GenFds/Fv.py @@ -20,7 +20,6 @@ import subprocess import StringIO from struct import * -import Ffs import AprioriSection import FfsFileStatement from GenFdsGlobalVariable import GenFdsGlobalVariable diff --git a/BaseTools/Source/Python/GenFds/FvImageSection.py b/BaseTools/Source/Python/GenFds/FvImageSection.py index 57ecea0377bf..380fbe56f1c4 100644 --- a/BaseTools/Source/Python/GenFds/FvImageSection.py +++ b/BaseTools/Source/Python/GenFds/FvImageSection.py @@ -17,7 +17,7 @@ # import Section import StringIO -from Ffs import Ffs +from Ffs import SectionSuffix import subprocess from GenFdsGlobalVariable import GenFdsGlobalVariable import Common.LongFilePathOs as os @@ -75,7 +75,7 @@ class FvImageSection(FvImageSectionClassObject): if FvAlignmentValue > MaxFvAlignment: MaxFvAlignment = FvAlignmentValue - OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + Num + Ffs.SectionSuffix.get("FV_IMAGE")) + OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + Num + SectionSuffix["FV_IMAGE"]) GenFdsGlobalVariable.GenerateSection(OutputFile, [FvFileName], 'EFI_SECTION_FIRMWARE_VOLUME_IMAGE', IsMakefile=IsMakefile) OutputFileList.append(OutputFile) @@ -139,7 +139,7 @@ class FvImageSection(FvImageSectionClassObject): # # Prepare the parameter of GenSection # - OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + SecNum + Ffs.SectionSuffix.get("FV_IMAGE")) + OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + SecNum + SectionSuffix["FV_IMAGE"]) GenFdsGlobalVariable.GenerateSection(OutputFile, [FvFileName], 'EFI_SECTION_FIRMWARE_VOLUME_IMAGE', IsMakefile=IsMakefile) OutputFileList.append(OutputFile) diff --git a/BaseTools/Source/Python/GenFds/GuidSection.py b/BaseTools/Source/Python/GenFds/GuidSection.py index bda185476b95..104650d16781 100644 --- a/BaseTools/Source/Python/GenFds/GuidSection.py +++ b/BaseTools/Source/Python/GenFds/GuidSection.py @@ -18,7 +18,7 @@ # import Section import subprocess -from Ffs import Ffs +from Ffs import SectionSuffix import Common.LongFilePathOs as os from GenFdsGlobalVariable import GenFdsGlobalVariable from CommonDataClass.FdfClass import GuidSectionClassObject @@ -125,7 +125,7 @@ class GuidSection(GuidSectionClassObject) : ModuleName + \ SUP_MODULE_SEC + \ SecNum + \ - Ffs.SectionSuffix['GUIDED'] + SectionSuffix['GUIDED'] OutputFile = os.path.normpath(OutputFile) ExternalTool = None diff --git a/BaseTools/Source/Python/GenFds/OptRomInfStatement.py b/BaseTools/Source/Python/GenFds/OptRomInfStatement.py index a865ac4436d5..6179bfa181cb 100644 --- a/BaseTools/Source/Python/GenFds/OptRomInfStatement.py +++ b/BaseTools/Source/Python/GenFds/OptRomInfStatement.py @@ -1,7 +1,7 @@ ## @file # process OptionROM generation from INF statement # -# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -69,11 +69,6 @@ class OptRomInfStatement (FfsInfStatement): if self.OverrideAttribs.PciRevision is None: self.OverrideAttribs.PciRevision = self.OptRomDefs.get ('PCI_REVISION') -# InfObj = GenFdsGlobalVariable.WorkSpace.BuildObject[self.PathClassObj, self.CurrentArch] -# RecordList = InfObj._RawData[MODEL_META_DATA_HEADER, InfObj._Arch, InfObj._Platform] -# for Record in RecordList: -# Record = ReplaceMacros(Record, GlobalData.gEdkGlobal, False) -# Name = Record[0] ## GenFfs() method # # Generate FFS diff --git a/BaseTools/Source/Python/GenFds/UiSection.py b/BaseTools/Source/Python/GenFds/UiSection.py index 280500952b63..fe1e026f5edf 100644 --- a/BaseTools/Source/Python/GenFds/UiSection.py +++ b/BaseTools/Source/Python/GenFds/UiSection.py @@ -1,7 +1,7 @@ ## @file # process UI section generation # -# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -16,7 +16,7 @@ # Import Modules # import Section -from Ffs import Ffs +from Ffs import SectionSuffix import subprocess import Common.LongFilePathOs as os from GenFdsGlobalVariable import GenFdsGlobalVariable @@ -58,7 +58,7 @@ class UiSection (UiSectionClassObject): self.StringData = FfsInf.__ExtendMacro__(self.StringData) self.FileName = FfsInf.__ExtendMacro__(self.FileName) - OutputFile = os.path.join(OutputPath, ModuleName + SUP_MODULE_SEC + SecNum + Ffs.SectionSuffix.get(BINARY_FILE_TYPE_UI)) + OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + SecNum + SectionSuffix['UI']) if self.StringData is not None : NameString = self.StringData diff --git a/BaseTools/Source/Python/GenFds/VerSection.py b/BaseTools/Source/Python/GenFds/VerSection.py index 456a430079bb..1bcdc8110d30 100644 --- a/BaseTools/Source/Python/GenFds/VerSection.py +++ b/BaseTools/Source/Python/GenFds/VerSection.py @@ -1,7 +1,7 @@ ## @file # process Version section generation # -# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -15,7 +15,7 @@ ## # Import Modules # -from Ffs import Ffs +from Ffs import SectionSuffix import Section import Common.LongFilePathOs as os import subprocess @@ -60,7 +60,7 @@ class VerSection (VerSectionClassObject): self.FileName = FfsInf.__ExtendMacro__(self.FileName) OutputFile = os.path.join(OutputPath, - ModuleName + SUP_MODULE_SEC + SecNum + Ffs.SectionSuffix.get('VERSION')) + ModuleName + 'SEC' + SecNum + SectionSuffix['VERSION']) OutputFile = os.path.normpath(OutputFile) # Get String Data diff --git a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py index 14dcb1ae8136..7c0949da079d 100644 --- a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py +++ b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py @@ -133,15 +133,6 @@ class WorkspaceDatabase(object): self._CACHE_[Key] = BuildObject return BuildObject - # placeholder for file format conversion - class TransformObjectFactory: - def __init__(self, WorkspaceDb): - self.WorkspaceDb = WorkspaceDb - - # key = FilePath, Arch - def __getitem__(self, Key): - pass - ## Constructor of WorkspaceDatabase # # @param DbPath Path of database file @@ -182,7 +173,6 @@ class WorkspaceDatabase(object): # conversion object for build or file format conversion purpose self.BuildObject = WorkspaceDatabase.BuildObjectFactory(self) - self.TransformObject = WorkspaceDatabase.TransformObjectFactory(self) ## Check whether workspace database need to be renew. # The renew reason maybe: @@ -198,10 +188,12 @@ class WorkspaceDatabase(object): # def _CheckWhetherDbNeedRenew (self, force, DbPath): # if database does not exist, we need do nothing - if not os.path.exists(DbPath): return False + if not os.path.exists(DbPath): + return False # if user force to renew database, then not check whether database is out of date - if force: return True + if force: + return True # # Check the time of last modified source file or build.exe @@ -223,7 +215,7 @@ determine whether database file is out of date!\n") for root, dirs, files in os.walk (rootPath): for dir in dirs: # bypass source control folder - if dir.lower() in [".svn", "_svn", "cvs"]: + if dir.lower() in {".svn", "_svn", "cvs", ".git"}: dirs.remove(dir) for file in files: diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py index 1ef2dc5bfe70..99e4881b3ea4 100644 --- a/BaseTools/Source/Python/build/build.py +++ b/BaseTools/Source/Python/build/build.py @@ -1261,7 +1261,7 @@ class Build(): (AutoGenObject.BuildTarget, AutoGenObject.ToolChain, AutoGenObject.Arch), ExtraData=str(AutoGenObject)) - makefile = GenMake.BuildFile(AutoGenObject)._FILE_NAME_[GenMake.gMakeType] + makefile = GenMake.BuildFile._FILE_NAME_[GenMake.gMakeType] # run if Target == 'run': -- 2.16.2.windows.1