FOSSology  4.4.0
Open Source License Compliance by Open Source Software
FoScanner.SpdxReport.SpdxReport Class Reference
Collaboration diagram for FoScanner.SpdxReport.SpdxReport:
Collaboration graph

Public Member Functions

def __init__ (self, CliOptions cli_options, ApiConfig api_config)
 
def add_license_file (self, ScanResult scan_result)
 
def add_copyright_file (self, ScanResult copyright_result)
 
def write_report (self, str file_name)
 
def finalize_document (self)
 
def add_license_results (self, List[ScanResult] scan_results)
 
def add_copyright_results (self, List[ScanResult] copyright_results)
 

Public Attributes

 cli_options
 

Private Member Functions

File __get_new_spdx_file (self, ScanResult scan_result, str spdx_id)
 

Static Private Member Functions

Tuple __get_file_info (ScanResult scan_result)
 
str __get_file_spdx_id (ScanResult scan_result)
 

Detailed Description

Handle SPDX reports.

:ivar cli_options: CliOptions object
:ivar report_files: Dictionary of SPDX files with SPDX ID as key
:ivar license_package_set: Set of licenses found in package
:ivar creation_info: Report creation info
:ivar document: Report document
:ivar package: Report package

Definition at line 39 of file SpdxReport.py.

Constructor & Destructor Documentation

◆ __init__()

def FoScanner.SpdxReport.SpdxReport.__init__ (   self,
CliOptions  cli_options,
ApiConfig  api_config 
)
:param cli_options: CliOptions to use
:param api_config:  ApiConfig to use

Definition at line 51 of file SpdxReport.py.

Member Function Documentation

◆ __get_file_info()

Tuple FoScanner.SpdxReport.SpdxReport.__get_file_info ( ScanResult  scan_result)
staticprivate
Get different hash for the file in scan result.

:param scan_result: Scan result from scanners.
:return: Tuple of md5, sha1 and sha256 checksums.

Definition at line 164 of file SpdxReport.py.

◆ __get_file_spdx_id()

str FoScanner.SpdxReport.SpdxReport.__get_file_spdx_id ( ScanResult  scan_result)
staticprivate
Generate SPDX ID for file in scan result.

:param scan_result: Scan result from scanner.
:return: SPDX ID for the file.

Definition at line 182 of file SpdxReport.py.

◆ __get_new_spdx_file()

File FoScanner.SpdxReport.SpdxReport.__get_new_spdx_file (   self,
ScanResult  scan_result,
str  spdx_id 
)
private
Create a new SPDX File for given scan result and populate common fields.

:param scan_result: Scan result from scanner.
:param spdx_id: SPDX ID to use for file.
:return: New SPDX File

Definition at line 125 of file SpdxReport.py.

◆ add_copyright_file()

def FoScanner.SpdxReport.SpdxReport.add_copyright_file (   self,
ScanResult  copyright_result 
)
Add scan result from copyright agent. If the file does not exist, creates a
new one.

:param copyright_result: Scan result from copyright scanner.

Definition at line 147 of file SpdxReport.py.

◆ add_copyright_results()

def FoScanner.SpdxReport.SpdxReport.add_copyright_results (   self,
List[ScanResult copyright_results 
)
Helper function to add scan results to the report from copyright scanner.

:param copyright_results: List of scan results from the copyright scanner.

Definition at line 258 of file SpdxReport.py.

◆ add_license_file()

def FoScanner.SpdxReport.SpdxReport.add_license_file (   self,
ScanResult  scan_result 
)
Add scan result from license scanner to report.

:param scan_result: Scan result from license scanner.

Definition at line 97 of file SpdxReport.py.

◆ add_license_results()

def FoScanner.SpdxReport.SpdxReport.add_license_results (   self,
List[ScanResult scan_results 
)
Helper function to add scan results to the report from license scanners.

:param scan_results: List of scan results from the license scanners.

Definition at line 249 of file SpdxReport.py.

◆ finalize_document()

def FoScanner.SpdxReport.SpdxReport.finalize_document (   self)
Finalize the document by setting relations between packages and files.
At the same time, add all the licenses from files to the package and
calculate the verification code, without the excluded files.

Definition at line 207 of file SpdxReport.py.

◆ write_report()

def FoScanner.SpdxReport.SpdxReport.write_report (   self,
str  file_name 
)
Validate the document and write the SPDX file.

:param file_name: Location to store the report.

Definition at line 193 of file SpdxReport.py.


The documentation for this class was generated from the following file: