From nobody Fri May 3 16:57:37 2024 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 152282120160791.82185962689073; Tue, 3 Apr 2018 22:53:21 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id BF4D02264A1FB; Tue, 3 Apr 2018 22:53:19 -0700 (PDT) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (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 7D6512264A1F6 for ; Tue, 3 Apr 2018 22:53:18 -0700 (PDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Apr 2018 22:53:17 -0700 Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga001.fm.intel.com with ESMTP; 03 Apr 2018 22:53:17 -0700 Received: from fmsmsx125.amr.corp.intel.com (10.18.125.40) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 3 Apr 2018 22:53:17 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by FMSMSX125.amr.corp.intel.com (10.18.125.40) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 3 Apr 2018 22:53:16 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.61]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.88]) with mapi id 14.03.0319.002; Wed, 4 Apr 2018 13:53:14 +0800 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=192.55.52.151; helo=mga17.intel.com; envelope-from=yunhuax.feng@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,405,1517904000"; d="dat'59?scan'59,208,59";a="43852472" From: "Feng, YunhuaX" To: "edk2-devel@lists.01.org" Thread-Topic: [PATCH] BaseTools: Remove EdkIIWorkspaceBuild.py from source code Thread-Index: AdPL2MdZTL6BNVgaT1qOcGcmLeuWRQ== Date: Wed, 4 Apr 2018 05:53:13 +0000 Message-ID: <47C64442C08CCD4089DC43B6B5E46BC483DD5F@shsmsx102.ccr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: <47C64442C08CCD4089DC43B6B5E46BC483DD5F@shsmsx102.ccr.corp.intel.com> x-originating-ip: [10.239.127.40] MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.26 Subject: [edk2] [PATCH] BaseTools: Remove EdkIIWorkspaceBuild.py from source 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: "Gao, Liming" 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" Remove EdkIIWorkspaceBuild.py from source code Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng Reviewed-by: Yonghong Zhu --- .../Source/Python/Common/EdkIIWorkspaceBuild.py | 1670 ----------------= ---- BaseTools/Source/Python/Makefile | 1 - 2 files changed, 1671 deletions(-) delete mode 100644 BaseTools/Source/Python/Common/EdkIIWorkspaceBuild.py diff --git a/BaseTools/Source/Python/Common/EdkIIWorkspaceBuild.py b/BaseTo= ols/Source/Python/Common/EdkIIWorkspaceBuild.py deleted file mode 100644 index c0966d5265..0000000000 --- a/BaseTools/Source/Python/Common/EdkIIWorkspaceBuild.py +++ /dev/null @@ -1,1670 +0,0 @@ -## @file -# This file is used to define each component of the build database -# -# Copyright (c) 2007 - 2014, 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 -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. -# - -## -# Import Modules -# -import Common.LongFilePathOs as os, string, copy, pdb, copy -import EdkLogger -import DataType -from InfClassObject import * -from DecClassObject import * -from DscClassObject import * -from String import * -from BuildToolError import * -from Misc import sdict -import Database as Database -import time as time - -## PcdClassObject -# -# This Class is used for PcdObject -#=20 -# @param object: Inherited from object class -# @param Name: Input value for Name of Pcd, default is None -# @param Guid: Input value for Guid of Pcd, default is None -# @param Type: Input value for Type of Pcd, default is None -# @param DatumType: Input value for DatumType of Pcd, default is = None -# @param Value: Input value for Value of Pcd, default is None -# @param Token: Input value for Token of Pcd, default is None -# @param MaxDatumSize: Input value for MaxDatumSize of Pcd, default = is None -# @param SkuInfoList: Input value for SkuInfoList of Pcd, default i= s {} -# @param IsOverrided: Input value for IsOverrided of Pcd, default i= s False -# -# @var TokenCName: To store value for TokenCName -# @var TokenSpaceGuidCName: To store value for TokenSpaceGuidCName -# @var Type: To store value for Type -# @var DatumType: To store value for DatumType -# @var TokenValue: To store value for TokenValue -# @var MaxDatumSize: To store value for MaxDatumSize -# @var SkuInfoList: To store value for SkuInfoList -# @var IsOverrided: To store value for IsOverrided -# @var Phase: To store value for Phase, default is "DXE" -# -class PcdClassObject(object): - def __init__(self, Name =3D None, Guid =3D None, Type =3D None, DatumT= ype =3D None, Value =3D None, Token =3D None, MaxDatumSize =3D None, SkuInf= oList =3D {}, IsOverrided =3D False): - self.TokenCName =3D Name - self.TokenSpaceGuidCName =3D Guid - self.Type =3D Type - self.DatumType =3D DatumType - self.DefaultValue =3D Value - self.TokenValue =3D Token - self.MaxDatumSize =3D MaxDatumSize - self.SkuInfoList =3D SkuInfoList - self.IsOverrided =3D IsOverrided - self.Phase =3D "DXE" - - ## Convert the class to a string - # - # Convert each member of the class to string - # Organize to a signle line format string - # - # @retval Rtn Formatted String - # - def __str__(self): - Rtn =3D '\tTokenCName=3D' + str(self.TokenCName) + ', ' + \ - 'TokenSpaceGuidCName=3D' + str(self.TokenSpaceGuidCName) + '= , ' + \ - 'Type=3D' + str(self.Type) + ', ' + \ - 'DatumType=3D' + str(self.DatumType) + ', ' + \ - 'DefaultValue=3D' + str(self.DefaultValue) + ', ' + \ - 'TokenValue=3D' + str(self.TokenValue) + ', ' + \ - 'MaxDatumSize=3D' + str(self.MaxDatumSize) + ', ' - for Item in self.SkuInfoList.values(): - Rtn =3D Rtn + 'SkuId=3D' + Item.SkuId + ', ' + 'SkuIdName=3D' = + Item.SkuIdName - Rtn =3D Rtn + str(self.IsOverrided) - - return Rtn - - ## Override __eq__ function - # - # Check whether pcds are the same - # - # @retval False The two pcds are different - # @retval True The two pcds are the same - # - def __eq__(self, Other): - return Other is not None and self.TokenCName =3D=3D Other.TokenCNa= me and self.TokenSpaceGuidCName =3D=3D Other.TokenSpaceGuidCName - - ## Override __hash__ function - # - # Use (TokenCName, TokenSpaceGuidCName) as key in hash table - # - # @retval truple() Key for hash table - # - def __hash__(self): - return hash((self.TokenCName, self.TokenSpaceGuidCName)) - -## LibraryClassObject -# -# This Class defines LibraryClassObject used in BuildDatabase -#=20 -# @param object: Inherited from object class -# @param Name: Input value for LibraryClassName, default is None -# @param SupModList: Input value for SupModList, default is [] -# @param Type: Input value for Type, default is None -# -# @var LibraryClass: To store value for LibraryClass -# @var SupModList: To store value for SupModList -# @var Type: To store value for Type -# -class LibraryClassObject(object): - def __init__(self, Name =3D None, SupModList =3D [], Type =3D None): - self.LibraryClass =3D Name - self.SupModList =3D SupModList - if Type is not None: - self.SupModList =3D CleanString(Type).split(DataType.TAB_SPACE= _SPLIT) - -## ModuleBuildClassObject -# -# This Class defines ModuleBuildClass -#=20 -# @param object: Inherited from object class -# -# @var DescFilePath: To store value for DescFilePath -# @var BaseName: To store value for BaseName -# @var ModuleType: To store value for ModuleType -# @var Guid: To store value for Guid -# @var Version: To store value for Version -# @var PcdIsDriver: To store value for PcdIsDriver -# @var BinaryModule: To store value for BinaryModule -# @var CustomMakefile: To store value for CustomMakefile -# @var Specification: To store value for Specification -# @var Shadow To store value for Shadow -# @var LibraryClass: To store value for LibraryClass, it is a li= st structure as -# [ LibraryClassObject, ...] -# @var ModuleEntryPointList: To store value for ModuleEntryPointList -# @var ModuleUnloadImageList: To store value for ModuleUnloadImageList -# @var ConstructorList: To store value for ConstructorList -# @var DestructorList: To store value for DestructorList -# @var Binaries: To store value for Binaries, it is a list s= tructure as -# [ ModuleBinaryClassObject, ...] -# @var Sources: To store value for Sources, it is a list st= ructure as -# [ ModuleSourceFilesClassObject, ... ] -# @var LibraryClasses: To store value for LibraryClasses, it is a = set structure as -# { [LibraryClassName, ModuleType] : LibraryC= lassInfFile } -# @var Protocols: To store value for Protocols, it is a list = structure as -# [ ProtocolName, ... ] -# @var Ppis: To store value for Ppis, it is a list struc= ture as -# [ PpiName, ... ] -# @var Guids: To store value for Guids, it is a list stru= cture as -# [ GuidName, ... ] -# @var Includes: To store value for Includes, it is a list s= tructure as -# [ IncludePath, ... ] -# @var Packages: To store value for Packages, it is a list s= tructure as -# [ DecFileName, ... ] -# @var Pcds: To store value for Pcds, it is a set struct= ure as -# { [(PcdCName, PcdGuidCName)] : PcdClassObje= ct} -# @var BuildOptions: To store value for BuildOptions, it is a se= t structure as -# { [BuildOptionKey] : BuildOptionValue} -# @var Depex: To store value for Depex -# -class ModuleBuildClassObject(object): - def __init__(self): - self.AutoGenVersion =3D 0 - self.DescFilePath =3D '' - self.BaseName =3D '' - self.ModuleType =3D '' - self.Guid =3D '' - self.Version =3D '' - self.PcdIsDriver =3D '' - self.BinaryModule =3D '' - self.Shadow =3D '' - self.CustomMakefile =3D {} - self.Specification =3D {} - self.LibraryClass =3D [] - self.ModuleEntryPointList =3D [] - self.ModuleUnloadImageList =3D [] - self.ConstructorList =3D [] - self.DestructorList =3D [] - - self.Binaries =3D [] - self.Sources =3D [] - self.LibraryClasses =3D sdict() - self.Libraries =3D [] - self.Protocols =3D [] - self.Ppis =3D [] - self.Guids =3D [] - self.Includes =3D [] - self.Packages =3D [] - self.Pcds =3D {} - self.BuildOptions =3D {} - self.Depex =3D '' - - ## Convert the class to a string - # - # Convert member DescFilePath of the class to a string - # - # @retval string Formatted String - # - def __str__(self): - return self.DescFilePath - - ## Override __eq__ function - # - # Check whether ModuleBuildClassObjects are the same - # - # @retval False The two ModuleBuildClassObjects are different - # @retval True The two ModuleBuildClassObjects are the same - # - def __eq__(self, Other): - return self.DescFilePath =3D=3D str(Other) - - ## Override __hash__ function - # - # Use DescFilePath as key in hash table - # - # @retval string Key for hash table - # - def __hash__(self): - return hash(self.DescFilePath) - -## PackageBuildClassObject -# -# This Class defines PackageBuildClass -#=20 -# @param object: Inherited from object class -# -# @var DescFilePath: To store value for DescFilePath -# @var PackageName: To store value for PackageName -# @var Guid: To store value for Guid -# @var Version: To store value for Version -# @var Protocols: To store value for Protocols, it is a set structur= e as -# { [ProtocolName] : Protocol Guid, ... } -# @var Ppis: To store value for Ppis, it is a set structure as -# { [PpiName] : Ppi Guid, ... } -# @var Guids: To store value for Guids, it is a set structure as -# { [GuidName] : Guid, ... } -# @var Includes: To store value for Includes, it is a list structur= e as -# [ IncludePath, ... ] -# @var LibraryClasses: To store value for LibraryClasses, it is a set str= ucture as -# { [LibraryClassName] : LibraryClassInfFile } -# @var Pcds: To store value for Pcds, it is a set structure as -# { [(PcdCName, PcdGuidCName)] : PcdClassObject} -# -class PackageBuildClassObject(object): - def __init__(self): - self.DescFilePath =3D '' - self.PackageName =3D '' - self.Guid =3D '' - self.Version =3D '' - - self.Protocols =3D {} - self.Ppis =3D {} - self.Guids =3D {} - self.Includes =3D [] - self.LibraryClasses =3D {} - self.Pcds =3D {} - - ## Convert the class to a string - # - # Convert member DescFilePath of the class to a string - # - # @retval string Formatted String - # - def __str__(self): - return self.DescFilePath - - ## Override __eq__ function - # - # Check whether PackageBuildClassObjects are the same - # - # @retval False The two PackageBuildClassObjects are different - # @retval True The two PackageBuildClassObjects are the same - # - def __eq__(self, Other): - return self.DescFilePath =3D=3D str(Other) - - ## Override __hash__ function - # - # Use DescFilePath as key in hash table - # - # @retval string Key for hash table - # - def __hash__(self): - return hash(self.DescFilePath) - -## PlatformBuildClassObject -# -# This Class defines PlatformBuildClass -#=20 -# @param object: Inherited from object class -# -# @var DescFilePath: To store value for DescFilePath -# @var PlatformName: To store value for PlatformName -# @var Guid: To store value for Guid -# @var Version: To store value for Version -# @var DscSpecification: To store value for DscSpecification -# @var OutputDirectory: To store value for OutputDirectory -# @var FlashDefinition: To store value for FlashDefinition -# @var BuildNumber: To store value for BuildNumber -# @var MakefileName: To store value for MakefileName -# @var SkuIds: To store value for SkuIds, it is a set structure= as -# { 'SkuName' : SkuId, '!include' : includefilenam= e, ...} -# @var Modules: To store value for Modules, it is a list structu= re as -# [ InfFileName, ... ] -# @var Libraries: To store value for Libraries, it is a list struc= ture as -# [ InfFileName, ... ] -# @var LibraryClasses: To store value for LibraryClasses, it is a set s= tructure as -# { (LibraryClassName, ModuleType) : LibraryClassI= nfFile } -# @var Pcds: To store value for Pcds, it is a set structure as -# { [(PcdCName, PcdGuidCName)] : PcdClassObject } -# @var BuildOptions: To store value for BuildOptions, it is a set str= ucture as -# { [BuildOptionKey] : BuildOptionValue } -# -class PlatformBuildClassObject(object): - def __init__(self): - self.DescFilePath =3D '' - self.PlatformName =3D '' - self.Guid =3D '' - self.Version =3D '' - self.DscSpecification =3D '' - self.OutputDirectory =3D '' - self.FlashDefinition =3D '' - self.BuildNumber =3D '' - self.MakefileName =3D '' - - self.SkuIds =3D {} - self.Modules =3D [] - self.LibraryInstances =3D [] - self.LibraryClasses =3D {} - self.Libraries =3D {} - self.Pcds =3D {} - self.BuildOptions =3D {} - - ## Convert the class to a string - # - # Convert member DescFilePath of the class to a string - # - # @retval string Formatted String - # - def __str__(self): - return self.DescFilePath - - ## Override __eq__ function - # - # Check whether PlatformBuildClassObjects are the same - # - # @retval False The two PlatformBuildClassObjects are different - # @retval True The two PlatformBuildClassObjects are the same - # - def __eq__(self, other): - return self.DescFilePath =3D=3D str(other) - - ## Override __hash__ function - # - # Use DescFilePath as key in hash table - # - # @retval string Key for hash table - # - def __hash__(self): - return hash(self.DescFilePath) - -## ItemBuild -# -# This Class defines Module/Platform/Package databases for build system -# -# @param object: Inherited from object class -# @param Arch: Build arch -# @param Platform: Build Platform -# @param Package: Build Package -# @param Module: Build Module -# -# @var Arch: To store value for Build Arch -# @var PlatformDatabase: To store value for PlatformDatabase, it is a set= structure as -# { [DscFileName] : PlatformBuildClassObject, ...} -# @var PackageDatabase: To store value for PackageDatabase, it is a set = structure as -# { [DecFileName] : PacakgeBuildClassObject, ...} -# @var ModuleDatabase: To store value for ModuleDatabase, it is a list = structure as -# { [InfFileName] : ModuleBuildClassObject, ...} -# -class ItemBuild(object): - def __init__(self, Arch, Platform =3D None, Package =3D None, Module = =3D None): - self.Arch =3D Arch - self.PlatformDatabase =3D {} - self.PackageDatabase =3D {} - self.ModuleDatabase =3D {} - -## WorkspaceBuild -# -# This class is used to parse active platform to init all inf/dec/dsc files -# Generate module/package/platform databases for build -# -# @param object: Inherited from object class -# @param ActivePlatform: Input value for current active platform -# @param WorkspaceDir: Input value for current WorkspaceDir -# -# @var WorkspaceDir: To store value for WorkspaceDir -# @var SupArchList: To store value for SupArchList, selection scope = is in below list -# EBC | IA32 | X64 | IPF | ARM | PPC | AARCH64 -# @var BuildTarget: To store value for WorkspaceDir, selection scope= is in below list -# RELEASE | DEBUG -# @var SkuId: To store value for SkuId -# @var Fdf: To store value for Fdf -# @var FdTargetList: To store value for FdTargetList -# @var FvTargetList: To store value for FvTargetList -# @var TargetTxt: To store value for TargetTxt, it is a set struct= ure as -# TargetTxtClassObject -# @var ToolDef: To store value for ToolDef, it is a set structur= e as -# ToolDefClassObject -# @var InfDatabase: To store value for InfDatabase, it is a set stru= cture as -# { [InfFileName] : InfClassObject} -# @var DecDatabase: To store value for DecDatabase, it is a set stru= cture as -# { [DecFileName] : DecClassObject} -# @var DscDatabase: To store value for DscDatabase, it is a set stru= cture as -# { [DscFileName] : DscClassObject} -# @var Build: To store value for DscDatabase, it is a set stru= cture as -# ItemBuild -# @var DscFileName: To store value for Active Platform -# @var UnFoundPcdInDsc: To store values for the pcds defined in INF/DEC = but not found in DSC, it is a set structure as -# { (PcdGuid, PcdCName, Arch) : DecFileName } -# -class WorkspaceBuild(object): - def __init__(self, ActivePlatform, WorkspaceDir): - self.WorkspaceDir =3D NormPath(WorkspaceDir) - self.SupArchList =3D [] - self.BuildTarget =3D [] - self.SkuId =3D '' - self.Fdf =3D '' - self.FdTargetList =3D [] - self.FvTargetList =3D [] - self.TargetTxt =3D None - self.ToolDef =3D None - - self.InfDatabase =3D {} - self.DecDatabase =3D {} - self.DscDatabase =3D {} - =20 - self.UnFoundPcdInDsc =3D {} - - # - # Init build for all arches - # - self.Build =3D {} - for Arch in DataType.ARCH_LIST: - self.Build[Arch] =3D ItemBuild(Arch) - - # - # Init build database - # - self.Db =3D Database.Database(DATABASE_PATH) - self.Db.InitDatabase() - =20 - # - # Get active platform - # - self.DscFileName =3D NormPath(ActivePlatform) - File =3D self.WorkspaceFile(self.DscFileName) - if os.path.exists(File) and os.path.isfile(File): - self.DscDatabase[self.DscFileName] =3D Dsc(File, False, True, = self.WorkspaceDir, self.Db) - else: - EdkLogger.error("AutoGen", FILE_NOT_FOUND, ExtraData =3D File) - - # - # Parse platform to get module - # - for DscFile in self.DscDatabase.keys(): - Platform =3D self.DscDatabase[DscFile].Platform - - # - # Get global information - # - Tmp =3D set() - for Arch in DataType.ARCH_LIST: - for Item in Platform.Header[Arch].SupArchList: - Tmp.add(Item) - self.SupArchList =3D list(Tmp) - Tmp =3D set() - for Arch in DataType.ARCH_LIST: - for Item in Platform.Header[Arch].BuildTargets: - Tmp.add(Item) - self.BuildTarget =3D list(Tmp) - for Arch in self.SupArchList: - self.SkuId =3D Platform.Header[Arch].SkuIdName - self.Fdf =3D Platform.FlashDefinitionFile.FilePath - - # - # Get all inf files - # - for Item in Platform.LibraryClasses.LibraryList: - for Arch in Item.SupArchList: - self.AddToInfDatabase(Item.FilePath) - - for Item in Platform.Libraries.LibraryList: - for Arch in Item.SupArchList: - self.AddToInfDatabase(Item.FilePath) - - for Item in Platform.Modules.ModuleList: - for Arch in Item.SupArchList: - # - # Add modules - # - Module =3D Item.FilePath - self.AddToInfDatabase(Module) - # - # Add library used in modules - # - for Lib in Item.LibraryClasses.LibraryList: - self.AddToInfDatabase(Lib.FilePath) - self.UpdateLibraryClassOfModule(Module, Lib.Name, = Arch, Lib.FilePath) - - # - # Parse module to get package - # - for InfFile in self.InfDatabase.keys(): - Module =3D self.InfDatabase[InfFile].Module - # - # Get all dec - # - for Item in Module.PackageDependencies: - for Arch in Item.SupArchList: - self.AddToDecDatabase(Item.FilePath) - # End of self.Init() - - ## Generate PlatformDatabase - # - # Go through each arch to get all items in DscDatabase to PlatformData= base - # - def GenPlatformDatabase(self, PcdsSet=3D{}): - for Dsc in self.DscDatabase.keys(): - Platform =3D self.DscDatabase[Dsc].Platform - for Arch in self.SupArchList: - Pb =3D PlatformBuildClassObject() - - # - # Defines - # - Pb.DescFilePath =3D Dsc - Pb.PlatformName =3D Platform.Header[Arch].Name - if Pb.PlatformName =3D=3D '': - EdkLogger.error("AutoGen", PARSER_ERROR, "The BaseName= of platform %s is not defined for arch %s" % (Dsc, Arch)) - Pb.Guid =3D Platform.Header[Arch].Guid - Pb.Version =3D Platform.Header[Arch].Version - Pb.DscSpecification =3D Platform.Header[Arch].DscSpecifica= tion - Pb.OutputDirectory =3D Platform.Header[Arch].OutputDirecto= ry - Pb.FlashDefinition =3D Platform.FlashDefinitionFile.FilePa= th - Pb.BuildNumber =3D Platform.Header[Arch].BuildNumber - - # - # SkuId - # - for Key in Platform.SkuInfos.SkuInfoList.keys(): - Pb.SkuIds[Key] =3D Platform.SkuInfos.SkuInfoList[Key] - - # - # Module - # - for Item in Platform.Modules.ModuleList: - if Arch in Item.SupArchList: - Pb.Modules.append(Item.FilePath) - - # - # BuildOptions - # - for Item in Platform.BuildOptions.BuildOptionList: - if Arch in Item.SupArchList: - Pb.BuildOptions[(Item.ToolChainFamily, Item.ToolCh= ain)] =3D Item.Option - - # - # LibraryClass - # - for Item in Platform.LibraryClasses.LibraryList: - SupModuleList =3D self.FindSupModuleListOfLibraryClass= (Item, Platform.LibraryClasses.LibraryList, Arch) - if Arch in Item.SupArchList: - for ModuleType in SupModuleList: - Pb.LibraryClasses[(Item.Name, ModuleType)] =3D= Item.FilePath - - # - # Libraries - #=20 - for Item in Platform.Libraries.LibraryList: - for ItemArch in Item.SupArchList: - Library =3D self.InfDatabase[Item.FilePath] - if ItemArch not in Library.Module.Header: - continue - Pb.Libraries[Library.Module.Header[ItemArch].Name]= =3D Item.FilePath - =20 - # - # Pcds - # - for Item in Platform.DynamicPcdBuildDefinitions: - if Arch in Item.SupArchList: - Name =3D Item.CName - Guid =3D Item.TokenSpaceGuidCName - Type =3D Item.ItemType - DatumType =3D Item.DatumType - Value =3D Item.DefaultValue - Token =3D Item.Token - MaxDatumSize =3D Item.MaxDatumSize - SkuInfoList =3D Item.SkuInfoList - Pb.Pcds[(Name, Guid)] =3D PcdClassObject(Name, Gui= d, Type, DatumType, Value, Token, MaxDatumSize, SkuInfoList, False) - - for (Name, Guid) in PcdsSet: - Value =3D PcdsSet[Name, Guid] - for PcdType in ["FixedAtBuild", "PatchableInModule", "= FeatureFlag", "Dynamic", "DynamicEx"]: - for Dec in self.Build[Arch].PackageDatabase: - Pcds =3D self.Build[Arch].PackageDatabase[Dec]= .Pcds - if (Name, Guid, PcdType) in Pcds: - Pcd =3D Pcds[(Name, Guid, PcdType)] - Type =3D PcdType - DatumType =3D Pcd.DatumType - Token =3D Pcd.TokenValue - MaxDatumSize =3D Pcd.MaxDatumSize - SkuInfoList =3D Pcd.SkuInfoList - Pb.Pcds[(Name, Guid)] =3D PcdClassObject(N= ame, Guid, Type, DatumType, Value, Token, MaxDatumSize, SkuInfoList, False) - break - else: - # nothing found - continue - # found in one package, find next PCD - break - else: - EdkLogger.error("AutoGen", PARSER_ERROR, "PCD is n= ot found in any package", ExtraData=3D"%s.%s" % (Guid, Name)) - # - # Add to database - # - self.Build[Arch].PlatformDatabase[Dsc] =3D Pb - Pb =3D None - - ## Generate PackageDatabase - # - # Go through each arch to get all items in DecDatabase to PackageDatab= ase - # - def GenPackageDatabase(self): - for Dec in self.DecDatabase.keys(): - Package =3D self.DecDatabase[Dec].Package - - for Arch in self.SupArchList: - Pb =3D PackageBuildClassObject() - - # - # Defines - # - Pb.DescFilePath =3D Dec - Pb.PackageName =3D Package.Header[Arch].Name - if Pb.PackageName =3D=3D '': - EdkLogger.error("AutoGen", PARSER_ERROR, "The BaseName= of package %s is not defined for arch %s" % (Dec, Arch)) - - Pb.Guid =3D Package.Header[Arch].Guid - Pb.Version =3D Package.Header[Arch].Version - - # - # Protocols - # - for Item in Package.ProtocolDeclarations: - if Arch in Item.SupArchList: - Pb.Protocols[Item.CName] =3D Item.Guid - - # - # Ppis - # - for Item in Package.PpiDeclarations: - if Arch in Item.SupArchList: - Pb.Ppis[Item.CName] =3D Item.Guid - - # - # Guids - # - for Item in Package.GuidDeclarations: - if Arch in Item.SupArchList: - Pb.Guids[Item.CName] =3D Item.Guid - - # - # Includes - # - for Item in Package.Includes: - if Arch in Item.SupArchList: - Pb.Includes.append(Item.FilePath) - - # - # LibraryClasses - # - for Item in Package.LibraryClassDeclarations: - if Arch in Item.SupArchList: - Pb.LibraryClasses[Item.LibraryClass] =3D Item.Reco= mmendedInstance - - # - # Pcds - # - for Item in Package.PcdDeclarations: - if Arch in Item.SupArchList: - Name =3D Item.CName - Guid =3D Item.TokenSpaceGuidCName - Type =3D Item.ItemType - DatumType =3D Item.DatumType - Value =3D Item.DefaultValue - Token =3D Item.Token - MaxDatumSize =3D Item.MaxDatumSize - SkuInfoList =3D Item.SkuInfoList - Pb.Pcds[(Name, Guid, Type)] =3D PcdClassObject(Nam= e, Guid, Type, DatumType, Value, Token, MaxDatumSize, SkuInfoList, False) - - # - # Add to database - # - self.Build[Arch].PackageDatabase[Dec] =3D Pb - Pb =3D None - - ## Generate ModuleDatabase - # - # Go through each arch to get all items in InfDatabase to ModuleDataba= se - # =20 - def GenModuleDatabase(self, InfList =3D []): - for Inf in self.InfDatabase.keys(): - Module =3D self.InfDatabase[Inf].Module - - for Arch in self.SupArchList: - if not self.IsModuleDefinedInPlatform(Inf, Arch, InfList) = or Arch not in Module.Header: - continue - - ModuleHeader =3D Module.Header[Arch] - Pb =3D ModuleBuildClassObject() - - # - # Defines - # - Pb.DescFilePath =3D Inf - Pb.BaseName =3D ModuleHeader.Name - if Pb.BaseName =3D=3D '': - EdkLogger.error("AutoGen", PARSER_ERROR, "The BaseName= of module %s is not defined for arch %s" % (Inf, Arch)) =20 - Pb.Guid =3D ModuleHeader.Guid - Pb.Version =3D ModuleHeader.Version - Pb.ModuleType =3D ModuleHeader.ModuleType - Pb.PcdIsDriver =3D ModuleHeader.PcdIsDriver - Pb.BinaryModule =3D ModuleHeader.BinaryModule - Pb.CustomMakefile =3D ModuleHeader.CustomMakefile - Pb.Shadow =3D ModuleHeader.Shadow - - # - # Specs os Defines - # - Pb.Specification =3D ModuleHeader.Specification - Pb.Specification[TAB_INF_DEFINES_EDK_RELEASE_VERSION] =3D = ModuleHeader.EdkReleaseVersion - Pb.Specification[TAB_INF_DEFINES_EFI_SPECIFICATION_VERSION= ] =3D ModuleHeader.UefiSpecificationVersion - Pb.Specification[TAB_INF_DEFINES_UEFI_SPECIFICATION_VERSIO= N] =3D ModuleHeader.UefiSpecificationVersion - Pb.AutoGenVersion =3D int(ModuleHeader.InfVersion, 0) - - # - # LibraryClass of Defines - # - for Item in ModuleHeader.LibraryClass: - Pb.LibraryClass.append(LibraryClassObject(Item.Library= Class, Item.SupModuleList, None)) - - # - # Module image and library of Defines - # - for Item in Module.ExternImages: - if Item.ModuleEntryPoint !=3D '' and Item.ModuleEntryP= oint not in Pb.ModuleEntryPointList: - Pb.ModuleEntryPointList.append(Item.ModuleEntryPoi= nt) - if Item.ModuleUnloadImage !=3D '' and Item.ModuleUnloa= dImage not in Pb.ModuleUnloadImageList: - Pb.ModuleUnloadImageList.append(Item.ModuleUnloadI= mage) - for Item in Module.ExternLibraries: - if Item.Constructor !=3D '' and Item.Constructor not i= n Pb.ConstructorList: - Pb.ConstructorList.append(Item.Constructor) - if Item.Destructor !=3D '' and Item.Destructor not in = Pb.DestructorList: - Pb.DestructorList.append(Item.Destructor) - - # - # Binaries - # - for Item in Module.Binaries: - if Arch in Item.SupArchList: - FileName =3D Item.BinaryFile - FileType =3D Item.FileType - Target =3D Item.Target - FeatureFlag =3D Item.FeatureFlag - Pb.Binaries.append(ModuleBinaryFileClass(FileName,= FileType, Target, FeatureFlag, Arch.split())) - - # - # Sources - # - for Item in Module.Sources: - if Arch in Item.SupArchList: - SourceFile =3D Item.SourceFile - TagName =3D Item.TagName - ToolCode =3D Item.ToolCode - ToolChainFamily =3D Item.ToolChainFamily - FeatureFlag =3D Item.FeatureFlag - Pb.Sources.append(ModuleSourceFileClass(SourceFile= , TagName, ToolCode, ToolChainFamily, FeatureFlag)) - - # - # Protocols - # - for Item in Module.Protocols: - if Arch in Item.SupArchList: - Pb.Protocols.append(Item.CName) - - # - # Ppis - # - for Item in Module.Ppis: - if Arch in Item.SupArchList: - Pb.Ppis.append(Item.CName) - - # - # Guids - # - for Item in Module.Guids: - if Arch in Item.SupArchList: - Pb.Ppis.append(Item.CName) - - # - # Includes - # - for Item in Module.Includes: - if Arch in Item.SupArchList: - Pb.Includes.append(Item.FilePath) - - # - # Packages - # - for Item in Module.PackageDependencies: - if Arch in Item.SupArchList: - Pb.Packages.append(Item.FilePath) - - # - # BuildOptions - # - for Item in Module.BuildOptions: - if Arch in Item.SupArchList: - if (Item.ToolChainFamily, Item.ToolChain) not in P= b.BuildOptions: - Pb.BuildOptions[(Item.ToolChainFamily, Item.To= olChain)] =3D Item.Option - else: - OptionString =3D Pb.BuildOptions[(Item.ToolCha= inFamily, Item.ToolChain)] - Pb.BuildOptions[(Item.ToolChainFamily, Item.To= olChain)] =3D OptionString + " " + Item.Option - self.FindBuildOptions(Arch, Inf, Pb.BuildOptions) - - # - # Depex - # - for Item in Module.Depex: - if Arch in Item.SupArchList: - Pb.Depex =3D Pb.Depex + Item.Depex + ' ' - Pb.Depex =3D Pb.Depex.strip() - - # - # LibraryClasses - # - for Item in Module.LibraryClasses: - if Arch in Item.SupArchList: - Lib =3D Item.LibraryClass - RecommendedInstance =3D Item.RecommendedInstance - if Pb.LibraryClass !=3D []: - # - # For Library - # - for Libs in Pb.LibraryClass: - for Type in Libs.SupModList: - Instance =3D self.FindLibraryClassInst= anceOfLibrary(Lib, Arch, Type) - if Instance is None: - Instance =3D RecommendedInstance - Pb.LibraryClasses[(Lib, Type)] =3D Ins= tance - else: - # - # For Module - # - Instance =3D self.FindLibraryClassInstanceOfMo= dule(Lib, Arch, Pb.ModuleType, Inf) - if Instance is None: - Instance =3D RecommendedInstance - Pb.LibraryClasses[(Lib, Pb.ModuleType)] =3D In= stance - - # - # Libraries - # - for Item in Module.Libraries: - if Arch in Item.SupArchList: - Pb.Libraries.append(Item.Library) - - # - # Pcds - # - for Item in Module.PcdCodes: - if Arch in Item.SupArchList: - Name =3D Item.CName - Guid =3D Item.TokenSpaceGuidCName - Type =3D Item.ItemType - Pb.Pcds[(Name, Guid)] =3D self.FindPcd(Arch, Inf, = Name, Guid, Type) - - # - # Add to database - # - self.Build[Arch].ModuleDatabase[Inf] =3D Pb - Pb =3D None - - ## Update Libraries Of Platform Database - # - # @param InfList: A list for all inf files - # - def UpdateLibrariesOfPlatform(self, InfList =3D []): - for Arch in self.SupArchList: - PlatformDatabase =3D self.Build[Arch].PlatformDatabase - for Dsc in PlatformDatabase: - Platform =3D PlatformDatabase[Dsc] - for Inf in Platform.Modules: - if not self.IsModuleDefinedInPlatform(Inf, Arch, InfLi= st): - continue - Module =3D self.Build[Arch].ModuleDatabase[Inf] - if Module.LibraryClass is None or Module.LibraryClass = =3D=3D []: - self.UpdateLibrariesOfModule(Platform, Module, Arc= h) - for Key in Module.LibraryClasses: - Lib =3D Module.LibraryClasses[Key] - if Lib not in Platform.LibraryInstances: - Platform.LibraryInstances.append(Lib) - - - ## Update Libraries Of Module Database - # - # @param Module: The module need to be updated libraries - # @param Arch: The supportted arch of the module - # - def UpdateLibrariesOfModule(self, Platform, Module, Arch): - ModuleDatabase =3D self.Build[Arch].ModuleDatabase - ModuleType =3D Module.ModuleType - - # check Edk module - if Module.AutoGenVersion < 0x00010005: - EdkLogger.verbose("") - EdkLogger.verbose("Library instances of module [%s] [%s]:" % (= str(Module), Arch)) - LibraryConsumerList =3D [Module] - - # "CompilerStub" is a must for Edk modules - Module.Libraries.append("CompilerStub") - while len(LibraryConsumerList) > 0: - M =3D LibraryConsumerList.pop() - for LibraryName in M.Libraries: - if LibraryName not in Platform.Libraries: - EdkLogger.warn("AutoGen", "Library [%s] is not fou= nd" % LibraryName, - ExtraData=3D"\t%s [%s]" % (str(Mod= ule), Arch)) - continue - =20 - LibraryFile =3D Platform.Libraries[LibraryName] - if (LibraryName, ModuleType) not in Module.LibraryClas= ses: - Module.LibraryClasses[LibraryName, ModuleType] =3D= LibraryFile - LibraryConsumerList.append(ModuleDatabase[LibraryF= ile]) - EdkLogger.verbose("\t" + LibraryName + " : " + Lib= raryFile) - return - - # EdkII module - LibraryConsumerList =3D [Module] - Constructor =3D [] - ConsumedByList =3D sdict() - LibraryInstance =3D sdict() - - EdkLogger.verbose("") - EdkLogger.verbose("Library instances of module [%s] [%s]:" % (str(= Module), Arch)) - while len(LibraryConsumerList) > 0: - M =3D LibraryConsumerList.pop() - for Key, LibraryPath in M.LibraryClasses.iteritems(): - # The "Key" is in format of (library_class_name, supported= _module_type) - if ModuleType !=3D "USER_DEFINED" and ModuleType not in Ke= y: - EdkLogger.debug(EdkLogger.DEBUG_3, "%s for module type= %s is not supported (%s)" % (Key + (LibraryPath,))) - continue - - LibraryClassName =3D Key[0] - if LibraryClassName not in LibraryInstance or LibraryInsta= nce[LibraryClassName] is None: - if LibraryPath is None or LibraryPath =3D=3D "": - LibraryInstance[LibraryClassName] =3D None - continue - LibraryModule =3D ModuleDatabase[LibraryPath] - LibraryInstance[LibraryClassName] =3D LibraryModule - LibraryConsumerList.append(LibraryModule) - EdkLogger.verbose("\t" + LibraryClassName + " : " + st= r(LibraryModule)) - elif LibraryPath is None or LibraryPath =3D=3D "": - continue - else: - LibraryModule =3D LibraryInstance[LibraryClassName] - - if LibraryModule.ConstructorList !=3D [] and LibraryModule= not in Constructor: - Constructor.append(LibraryModule) - - if LibraryModule not in ConsumedByList: - ConsumedByList[LibraryModule] =3D [] - if M !=3D Module: - if M in ConsumedByList[LibraryModule]: - continue - ConsumedByList[LibraryModule].append(M) - # - # Initialize the sorted output list to the empty set - # - SortedLibraryList =3D [] - # - # Q <- Set of all nodes with no incoming edges - # - LibraryList =3D [] #LibraryInstance.values() - Q =3D [] - for LibraryClassName in LibraryInstance: - M =3D LibraryInstance[LibraryClassName] - if M is None: - EdkLogger.error("AutoGen", AUTOGEN_ERROR, - "Library instance for library class [%s] i= s not found" % LibraryClassName, - ExtraData=3D"\t%s [%s]" % (str(Module), Ar= ch)) - LibraryList.append(M) - # - # check if there're duplicate library classes - # - for Lc in M.LibraryClass: - if Lc.SupModList is not None and ModuleType not in Lc.SupM= odList: - EdkLogger.error("AutoGen", AUTOGEN_ERROR, - "Module type [%s] is not supported by = library instance [%s]" % (ModuleType, str(M)), - ExtraData=3D"\t%s" % str(Module)) - - if Lc.LibraryClass in LibraryInstance and str(M) !=3D str(= LibraryInstance[Lc.LibraryClass]): - EdkLogger.error("AutoGen", AUTOGEN_ERROR, - "More than one library instance found = for library class [%s] in module [%s]" % (Lc.LibraryClass, Module), - ExtraData=3D"\t%s\n\t%s" % (LibraryIns= tance[Lc.LibraryClass], str(M)) - ) - if ConsumedByList[M] =3D=3D []: - Q.insert(0, M) - # - # while Q is not empty do - # - while Q !=3D []: - # - # remove node from Q - # - Node =3D Q.pop() - # - # output Node - # - SortedLibraryList.append(Node) - # - # for each node Item with an edge e from Node to Item do - # - for Item in LibraryList: - if Node not in ConsumedByList[Item]: - continue - # - # remove edge e from the graph - # - ConsumedByList[Item].remove(Node) - # - # If Item has no other incoming edges then - # - if ConsumedByList[Item] =3D=3D []: - # - # insert Item into Q - # - Q.insert(0, Item) - - EdgeRemoved =3D True - while Q =3D=3D [] and EdgeRemoved: - EdgeRemoved =3D False - # - # for each node Item with a Constructor - # - for Item in LibraryList: - if Item in Constructor: - # - # for each Node without a constructor with an edge= e from Item to Node - # - for Node in ConsumedByList[Item]: - if Node not in Constructor: - # - # remove edge e from the graph - # - ConsumedByList[Item].remove(Node) - EdgeRemoved =3D True - if ConsumedByList[Item] =3D=3D []: - # - # insert Item into Q - # - Q.insert(0, Item) - break - if Q !=3D []: - break - - # - # if any remaining node Item in the graph has a constructor and an= incoming edge, then the graph has a cycle - # - for Item in LibraryList: - if ConsumedByList[Item] !=3D [] and Item in Constructor and le= n(Constructor) > 1: - ErrorMessage =3D 'Library [%s] with constructors has a cyc= le' % str(Item) - EdkLogger.error("AutoGen", AUTOGEN_ERROR, ErrorMessage, - "\tconsumed by " + "\n\tconsumed by ".join= ([str(L) for L in ConsumedByList[Item]])) - if Item not in SortedLibraryList: - SortedLibraryList.append(Item) - - # - # Build the list of constructor and destructir names - # The DAG Topo sort produces the destructor order, so the list of = constructors must generated in the reverse order - # - SortedLibraryList.reverse() - Module.LibraryClasses =3D sdict() - for L in SortedLibraryList: - for Lc in L.LibraryClass: - Module.LibraryClasses[Lc.LibraryClass, ModuleType] =3D str= (L) - # - # Merge PCDs from library instance - # - for Key in L.Pcds: - if Key not in Module.Pcds: - LibPcd =3D L.Pcds[Key] - Module.Pcds[Key] =3D self.FindPcd(Arch, str(Module), L= ibPcd.TokenCName, LibPcd.TokenSpaceGuidCName, LibPcd.Type) - # - # Merge GUIDs from library instance - # - for CName in L.Guids: - if CName not in Module.Guids: - Module.Guids.append(CName) - # - # Merge Protocols from library instance - # - for CName in L.Protocols: - if CName not in Module.Protocols: - Module.Protocols.append(CName) - # - # Merge Ppis from library instance - # - for CName in L.Ppis: - if CName not in Module.Ppis: - Module.Ppis.append(CName) - - ## GenBuildDatabase - # - # Generate build database for all arches - # - # @param PcdsSet: Pcd list for override from Fdf parse result - # @param InfList: Inf list for override from Fdf parse result - # - def GenBuildDatabase(self, PcdsSet =3D {}, InfList =3D []): - # - # Add additional inf file defined in Fdf file - # - for InfFile in InfList: - self.AddToInfDatabase(NormPath(InfFile)) - =20 - # - # Generate PlatformDatabase, PackageDatabase and ModuleDatabase - # - self.GenPackageDatabase() - self.GenPlatformDatabase(PcdsSet) - self.GenModuleDatabase(InfList) - =20 - self.Db.Close() - =20 - # - # Update Libraries Of Platform - # - self.UpdateLibrariesOfPlatform(InfList) - =20 - # - # Output used Pcds not found in DSC file - # - self.ShowUnFoundPcds() - - ## ShowUnFoundPcds() - # - # If there is any pcd used but not defined in DSC - # Print warning message on screen and output a list of pcds - # - def ShowUnFoundPcds(self): - if self.UnFoundPcdInDsc !=3D {}: - WrnMessage =3D '**** WARNING ****\n' - WrnMessage +=3D 'The following Pcds were not defined in the DS= C file: %s\n' % self.DscFileName - WrnMessage +=3D 'The default values were obtained from the DEC= file that declares the PCD and the PCD default value\n' - for (Guid, Name, Type, Arch) in self.UnFoundPcdInDsc: - Dec =3D self.UnFoundPcdInDsc[(Guid, Name, Type, Arch)] - Pcds =3D self.Build[Arch].PackageDatabase[Dec].Pcds - if (Name, Guid, Type) in Pcds: - Pcd =3D Pcds[(Name, Guid, Type)] - PcdItemTypeUsed =3D Pcd.Type - DefaultValue =3D Pcd.DefaultValue - WrnMessage +=3D '%s.%s: Defined in file %s, PcdItemTyp= e is Pcds%s, DefaultValue is %s\n' % (Guid, Name, Dec, PcdItemTypeUsed, Def= aultValue) - EdkLogger.verbose(WrnMessage) - =20 - ## Create a full path with workspace dir - # - # Convert Filename with workspace dir to create a full path - # - # @param Filename: The filename need to be added workspace dir - # - # @retval string Full path - # - def WorkspaceFile(self, Filename): - return WorkspaceFile(self.WorkspaceDir, Filename) - - ## Update LibraryClass of Module - # - # If a module of a platform has its own override libraryclass but the = libraryclass not defined in the module - # Add this libraryclass to the module - # - # @param InfFileName: InfFileName specificed in platform - # @param LibraryClass: LibraryClass specificed in platform - # @param Arch: Supportted Arch - # @param InstanceFilePath: InstanceFilePath specificed in platform - # - def UpdateLibraryClassOfModule(self, InfFileName, LibraryClass, Arch, = InstanceFilePath): - # - # Update the library instance itself to add this libraryclass name - # - LibraryModule =3D self.InfDatabase[InstanceFilePath].Module - LibList =3D LibraryModule.Header[Arch].LibraryClass - NotFound =3D True - for Lib in LibList: - # - # Find this LibraryClass - # - if Lib.LibraryClass =3D=3D LibraryClass: - NotFound =3D False; - break; - if NotFound: - NewLib =3D LibraryClassClass() - NewLib.LibraryClass =3D LibraryClass - NewLib.SupModuleList =3D DataType.SUP_MODULE_LIST # LibraryMod= ule.Header[Arch].ModuleType.split() - LibraryModule.Header[Arch].LibraryClass.append(NewLib) - - # - # Add it to LibraryClasses Section for the module which is using t= he library - # - Module =3D self.InfDatabase[InfFileName].Module - LibList =3D Module.LibraryClasses - NotFound =3D True - for Lib in LibList: - # - # Find this LibraryClass - # - if Lib.LibraryClass =3D=3D LibraryClass: - if Arch in Lib.SupArchList: - return - else: - Lib.SupArchList.append(Arch) - return - if NotFound: - Lib =3D LibraryClassClass() - Lib.LibraryClass =3D LibraryClass - Lib.SupArchList =3D [Arch] - Module.LibraryClasses.append(Lib) - - ## Add Inf file to InfDatabase - # - # Create a Inf instance for input inf file and add it to InfDatabase - # - # @param InfFileName: The InfFileName need to be added to database - # - def AddToInfDatabase(self, InfFileName): - File =3D self.WorkspaceFile(InfFileName) - if os.path.exists(File) and os.path.isfile(File): - if InfFileName not in self.InfDatabase: - self.InfDatabase[InfFileName] =3D Inf(File, False, True, s= elf.WorkspaceDir, self.Db, self.SupArchList) - else: - EdkLogger.error("AutoGen", FILE_NOT_FOUND, ExtraData=3DFile) - - ## Add Dec file to DecDatabase - # - # Create a Dec instance for input dec file and add it to DecDatabase - # - # @param DecFileName: The DecFileName need to be added to database - # - def AddToDecDatabase(self, DecFileName): - File =3D self.WorkspaceFile(DecFileName) - if os.path.exists(File) and os.path.isfile(File): - if DecFileName not in self.DecDatabase: - self.DecDatabase[DecFileName] =3D Dec(File, False, True, s= elf.WorkspaceDir, self.Db, self.SupArchList) - else: - EdkLogger.error("AutoGen", FILE_NOT_FOUND, ExtraData=3DFile) - - ## Search LibraryClass Instance for Module - # - # Search PlatformBuildDatabase to find LibraryClass Instance for Module - # Return the instance if found - # - # @param Lib: Input value for Library Class Name - # @param Arch: Supportted Arch - # @param ModuleType: Supportted ModuleType - # @param ModuleName: Input value for Module Name - # - # @retval string Found LibraryClass Instance file path - # - def FindLibraryClassInstanceOfModule(self, Lib, Arch, ModuleType, Modu= leName): - # - # First find if exist in of from dsc f= ile - # - for Dsc in self.DscDatabase.keys(): - Platform =3D self.DscDatabase[Dsc].Platform - for Module in Platform.Modules.ModuleList: - if Arch in Module.SupArchList: - if Module.FilePath =3D=3D ModuleName: - for LibraryClass in Module.LibraryClasses.LibraryL= ist: - if LibraryClass.Name =3D=3D Lib: - return LibraryClass.FilePath - # - #Second find if exist in of from d= sc file - # - return self.FindLibraryClassInstanceOfLibrary(Lib, Arch, ModuleTyp= e) - - ## Search LibraryClass Instance for Library - # - # Search PlatformBuildDatabase to find LibraryClass Instance for Libra= ry - # Return the instance if found - # - # @param Lib: Input value for Library Class Name - # @param Arch: Supportted Arch - # @param Type: Supportted Library Usage Type - # - # @retval string Found LibraryClass Instance file path - # @retval None Not Found - # - def FindLibraryClassInstanceOfLibrary(self, Lib, Arch, Type): - for Dsc in self.DscDatabase.keys(): - Platform =3D self.DscDatabase[Dsc].Platform - if (Lib, Type) in self.Build[Arch].PlatformDatabase[Dsc].Libra= ryClasses: - return self.Build[Arch].PlatformDatabase[Dsc].LibraryClass= es[(Lib, Type)] - elif (Lib, '') in self.Build[Arch].PlatformDatabase[Dsc].Libra= ryClasses: - return self.Build[Arch].PlatformDatabase[Dsc].LibraryClass= es[(Lib, '')] - return None - - ## Find BuildOptions - # - # Search DscDatabase to find component definition of ModuleName - # Override BuildOption if it is defined in component - # - # @param Arch: Supportted Arch - # @param ModuleName: The module which has buildoption definition in= component of platform - # @param BuildOptions: The set of all buildopitons - # - def FindBuildOptions(self, Arch, ModuleName, BuildOptions): - for Dsc in self.DscDatabase.keys(): - # - # First find if exist in of from d= sc file - # if find, use that override the one defined in inf file - # - Platform =3D self.DscDatabase[Dsc].Platform - for Module in Platform.Modules.ModuleList: - if Arch in Module.SupArchList: - if Module.FilePath =3D=3D ModuleName: - for BuildOption in Module.ModuleSaBuildOption.Buil= dOptionList: - # - # Add to BuildOptions - # - BuildOptions[(BuildOption.ToolChainFamily, Bui= ldOption.ToolChain)] =3D BuildOption.Option - - ## Find Pcd - # - # Search platform database, package database, module database and Pcds= Set from Fdf - # Return found Pcd - # - # @param Arch: Supportted Arch - # @param ModuleName: The module which has pcd definition in component= of platform - # @param Name: Name of Pcd - # @param Guid: Guid of Pcd - # @param Type: Type of Pcd - # - # @retval PcdClassObject An instance for PcdClassObject with all membe= rs filled - # - def FindPcd(self, Arch, ModuleName, Name, Guid, Type): - NewType =3D '' - DatumType =3D '' - Value =3D '' - Token =3D '' - MaxDatumSize =3D '' - SkuInfoList =3D {} - IsOverrided =3D False - IsFoundInDsc =3D False - IsFoundInDec =3D False - FoundInDecFile =3D '' - =20 - # - # Second get information from platform database - # - OwnerPlatform =3D '' - for Dsc in self.Build[Arch].PlatformDatabase.keys(): - Pcds =3D self.Build[Arch].PlatformDatabase[Dsc].Pcds - if (Name, Guid) in Pcds: - OwnerPlatform =3D Dsc - Pcd =3D Pcds[(Name, Guid)] - if Pcd.Type !=3D '' and Pcd.Type is not None: - NewType =3D Pcd.Type - if NewType in DataType.PCD_DYNAMIC_TYPE_LIST: - NewType =3D DataType.TAB_PCDS_DYNAMIC - elif NewType in DataType.PCD_DYNAMIC_EX_TYPE_LIST: - NewType =3D DataType.TAB_PCDS_DYNAMIC_EX - else: - NewType =3D Type - - if Type !=3D '' and Type !=3D NewType: - ErrorMsg =3D "PCD %s.%s is declared as [%s] in module\= n\t%s\n\n"\ - " But it's used as [%s] in platform\n\t%= s"\ - % (Guid, Name, Type, ModuleName, NewType, O= wnerPlatform) - EdkLogger.error("AutoGen", PARSER_ERROR, ErrorMsg) - - - if Pcd.DatumType !=3D '' and Pcd.DatumType is not None: - DatumType =3D Pcd.DatumType - if Pcd.TokenValue !=3D '' and Pcd.TokenValue is not None: - Token =3D Pcd.TokenValue - if Pcd.DefaultValue !=3D '' and Pcd.DefaultValue is not No= ne: - Value =3D Pcd.DefaultValue - if Pcd.MaxDatumSize !=3D '' and Pcd.MaxDatumSize is not No= ne: - MaxDatumSize =3D Pcd.MaxDatumSize - SkuInfoList =3D Pcd.SkuInfoList - =20 - IsOverrided =3D True - IsFoundInDsc =3D True - break - - # - # Third get information from of from module da= tabase - # - for Dsc in self.DscDatabase.keys(): - for Module in self.DscDatabase[Dsc].Platform.Modules.ModuleLis= t: - if Arch in Module.SupArchList: - if Module.FilePath =3D=3D ModuleName: - for Pcd in Module.PcdBuildDefinitions: - if (Name, Guid) =3D=3D (Pcd.CName, Pcd.TokenSp= aceGuidCName): - if Pcd.DefaultValue !=3D '': - Value =3D Pcd.DefaultValue - if Pcd.MaxDatumSize !=3D '': - MaxDatumSize =3D Pcd.MaxDatumSize - =20 - IsFoundInDsc =3D True - IsOverrided =3D True - break - - # - # First get information from package database - # - Pcd =3D None - if NewType =3D=3D '': - if Type !=3D '': - PcdTypeList =3D [Type] - else: - PcdTypeList =3D ["FixedAtBuild", "PatchableInModule", "Fea= tureFlag", "Dynamic", "DynamicEx"] - - for Dec in self.Build[Arch].PackageDatabase.keys(): - Pcds =3D self.Build[Arch].PackageDatabase[Dec].Pcds - for PcdType in PcdTypeList: - if (Name, Guid, PcdType) in Pcds: - Pcd =3D Pcds[(Name, Guid, PcdType)] - NewType =3D PcdType - IsOverrided =3D True - IsFoundInDec =3D True - FoundInDecFile =3D Dec - break - else: - continue - break - else: - for Dec in self.Build[Arch].PackageDatabase.keys(): - Pcds =3D self.Build[Arch].PackageDatabase[Dec].Pcds - if (Name, Guid, NewType) in Pcds: - Pcd =3D Pcds[(Name, Guid, NewType)] - IsOverrided =3D True - IsFoundInDec =3D True - FoundInDecFile =3D Dec - break - - if not IsFoundInDec: - ErrorMsg =3D "Pcd '%s.%s [%s]' defined in module '%s' is not f= ound in any package for Arch '%s'" % (Guid, Name, NewType, ModuleName, Arch) - EdkLogger.error("AutoGen", PARSER_ERROR, ErrorMsg) - - # - # Not found in any platform and fdf - # - if not IsFoundInDsc: - Value =3D Pcd.DefaultValue - if NewType.startswith("Dynamic") and SkuInfoList =3D=3D {}: - SkuIds =3D self.Build[Arch].PlatformDatabase.values()[0].S= kuIds - SkuInfoList['DEFAULT'] =3D SkuInfoClass(SkuIdName=3D'DEFAU= LT', SkuId=3DSkuIds['DEFAULT'], DefaultValue=3DValue) - self.UnFoundPcdInDsc[(Guid, Name, NewType, Arch)] =3D FoundInD= ecFile - #elif Type !=3D '' and NewType.startswith("Dynamic"): - # NewType =3D Pcd.Type - DatumType =3D Pcd.DatumType - if Token in [None, '']: - Token =3D Pcd.TokenValue - if DatumType =3D=3D "VOID*" and MaxDatumSize in ['', None]: - EdkLogger.verbose("No MaxDatumSize specified for PCD %s.%s in = module [%s]" % (Guid, Name, ModuleName)) - if Value[0] =3D=3D 'L': - MaxDatumSize =3D str(len(Value) * 2) - elif Value[0] =3D=3D '{': - MaxDatumSize =3D str(len(Value.split(','))) - else: - MaxDatumSize =3D str(len(Value)) - - return PcdClassObject(Name, Guid, NewType, DatumType, Value, Token= , MaxDatumSize, SkuInfoList, IsOverrided) - - ## Find Supportted Module List Of LibraryClass - # - # Search in InfDatabase, find the supmodulelist of the libraryclass - # - # @param LibraryClass: LibraryClass name for search - # @param OverridedLibraryClassList: A list of all LibraryClass - # @param Arch: Supportted Arch - # - # @retval list SupModuleList - # - def FindSupModuleListOfLibraryClass(self, LibraryClass, OverridedLibra= ryClassList, Arch): - Name =3D LibraryClass.Name - FilePath =3D LibraryClass.FilePath - SupModuleList =3D copy.copy(LibraryClass.SupModuleList) - - # - # If the SupModuleList means all, remove overrided module types of= platform - # - if SupModuleList =3D=3D DataType.SUP_MODULE_LIST: - EdkLogger.debug(EdkLogger.DEBUG_3, "\tLibraryClass %s supports= all module types" % Name) - for Item in OverridedLibraryClassList: - # - # Find a library class (Item) with the same name - # - if Item.Name =3D=3D Name: - # - # Do nothing if it is itself - # - if Item.SupModuleList =3D=3D DataType.SUP_MODULE_LIST: - continue - # - # If not itself, check arch first - # - if Arch in LibraryClass.SupArchList: - # - # If arch is supportted, remove all related module= type - # - if Arch in Item.SupArchList: - for ModuleType in Item.SupModuleList: - EdkLogger.debug(EdkLogger.DEBUG_3, "\tLibr= aryClass %s has specific defined module types" % Name) - if ModuleType in SupModuleList: - SupModuleList.remove(ModuleType) - - return SupModuleList - - ## Find Module inf Platform - # - # Check if the module is defined in of - # - # @param Inf: Inf file (Module) need to be searched - # @param Arch: Supportted Arch - # @param InfList: A list for all Inf file - # - # @retval True Mudule Found - # @retval Flase Module Not Found - # - def IsModuleDefinedInPlatform(self, Inf, Arch, InfList): - for Dsc in self.DscDatabase.values(): - for LibraryClass in Dsc.Platform.LibraryClasses.LibraryList: - if Inf =3D=3D LibraryClass.FilePath and Arch in LibraryCla= ss.SupArchList: - return True - for Module in Dsc.Platform.Modules.ModuleList: - if Inf =3D=3D Module.FilePath and Arch in Module.SupArchLi= st: - return True - for Item in Module.LibraryClasses.LibraryList: - if Inf =3D=3D Item.FilePath: - return True - for Library in Dsc.Platform.Libraries.LibraryList: - if Inf =3D=3D Library.FilePath and Arch in Library.SupArch= List: - return True - - return False - - ## Show all content of the workspacebuild - # - # Print each item of the workspacebuild with (Key =3D Value) pair - # - def ShowWorkspaceBuild(self): - print self.DscDatabase - print self.InfDatabase - print self.DecDatabase - print 'SupArchList', self.SupArchList - print 'BuildTarget', self.BuildTarget - print 'SkuId', self.SkuId - - for Arch in self.SupArchList: - print Arch - print 'Platform' - for Platform in self.Build[Arch].PlatformDatabase.keys(): - P =3D self.Build[Arch].PlatformDatabase[Platform] - print 'DescFilePath =3D ', P.DescFilePath - print 'PlatformName =3D ', P.PlatformName - print 'Guid =3D ', P.Guid - print 'Version =3D ', P.Version - print 'OutputDirectory =3D ', P.OutputDirectory - print 'FlashDefinition =3D ', P.FlashDefinition - print 'SkuIds =3D ', P.SkuIds - print 'Modules =3D ', P.Modules - print 'LibraryClasses =3D ', P.LibraryClasses - print 'Pcds =3D ', P.Pcds - for item in P.Pcds.keys(): - print P.Pcds[item] - print 'BuildOptions =3D ', P.BuildOptions - print '' - # End of Platform - - print 'package' - for Package in self.Build[Arch].PackageDatabase.keys(): - P =3D self.Build[Arch].PackageDatabase[Package] - print 'DescFilePath =3D ', P.DescFilePath - print 'PackageName =3D ', P.PackageName - print 'Guid =3D ', P.Guid - print 'Version =3D ', P.Version - print 'Protocols =3D ', P.Protocols - print 'Ppis =3D ', P.Ppis - print 'Guids =3D ', P.Guids - print 'Includes =3D ', P.Includes - print 'LibraryClasses =3D ', P.LibraryClasses - print 'Pcds =3D ', P.Pcds - for item in P.Pcds.keys(): - print P.Pcds[item] - print '' - # End of Package - - print 'module' - for Module in self.Build[Arch].ModuleDatabase.keys(): - P =3D self.Build[Arch].ModuleDatabase[Module] - print 'DescFilePath =3D ', P.DescFilePath - print 'BaseName =3D ', P.BaseName - print 'ModuleType =3D ', P.ModuleType - print 'Guid =3D ', P.Guid - print 'Version =3D ', P.Version - print 'CustomMakefile =3D ', P.CustomMakefile - print 'Specification =3D ', P.Specification - print 'Shadow =3D ', P.Shadow - print 'PcdIsDriver =3D ', P.PcdIsDriver - for Lib in P.LibraryClass: - print 'LibraryClassDefinition =3D ', Lib.LibraryClass,= 'SupModList =3D ', Lib.SupModList - print 'ModuleEntryPointList =3D ', P.ModuleEntryPointList - print 'ModuleUnloadImageList =3D ', P.ModuleUnloadImageList - print 'ConstructorList =3D ', P.ConstructorList - print 'DestructorList =3D ', P.DestructorList - - print 'Binaries =3D ' - for item in P.Binaries: - print item.BinaryFile, item.FeatureFlag, item.SupArchL= ist - print 'Sources =3D ' - for item in P.Sources: - print item.SourceFile - print 'LibraryClasses =3D ', P.LibraryClasses - print 'Protocols =3D ', P.Protocols - print 'Ppis =3D ', P.Ppis - print 'Guids =3D ', P.Guids - print 'Includes =3D ', P.Includes - print 'Packages =3D ', P.Packages - print 'Pcds =3D ', P.Pcds - for item in P.Pcds.keys(): - print P.Pcds[item] - print 'BuildOptions =3D ', P.BuildOptions - print 'Depex =3D ', P.Depex - print '' - # End of Module - -## -# -# This acts like the main() function for the script, unless it is 'import'= ed into another -# script. -# -if __name__ =3D=3D '__main__': - print 'Start!', time.strftime('%H:%M:%S', time.localtime()) - EdkLogger.Initialize() - EdkLogger.SetLevel(EdkLogger.QUIET) - =20 - W =3D os.getenv('WORKSPACE') - Ewb =3D WorkspaceBuild('Nt32Pkg/Nt32Pkg.dsc', W) - Ewb.GenBuildDatabase({('PcdDevicePathSupportDevicePathFromText', 'gEfi= MdeModulePkgTokenSpaceGuid') : 'KKKKKKKKKKKKKKKKKKKKK'}, ['Test.Inf']) - print 'Done!', time.strftime('%H:%M:%S', time.localtime()) - Ewb.ShowWorkspaceBuild() diff --git a/BaseTools/Source/Python/Makefile b/BaseTools/Source/Python/Mak= efile index ce5541b513..e1451e7fae 100644 --- a/BaseTools/Source/Python/Makefile +++ b/BaseTools/Source/Python/Makefile @@ -39,11 +39,10 @@ COMMON_PYTHON=3D$(BASE_TOOLS_PATH)\Source\Python\Common= \BuildToolError.py \ $(BASE_TOOLS_PATH)\Source\Python\Common\DataType.py \ $(BASE_TOOLS_PATH)\Source\Python\Common\DecClassObject.py \ $(BASE_TOOLS_PATH)\Source\Python\Common\Dictionary.py \ $(BASE_TOOLS_PATH)\Source\Python\Common\DscClassObject.py \ $(BASE_TOOLS_PATH)\Source\Python\Common\EdkIIWorkspace.py \ - $(BASE_TOOLS_PATH)\Source\Python\Common\EdkIIWorkspaceBuild.= py \ $(BASE_TOOLS_PATH)\Source\Python\Common\EdkLogger.py \ $(BASE_TOOLS_PATH)\Source\Python\Common\Expression.py \ $(BASE_TOOLS_PATH)\Source\Python\Common\FdfClassObject.py \ $(BASE_TOOLS_PATH)\Source\Python\Common\FdfParserLite.py \ $(BASE_TOOLS_PATH)\Source\Python\Common\GlobalData.py \ --=20 2.12.2.windows.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel