## @file
# This file is used to create report for Eot tool
#
# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##
# Import Modules
#
from __future__ import absolute_import
import Common.LongFilePathOs as os
from . import EotGlobalData
from Common.LongFilePathSupport import OpenLongFilePath as open
## Report() class
#
# This class defined Report
#
# @param object: Inherited from object class
#
class Report(object):
## The constructor
#
# @param self: The object pointer
# @param ReportName: name of the report
# @param FvObj: FV object after parsing FV images
#
def __init__(self, ReportName = 'Report.html', FvObj = None, DispatchName=None):
self.ReportName = ReportName
self.Op = open(ReportName, 'w+')
self.DispatchList = None
if DispatchName:
self.DispatchList = open(DispatchName, 'w+')
self.FvObj = FvObj
self.FfsIndex = 0
self.PpiIndex = 0
self.ProtocolIndex = 0
if EotGlobalData.gMACRO['EFI_SOURCE'] == '':
EotGlobalData.gMACRO['EFI_SOURCE'] = EotGlobalData.gMACRO['EDK_SOURCE']
## WriteLn() method
#
# Write a line in the report
#
# @param self: The object pointer
# @param Line: The lint to be written into
#
def WriteLn(self, Line):
self.Op.write('%s\n' % Line)
## GenerateReport() method
#
# A caller to generate report
#
# @param self: The object pointer
#
def GenerateReport(self):
self.GenerateHeader()
self.GenerateFv()
self.GenerateTail()
self.Op.close()
self.GenerateUnDispatchedList()
## GenerateUnDispatchedList() method
#
# Create a list for not dispatched items
#
# @param self: The object pointer
#
def GenerateUnDispatchedList(self):
FvObj = self.FvObj
EotGlobalData.gOP_UN_DISPATCHED.write('%s\n' % FvObj.Name)
for Item in FvObj.UnDispatchedFfsDict.keys():
EotGlobalData.gOP_UN_DISPATCHED.write('%s\n' % FvObj.UnDispatchedFfsDict[Item])
## GenerateFv() method
#
# Generate FV information
#
# @param self: The object pointer
#
def GenerateFv(self):
FvObj = self.FvObj
Content = """