diff --git a/requirements.txt b/requirements.txt index edc8ddd46..7bc932eff 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -fosslight_util>=1.4.28 +fosslight_util>=1.4.38 binaryornot openpyxl pandas diff --git a/src/fosslight_yocto/_package_item.py b/src/fosslight_yocto/_package_item.py index 7317c6c0d..71819c3f8 100755 --- a/src/fosslight_yocto/_package_item.py +++ b/src/fosslight_yocto/_package_item.py @@ -8,6 +8,7 @@ const_other_proprietary_license = 'other proprietary license' EXCLUDE_TRUE_VALUE = "Exclude" IGNORE_COPYRIGHT = "NOASSERTION" +_TLSH_CHECKSUM_NULL = "0" class PackageItem(OssItem): @@ -32,6 +33,8 @@ def __init__(self): self._yocto_package = [] self.relative_path = "" self.additional_data = {} + self.tlsh = _TLSH_CHECKSUM_NULL + self.checksum = _TLSH_CHECKSUM_NULL def __eq__(self, value): return self.spdx_id == value @@ -188,8 +191,8 @@ def get_print_item(self, bin_android_format=False, additional_column=[]): license_to_print = self.declared_licenses if bin_android_format: # BIN(Yocto) Sheet row = [self.parent_package_name, self.oss_name, "", self.name, self.version, - ','.join(license_to_print), - self.download_location, self.homepage, self.copyright, exclude, self.comment] + ','.join(license_to_print), self.download_location, self.homepage, + self.copyright, exclude, self.comment, self.tlsh, self.checksum] for column_name in additional_column: row.append(self.additional_data.get(column_name, '')) print_items.append(row) diff --git a/src/fosslight_yocto/_write_result_file.py b/src/fosslight_yocto/_write_result_file.py index 5db00acdb..d8c55da96 100755 --- a/src/fosslight_yocto/_write_result_file.py +++ b/src/fosslight_yocto/_write_result_file.py @@ -5,10 +5,12 @@ import logging import fosslight_util.constant as constant from fosslight_util.output_format import write_output_file +from fosslight_util.write_excel import hide_column logger = logging.getLogger(constant.LOGGER_NAME) OUTPUT_FILE_EXTENSION = ".xlsx" +HIDDEN_HEADER = ['TLSH', 'SHA1'] def write_result_from_bom(out_file_name, installed_packages_src, installed_packages_bin, @@ -16,7 +18,7 @@ def write_result_from_bom(out_file_name, installed_packages_src, installed_packa SHEET_HEADER = {'BIN (Yocto)': ['ID', 'Binary Name', 'Source Code Path', 'NOTICE.html', 'OSS Name', 'OSS Version', 'License', 'Download Location', 'Homepage', - 'Copyright Text', 'Exclude', 'Comment'], + 'Copyright Text', 'Exclude', 'Comment', 'TLSH', 'SHA1'], 'SRC': ['ID', 'Source Name or Path', 'OSS Name', 'OSS Version', 'License', 'Download Location', 'Homepage', 'Copyright Text', 'Exclude', 'Comment'], @@ -43,7 +45,8 @@ def write_result_from_bom(out_file_name, installed_packages_src, installed_packa sheet_list["BIN"] = list_bin_to_print logger.debug(f"FILE:{out_file_name}{output_extension}") - success_to_write, writing_msg, result_file = write_output_file(out_file_name, output_extension, sheet_list, SHEET_HEADER) + success_to_write, writing_msg, result_file = write_output_file(out_file_name, output_extension, sheet_list, + SHEET_HEADER, HIDDEN_HEADER) if success_to_write: logger.info(f"Output file :{result_file}") diff --git a/src/fosslight_yocto/create_oss_report_for_yocto.py b/src/fosslight_yocto/create_oss_report_for_yocto.py index 49e7eed9a..56662bfee 100755 --- a/src/fosslight_yocto/create_oss_report_for_yocto.py +++ b/src/fosslight_yocto/create_oss_report_for_yocto.py @@ -372,6 +372,8 @@ def get_binary_list(buildhistory_package_files, path_to_find, output_txt): pkg_item = PackageItem() pkg_item = update_package_name(pkg_item, pkg_name, _nested_pkg_name) pkg_item.source_name_or_path = file_rel_path + pkg_item.tlsh = tlsh + pkg_item.checksum = checksum if pkg_name != "" and pkg_name in bom_pkg_data: for key, value in bom_pkg_data[pkg_name].items(): set_value_switch(pkg_item, key, value, _nested_pkg_name)