## @file\r
# process depex section generation\r
#\r
-# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
#\r
-# This program and the accompanying materials\r
-# are licensed and made available under the terms and conditions of the BSD License\r
-# which accompanies this distribution. The full text of the license may be found at\r
-# http://opensource.org/licenses/bsd-license.php\r
-#\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
#\r
\r
##\r
# Import Modules\r
#\r
-import Section\r
-from GenFdsGlobalVariable import GenFdsGlobalVariable\r
-import subprocess\r
-from Ffs import Ffs\r
+from __future__ import absolute_import\r
+from . import Section\r
+from .GenFdsGlobalVariable import GenFdsGlobalVariable\r
import Common.LongFilePathOs as os\r
from CommonDataClass.FdfClass import DepexSectionClassObject\r
from AutoGen.GenDepex import DependencyExpression\r
from Common import EdkLogger\r
from Common.BuildToolError import *\r
+from Common.Misc import PathClass\r
+from Common.DataType import *\r
\r
## generate data section\r
#\r
\r
def __FindGuidValue(self, CName):\r
for Arch in GenFdsGlobalVariable.ArchList:\r
- for PkgDb in GenFdsGlobalVariable.WorkSpace.GetPackageList(GenFdsGlobalVariable.ActivePlatform, \r
- Arch, \r
- GenFdsGlobalVariable.TargetName, \r
- GenFdsGlobalVariable.ToolChainTag):\r
+ PkgList = GenFdsGlobalVariable.WorkSpace.GetPackageList(GenFdsGlobalVariable.ActivePlatform,\r
+ Arch,\r
+ GenFdsGlobalVariable.TargetName,\r
+ GenFdsGlobalVariable.ToolChainTag)\r
+ for Inf in GenFdsGlobalVariable.FdfParser.Profile.InfList:\r
+ ModuleData = GenFdsGlobalVariable.WorkSpace.BuildObject[\r
+ PathClass(Inf, GenFdsGlobalVariable.WorkSpaceDir),\r
+ Arch,\r
+ GenFdsGlobalVariable.TargetName,\r
+ GenFdsGlobalVariable.ToolChainTag\r
+ ]\r
+ for Pkg in ModuleData.Packages:\r
+ if Pkg not in PkgList:\r
+ PkgList.append(Pkg)\r
+ for PkgDb in PkgList:\r
if CName in PkgDb.Ppis:\r
return PkgDb.Ppis[CName]\r
if CName in PkgDb.Protocols:\r
# @param Dict dictionary contains macro and its value\r
# @retval tuple (Generated file name list, section alignment)\r
#\r
- def GenSection(self, OutputPath, ModuleName, SecNum, keyStringList, FfsFile = None, Dict = {}):\r
- \r
+ def GenSection(self, OutputPath, ModuleName, SecNum, keyStringList, FfsFile = None, Dict = None, IsMakefile = False):\r
if self.ExpressionProcessed == False:\r
self.Expression = self.Expression.replace("\n", " ").replace("\r", " ")\r
ExpList = self.Expression.split()\r
- ExpGuidDict = {}\r
\r
for Exp in ExpList:\r
if Exp.upper() not in ('AND', 'OR', 'NOT', 'TRUE', 'FALSE', 'SOR', 'BEFORE', 'AFTER', 'END'):\r
GuidStr = self.__FindGuidValue(Exp)\r
- if GuidStr == None:\r
+ if GuidStr is None:\r
EdkLogger.error("GenFds", RESOURCE_NOT_AVAILABLE,\r
"Depex GUID %s could not be found in build DB! (ModuleName: %s)" % (Exp, ModuleName))\r
\r
- ExpGuidDict[Exp] = GuidStr\r
-\r
- for Item in ExpGuidDict:\r
- self.Expression = self.Expression.replace(Item, ExpGuidDict[Item])\r
+ self.Expression = self.Expression.replace(Exp, GuidStr)\r
\r
self.Expression = self.Expression.strip()\r
self.ExpressionProcessed = True\r
\r
if self.DepexType == 'PEI_DEPEX_EXP':\r
- ModuleType = 'PEIM'\r
- SecType = 'PEI_DEPEX'\r
+ ModuleType = SUP_MODULE_PEIM\r
+ SecType = BINARY_FILE_TYPE_PEI_DEPEX\r
elif self.DepexType == 'DXE_DEPEX_EXP':\r
- ModuleType = 'DXE_DRIVER'\r
- SecType = 'DXE_DEPEX'\r
+ ModuleType = SUP_MODULE_DXE_DRIVER\r
+ SecType = BINARY_FILE_TYPE_DXE_DEPEX\r
elif self.DepexType == 'SMM_DEPEX_EXP':\r
- ModuleType = 'DXE_SMM_DRIVER'\r
- SecType = 'SMM_DEPEX'\r
+ ModuleType = SUP_MODULE_DXE_SMM_DRIVER\r
+ SecType = BINARY_FILE_TYPE_SMM_DEPEX\r
else:\r
EdkLogger.error("GenFds", FORMAT_INVALID,\r
"Depex type %s is not valid for module %s" % (self.DepexType, ModuleName))\r
\r
- InputFile = os.path.join (OutputPath, ModuleName + 'SEC' + SecNum + '.depex')\r
+ InputFile = os.path.join (OutputPath, ModuleName + SUP_MODULE_SEC + SecNum + '.depex')\r
InputFile = os.path.normpath(InputFile)\r
Depex = DependencyExpression(self.Expression, ModuleType)\r
Depex.Generate(InputFile)\r
\r
- OutputFile = os.path.join (OutputPath, ModuleName + 'SEC' + SecNum + '.dpx')\r
+ OutputFile = os.path.join (OutputPath, ModuleName + SUP_MODULE_SEC + SecNum + '.dpx')\r
OutputFile = os.path.normpath(OutputFile)\r
\r
- GenFdsGlobalVariable.GenerateSection(OutputFile, [InputFile], Section.Section.SectionType.get (SecType))\r
- FileList = [OutputFile]\r
- return FileList, self.Alignment\r
+ GenFdsGlobalVariable.GenerateSection(OutputFile, [InputFile], Section.Section.SectionType.get (SecType), IsMakefile=IsMakefile)\r
+ return [OutputFile], self.Alignment\r