From: Jaben Carsey <jaben.carsey@intel.com>
To: edk2-devel@lists.01.org
Cc: Liming Gao <liming.gao@intel.com>, Yonghong Zhu <yonghong.zhu@intel.com>
Subject: [PATCH v1 03/11] BaseTools: remove unused code
Date: Mon, 14 May 2018 11:09:12 -0700 [thread overview]
Message-ID: <c425de4097d907884d9e5da1464835e0f357e496.1526321052.git.jaben.carsey@intel.com> (raw)
In-Reply-To: <cover.1526321052.git.jaben.carsey@intel.com>
In-Reply-To: <cover.1526321052.git.jaben.carsey@intel.com>
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 <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
---
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.<BR>
+# Copyright (c) 2008 - 2018, 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
@@ -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.<BR>
+# Copyright (c) 2007 - 2018, 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
@@ -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.<BR>
+# Copyright (c) 2007 - 2018, 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
@@ -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.<BR>
+# Copyright (c) 2007 - 2018, 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
@@ -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.<BR>
+# Copyright (c) 2007 - 2018, 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
@@ -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.<BR>
+# Copyright (c) 2007 - 2018, 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
@@ -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.<BR>
+# Copyright (c) 2007 - 2018, 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
@@ -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
next prev parent reply other threads:[~2018-05-14 18:09 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-14 18:09 [PATCH v1 00/11] BaseTools refactoring Jaben Carsey
2018-05-14 18:09 ` [PATCH v1 01/11] BaseTools: decorate base classes to prevent instantiation Jaben Carsey
2018-05-14 18:09 ` [PATCH v1 02/11] BaseTools: Workspace - create a base class Jaben Carsey
2018-05-14 18:09 ` Jaben Carsey [this message]
2018-05-14 18:09 ` [PATCH v1 04/11] BaseTools: remove repeated calls to startswith/endswith Jaben Carsey
2018-05-14 18:09 ` [PATCH v1 05/11] BaseTools: use set presence instead of series of equality Jaben Carsey
2018-05-14 18:09 ` [PATCH v1 06/11] BaseTools: refactor section generation Jaben Carsey
2018-05-14 18:09 ` [PATCH v1 07/11] BaseTools: refactor file opening/writing Jaben Carsey
2018-05-14 18:09 ` [PATCH v1 08/11] BaseTools: refactor to change object types Jaben Carsey
2018-05-14 18:09 ` [PATCH v1 09/11] BaseTools: refactor to stop re-allocating strings Jaben Carsey
2018-05-14 18:09 ` [PATCH v1 10/11] BaseTools: change to set for membership testing Jaben Carsey
2018-05-14 18:09 ` [PATCH v1 11/11] BaseTools: remove extra assignment Jaben Carsey
-- strict thread matches above, loose matches on Subject: below --
2018-06-20 21:08 [PATCH v2 00/11] BaseTools Refactoring Jaben Carsey
2018-06-20 21:08 ` [PATCH v1 03/11] BaseTools: remove unused code Jaben Carsey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c425de4097d907884d9e5da1464835e0f357e496.1526321052.git.jaben.carsey@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox