From nobody Sun Sep 7 12:25:10 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1526321384259321.6695703549633; Mon, 14 May 2018 11:09:44 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 26C7E20969677; Mon, 14 May 2018 11:09:27 -0700 (PDT) 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) 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 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 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; 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 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,401,1520924400"; d="scan'208";a="55814261" From: Jaben Carsey To: edk2-devel@lists.01.org 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: [edk2] [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: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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 ma= ke) _TEMPLATE_ =3D TemplateString('') =20 - _DEFAULT_FILE_NAME_ =3D "Makefile" - ## default file name for each type of build file _FILE_NAME_ =3D { "nmake" : "Makefile", @@ -151,23 +149,18 @@ class BuildFile(object): "gmake" : "test -f %(Src)s && $(CP) %(Src)s %(Dst)s" } =20 - _CD_TEMPLATE_ =3D { - "nmake" : 'if exist %(dir)s cd %(dir)s', - "gmake" : "test -e %(dir)s && cd %(dir)s" - } - _MAKE_TEMPLATE_ =3D { "nmake" : 'if exist %(file)s "$(MAKE)" $(MAKE_FLAGS) -f %(file)s= ', "gmake" : 'test -e %(file)s && "$(MAKE)" $(MAKE_FLAGS) -f %(file= )s' } =20 - _INCLUDE_CMD_ =3D { - "nmake" : '!INCLUDE', - "gmake" : "include" + _INC_FLAG_ =3D { + "MSFT" : "/I", + "GCC" : "-I", + "INTEL" : "-I", + "RVCT" : "-I" } =20 - _INC_FLAG_ =3D {"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/BaseToo= ls/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 BS= D License # which accompanies this distribution. The full text of the license may= be found at @@ -290,51 +290,6 @@ class IdentifierClass(object): self.EndLine =3D EndLine self.EndColumn =3D EndColumn =20 -## 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 =3D -1, CName =3D '', TokenSpaceGuidCName =3D ''= , Token =3D '', DatumType =3D '', Model =3D MODEL_UNKNOWN, \ - BelongsToFile =3D -1, BelongsToFunction =3D -1, StartLine= =3D -1, StartColumn =3D -1, EndLine =3D -1, EndColumn =3D -1): - self.ID =3D ID - self.CName =3D CName - self.TokenSpaceGuidCName =3D TokenSpaceGuidCName - self.Token =3D Token - self.DatumType =3D DatumType - self.BelongsToFile =3D BelongsToFile - self.BelongsToFunction =3D BelongsToFunction - self.StartLine =3D StartLine - self.StartColumn =3D StartColumn - self.EndLine =3D EndLine - self.EndColumn =3D EndColumn - ## FileClass # # This class defines a structure of a file diff --git a/BaseTools/Source/Python/Ecc/Database.py b/BaseTools/Source/Pyt= hon/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 BS= D License # which accompanies this distribution. The full text of the license may b= e found at @@ -211,59 +211,6 @@ class Database(object): =20 EdkLogger.verbose("Insert information from file %s ... DONE!" % Fi= le.FullPath) =20 - ## UpdateIdentifierBelongsToFunction - # - # Update the field "BelongsToFunction" for each Indentifier - # - # - def UpdateIdentifierBelongsToFunction_disabled(self): - EdkLogger.verbose("Update 'BelongsToFunction' for Identifiers star= ted ...") - - SqlCommand =3D """select ID, BelongsToFile, StartLine, EndLine, Mo= del from Identifier""" - EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand) - self.Cur.execute(SqlCommand) - Records =3D self.Cur.fetchall() - for Record in Records: - IdentifierID =3D Record[0] - BelongsToFile =3D Record[1] - StartLine =3D Record[2] - EndLine =3D Record[3] - Model =3D Record[4] - - # - # Check whether an identifier belongs to a function - # - EdkLogger.debug(4, "For common identifiers ... ") - SqlCommand =3D """select ID from Function - where StartLine < %s and EndLine > %s - and BelongsToFile =3D %s""" % (StartLine, EndLine,= BelongsToFile) - EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand) - self.Cur.execute(SqlCommand) - IDs =3D self.Cur.fetchall() - for ID in IDs: - SqlCommand =3D """Update Identifier set BelongsToFunction = =3D %s where ID =3D %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 =3D=3D DataClass.MODEL_IDENTIFIER_COMMENT: - SqlCommand =3D """select ID from Function - where StartLine =3D %s + 1 - and BelongsToFile =3D %s""" % (EndLine, BelongsToF= ile) - EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand) - self.Cur.execute(SqlCommand) - IDs =3D self.Cur.fetchall() - for ID in IDs: - SqlCommand =3D """Update Identifier set BelongsToFunct= ion =3D %s, Model =3D %s where ID =3D %s""" % (ID[0], DataClass.MODEL_IDENT= IFIER_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 =3D Record[1] StartLine =3D Record[2] EndLine =3D Record[3] - #Data1.append(("'file%s'" % BelongsToFile, FunctionID, Belongs= ToFile, StartLine, EndLine)) - #Data2.append(("'file%s'" % BelongsToFile, FunctionID, DataCla= ss.MODEL_IDENTIFIER_FUNCTION_HEADER, BelongsToFile, DataClass.MODEL_IDENTIF= IER_COMMENT, StartLine - 1)) =20 SqlCommand =3D """Update Identifier%s set BelongsToFunction = =3D %s where BelongsToFile =3D %s and StartLine > %s and EndLine < %s""" % \ (BelongsToFile, FunctionID, BelongsToFile, StartLi= ne, EndLine) @@ -291,25 +236,6 @@ class Database(object): SqlCommand =3D """Update Identifier%s set BelongsToFunction = =3D %s, Model =3D %s where BelongsToFile =3D %s and Model =3D %s and EndLin= e =3D %s""" % \ (BelongsToFile, FunctionID, DataClass.MODEL_IDENT= IFIER_FUNCTION_HEADER, BelongsToFile, DataClass.MODEL_IDENTIFIER_COMMENT, S= tartLine - 1) self.TblIdentifier.Exec(SqlCommand) -# # -# # Check whether an identifier belongs to a function -# # -# print Data1 -# SqlCommand =3D """Update ? set BelongsToFunction =3D ? where Belon= gsToFile =3D ? 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 =3D """Update ? set BelongsToFunction =3D ?, Model =3D = ? where BelongsToFile =3D ? and Model =3D ? and EndLine =3D ?""" -# EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand) -# self.Cur.executemany(SqlCommand, Data2) -# -# EdkLogger.verbose("Update 'BelongsToFunction' for Identifiers ... = DONE") - =20 ## # 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/Sour= ce/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 B= SD 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 =3D os.path.normpath(OutputFile) DummyFile =3D OutputFile + '.dummy' GenFdsGlobalVariable.GenerateSection(DummyFile, SectFiles, InputAl= ign=3DSectAlign, IsMakefile=3DIsMakefile) diff --git a/BaseTools/Source/Python/GenFds/DataSection.py b/BaseTools/Sour= ce/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 =3D TeFile =20 - OutputFile =3D os.path.join (OutputPath, ModuleName + SUP_MODULE_S= EC + SecNum + Ffs.SectionSuffix.get(self.SecType)) + OutputFile =3D os.path.join (OutputPath, ModuleName + 'SEC' + SecN= um + SectionSuffix.get(self.SecType)) OutputFile =3D os.path.normpath(OutputFile) GenFdsGlobalVariable.GenerateSection(OutputFile, [self.SectFileNam= e], Section.Section.SectionType.get(self.SecType), IsMakefile =3D IsMakefil= e) FileList =3D [OutputFile] diff --git a/BaseTools/Source/Python/GenFds/DepexSection.py b/BaseTools/Sou= rce/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/Sourc= e/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 =3D tuple() =20 Num =3D SecNum - OutputFile =3D os.path.join( OutputPath, ModuleName + SUP_= MODULE_SEC + str(Num) + Ffs.SectionSuffix.get(SectionType)) + OutputFile =3D os.path.join( OutputPath, ModuleName + 'SEC= ' + str(Num) + SectionSuffix.get(SectionType)) GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_= SECTION_VERSION', #Ui=3DStringData, Ver=3DBuildNum, @@ -134,7 +134,7 @@ class EfiSection (EfiSectionClassObject): for File in FileList: Index =3D Index + 1 Num =3D '%s.%d' %(SecNum , Index) - OutputFile =3D os.path.join(OutputPath, ModuleName + S= UP_MODULE_SEC + Num + Ffs.SectionSuffix.get(SectionType)) + OutputFile =3D os.path.join(OutputPath, ModuleName + '= SEC' + Num + SectionSuffix.get(SectionType)) f =3D open(File, 'r') VerString =3D 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 =3D SecNum - OutputFile =3D os.path.join( OutputPath, ModuleName + SUP_= MODULE_SEC + str(Num) + Ffs.SectionSuffix.get(SectionType)) + OutputFile =3D os.path.join( OutputPath, ModuleName + 'SEC= ' + str(Num) + SectionSuffix.get(SectionType)) GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_= SECTION_VERSION', #Ui=3DVerString, Ver=3DBuildNum, @@ -184,7 +184,7 @@ class EfiSection (EfiSectionClassObject): Num =3D SecNum if IsMakefile and StringData =3D=3D ModuleNameStr: StringData =3D "$(MODULE_NAME)" - OutputFile =3D os.path.join( OutputPath, ModuleName + SUP_= MODULE_SEC + str(Num) + Ffs.SectionSuffix.get(SectionType)) + OutputFile =3D os.path.join( OutputPath, ModuleName + 'SEC= ' + str(Num) + SectionSuffix.get(SectionType)) GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_= SECTION_USER_INTERFACE', Ui=3DStringData, IsMa= kefile=3DIsMakefile) OutputFileList.append(OutputFile) @@ -193,7 +193,7 @@ class EfiSection (EfiSectionClassObject): for File in FileList: Index =3D Index + 1 Num =3D '%s.%d' %(SecNum , Index) - OutputFile =3D os.path.join(OutputPath, ModuleName + S= UP_MODULE_SEC + Num + Ffs.SectionSuffix.get(SectionType)) + OutputFile =3D os.path.join(OutputPath, ModuleName + '= SEC' + Num + SectionSuffix.get(SectionType)) f =3D open(File, 'r') UiString =3D f.read() f.close() @@ -217,7 +217,7 @@ class EfiSection (EfiSectionClassObject): Num =3D SecNum if IsMakefile and StringData =3D=3D ModuleNameStr: StringData =3D "$(MODULE_NAME)" - OutputFile =3D os.path.join( OutputPath, ModuleName + SUP_= MODULE_SEC + str(Num) + Ffs.SectionSuffix.get(SectionType)) + OutputFile =3D os.path.join( OutputPath, ModuleName + 'SEC= ' + str(Num) + SectionSuffix.get(SectionType)) GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_= SECTION_USER_INTERFACE', Ui=3DStringData, IsMa= kefile=3DIsMakefile) OutputFileList.append(OutputFile) @@ -238,7 +238,7 @@ class EfiSection (EfiSectionClassObject): """ Copy Map file to FFS output path """ Index =3D Index + 1 Num =3D '%s.%d' %(SecNum , Index) - OutputFile =3D os.path.join( OutputPath, ModuleName + = SUP_MODULE_SEC + Num + Ffs.SectionSuffix.get(SectionType)) + OutputFile =3D os.path.join( OutputPath, ModuleName + = 'SEC' + Num + SectionSuffix.get(SectionType)) File =3D GenFdsGlobalVariable.MacroExtend(File, Dict) =20 #Get PE Section alignment when align is set to AUTO diff --git a/BaseTools/Source/Python/GenFds/Ffs.py b/BaseTools/Source/Pytho= n/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 B= SD License @@ -12,56 +12,40 @@ # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IM= PLIED. # =20 -## -# Import Modules -# -from CommonDataClass.FdfClass import FDClassObject from Common.DataType import * +# mapping between FILE type in FDF and file type for GenFfs +FdfFvFileTypeToFileType =3D { + 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' +} =20 -## generate FFS -# -# -class Ffs(FDClassObject): - # mapping between FILE type in FDF and file type for GenFfs - FdfFvFileTypeToFileType =3D { - 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_STANDALON= E' - } - =20 - # mapping between section type in FDF and file suffix - SectionSuffix =3D { - 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', =20 - 'FV_IMAGE' : 'fv.sec', - 'COMPRESS' : '.com', - 'GUIDED' : '.guided', - BINARY_FILE_TYPE_PEI_DEPEX : '.dpx', - BINARY_FILE_TYPE_SMM_DEPEX : '.dpx' - } - =20 - ## The constructor - # - # @param self The object pointer - # - def __init__(self): - FfsClassObject.__init__(self) +# mapping between section type in FDF and file suffix +SectionSuffix =3D { + 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', =20 + '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 =3D os.path.join(OutputDir, self.NameGuid + '.ffs') GenFdsGlobalVariable.GenerateFfs(FfsFileOutput, SectionFiles, - Ffs.Ffs.FdfFvFileTypeToFileType.g= et(self.FvFileType), + FdfFvFileTypeToFileType.get(self.= FvFileType), self.NameGuid, Fixed=3Dself.Fixed, CheckSum=3Dself.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): =20 SecNum =3D '%d' %Index GenSecOutputFile=3D self.__ExtendMacro__(Rule.NameGuid) + \ - Ffs.Ffs.SectionSuffix[SectionType] + SUP_MOD= ULE_SEC + SecNum + SectionSuffix[SectionType] + 'SEC' + SecNum Index =3D Index + 1 OutputFile =3D os.path.join(self.OutputPath, GenSecOutputF= ile) File =3D GenFdsGlobalVariable.MacroExtend(File, Dict, self= .CurrentArch) @@ -804,7 +804,7 @@ class FfsInfStatement(FfsInfStatementClassObject): else: SecNum =3D '%d' %Index GenSecOutputFile=3D self.__ExtendMacro__(Rule.NameGuid) + \ - Ffs.Ffs.SectionSuffix[SectionType] + SUP_MOD= ULE_SEC + SecNum + SectionSuffix[SectionType] + 'SEC' + SecNum OutputFile =3D os.path.join(self.OutputPath, GenSecOutputFile) GenSecInputFile =3D GenFdsGlobalVariable.MacroExtend(GenSecInp= utFile, Dict, self.CurrentArch) =20 @@ -883,7 +883,7 @@ class FfsInfStatement(FfsInfStatementClassObject): self.ModuleGuid =3D RegistryGuidStr =20 GenFdsGlobalVariable.GenerateFfs(FfsOutput, InputSection, - Ffs.Ffs.FdfFvFileTypeToFileTy= pe[Rule.FvFileType], + FdfFvFileTypeToFileType[Rule.= FvFileType], self.ModuleGuid, Fixed=3DRule= .Fixed, CheckSum=3DRule.CheckSum, Ali= gn=3DRule.Alignment, SectionAlign=3DSectionAlignme= nts, @@ -1056,7 +1056,7 @@ class FfsInfStatement(FfsInfStatementClassObject): =20 FfsOutput =3D os.path.join( self.OutputPath, self.ModuleGuid + '.f= fs') GenFdsGlobalVariable.GenerateFfs(FfsOutput, InputFile, - Ffs.Ffs.FdfFvFileTypeToFileTy= pe[Rule.FvFileType], + FdfFvFileTypeToFileType[Rule.= FvFileType], self.ModuleGuid, Fixed=3DRule= .Fixed, CheckSum=3DRule.CheckSum, Ali= gn=3DRule.Alignment, SectionAlign=3DAlignments, 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 * =20 -import Ffs import AprioriSection import FfsFileStatement from GenFdsGlobalVariable import GenFdsGlobalVariable diff --git a/BaseTools/Source/Python/GenFds/FvImageSection.py b/BaseTools/S= ource/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 =3D FvAlignmentValue =20 - OutputFile =3D os.path.join(OutputPath, ModuleName + SUP_M= ODULE_SEC + Num + Ffs.SectionSuffix.get("FV_IMAGE")) + OutputFile =3D os.path.join(OutputPath, ModuleName + 'SEC'= + Num + SectionSuffix["FV_IMAGE"]) GenFdsGlobalVariable.GenerateSection(OutputFile, [FvFileNa= me], 'EFI_SECTION_FIRMWARE_VOLUME_IMAGE', IsMakefile=3DIsMakefile) OutputFileList.append(OutputFile) =20 @@ -139,7 +139,7 @@ class FvImageSection(FvImageSectionClassObject): # # Prepare the parameter of GenSection # - OutputFile =3D os.path.join(OutputPath, ModuleName + SUP_MODUL= E_SEC + SecNum + Ffs.SectionSuffix.get("FV_IMAGE")) + OutputFile =3D os.path.join(OutputPath, ModuleName + 'SEC' + S= ecNum + SectionSuffix["FV_IMAGE"]) GenFdsGlobalVariable.GenerateSection(OutputFile, [FvFileName],= 'EFI_SECTION_FIRMWARE_VOLUME_IMAGE', IsMakefile=3DIsMakefile) OutputFileList.append(OutputFile) =20 diff --git a/BaseTools/Source/Python/GenFds/GuidSection.py b/BaseTools/Sour= ce/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 =3D os.path.normpath(OutputFile) =20 ExternalTool =3D None diff --git a/BaseTools/Source/Python/GenFds/OptRomInfStatement.py b/BaseToo= ls/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 B= SD License @@ -69,11 +69,6 @@ class OptRomInfStatement (FfsInfStatement): if self.OverrideAttribs.PciRevision is None: self.OverrideAttribs.PciRevision =3D self.OptRomDefs.get ('PCI= _REVISION') =20 -# InfObj =3D GenFdsGlobalVariable.WorkSpace.BuildObject[self.PathCl= assObj, self.CurrentArch] =20 -# RecordList =3D InfObj._RawData[MODEL_META_DATA_HEADER, InfObj._Ar= ch, InfObj._Platform] -# for Record in RecordList: -# Record =3D ReplaceMacros(Record, GlobalData.gEdkGlobal, False) -# Name =3D Record[0] =20 ## 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 B= SD 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 =3D FfsInf.__ExtendMacro__(self.StringData) self.FileName =3D FfsInf.__ExtendMacro__(self.FileName) =20 - OutputFile =3D os.path.join(OutputPath, ModuleName + SUP_MODULE_SE= C + SecNum + Ffs.SectionSuffix.get(BINARY_FILE_TYPE_UI)) + OutputFile =3D os.path.join(OutputPath, ModuleName + 'SEC' + SecNu= m + SectionSuffix['UI']) =20 if self.StringData is not None : NameString =3D self.StringData diff --git a/BaseTools/Source/Python/GenFds/VerSection.py b/BaseTools/Sourc= e/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 B= SD 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 =3D FfsInf.__ExtendMacro__(self.FileName) =20 OutputFile =3D os.path.join(OutputPath, - ModuleName + SUP_MODULE_SEC + SecNum + F= fs.SectionSuffix.get('VERSION')) + ModuleName + 'SEC' + SecNum + SectionSuf= fix['VERSION']) OutputFile =3D os.path.normpath(OutputFile) =20 # Get String Data diff --git a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py b/BaseT= ools/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] =3D BuildObject return BuildObject =20 - # placeholder for file format conversion - class TransformObjectFactory: - def __init__(self, WorkspaceDb): - self.WorkspaceDb =3D WorkspaceDb - - # key =3D FilePath, Arch - def __getitem__(self, Key): - pass - ## Constructor of WorkspaceDatabase # # @param DbPath Path of database file @@ -182,7 +173,6 @@ class WorkspaceDatabase(object): =20 # conversion object for build or file format conversion purpose self.BuildObject =3D WorkspaceDatabase.BuildObjectFactory(self) - self.TransformObject =3D WorkspaceDatabase.TransformObjectFactory(= self) =20 ## 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 =20 # if user force to renew database, then not check whether database= is out of date - if force: return True + if force: + return True =20 # =20 # 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=20 - if dir.lower() in [".svn", "_svn", "cvs"]: + if dir.lower() in {".svn", "_svn", "cvs", ".git"}: dirs.remove(dir) =20 for file in files: diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Pyth= on/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=3Dstr(AutoGenObject)) =20 - makefile =3D GenMake.BuildFile(AutoGenObject)._FILE_NAME_[GenMake.= gMakeType] + makefile =3D GenMake.BuildFile._FILE_NAME_[GenMake.gMakeType] =20 # run if Target =3D=3D 'run': --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel