fosslight-util 1.4.45__py3-none-any.whl → 1.4.47__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fosslight_util/correct.py +34 -27
- fosslight_util/output_format.py +49 -0
- {fosslight_util-1.4.45.dist-info → fosslight_util-1.4.47.dist-info}/METADATA +1 -1
- {fosslight_util-1.4.45.dist-info → fosslight_util-1.4.47.dist-info}/RECORD +8 -8
- {fosslight_util-1.4.45.dist-info → fosslight_util-1.4.47.dist-info}/LICENSE +0 -0
- {fosslight_util-1.4.45.dist-info → fosslight_util-1.4.47.dist-info}/WHEEL +0 -0
- {fosslight_util-1.4.45.dist-info → fosslight_util-1.4.47.dist-info}/entry_points.txt +0 -0
- {fosslight_util-1.4.45.dist-info → fosslight_util-1.4.47.dist-info}/top_level.txt +0 -0
fosslight_util/correct.py
CHANGED
|
@@ -49,6 +49,7 @@ def correct_with_yaml(correct_filepath, path_to_scan, scanner_oss_list):
|
|
|
49
49
|
continue
|
|
50
50
|
correct_contents = copy.deepcopy(sheet_contents)
|
|
51
51
|
scanner_name = constant.supported_sheet_and_scanner[sheet_name]
|
|
52
|
+
matched_source_path_with_sbom = []
|
|
52
53
|
for idx, oss_raw_item in enumerate(sheet_contents):
|
|
53
54
|
if len(oss_raw_item) < 9:
|
|
54
55
|
logger.warning(f"sheet list is too short ({len(oss_raw_item)}): {oss_raw_item}")
|
|
@@ -57,33 +58,39 @@ def correct_with_yaml(correct_filepath, path_to_scan, scanner_oss_list):
|
|
|
57
58
|
oss_item.set_sheet_item(oss_raw_item, scanner_name)
|
|
58
59
|
|
|
59
60
|
matched_yi = []
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
matched_oss_item
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
61
|
+
if not oss_item.source_name_or_path[0] in matched_source_path_with_sbom:
|
|
62
|
+
oss_rel_path = os.path.normpath(os.path.join(rel_path, oss_item.source_name_or_path[0]))
|
|
63
|
+
for y_idx, yi in enumerate(yaml_oss_list):
|
|
64
|
+
if not yi.source_name_or_path:
|
|
65
|
+
continue
|
|
66
|
+
for ys_idx, yi_path in enumerate(yi.source_name_or_path):
|
|
67
|
+
yi_item = copy.deepcopy(yi)
|
|
68
|
+
if ((os.path.normpath(yi_path) == os.path.normpath(oss_rel_path)) or
|
|
69
|
+
((os.path.normpath(oss_rel_path).startswith(os.path.normpath(yi_path.rstrip('*')))))):
|
|
70
|
+
find_match = True
|
|
71
|
+
yi_item.source_name_or_path = []
|
|
72
|
+
yi_item.source_name_or_path = oss_item.source_name_or_path[0]
|
|
73
|
+
matched_source_path_with_sbom.append(oss_item.source_name_or_path[0])
|
|
74
|
+
matched_yi.append(yi_item)
|
|
75
|
+
matched_yaml[y_idx][ys_idx] = 1
|
|
76
|
+
if len(matched_yi) > 0:
|
|
77
|
+
for matched_yi_item in matched_yi:
|
|
78
|
+
matched_oss_item = copy.deepcopy(matched_yi_item)
|
|
79
|
+
if matched_oss_item.comment:
|
|
80
|
+
matched_oss_item.comment += '/'
|
|
81
|
+
matched_oss_item.comment += 'Loaded from sbom-info.yaml'
|
|
82
|
+
if sheet_name == 'BIN_FL_Binary':
|
|
83
|
+
matched_oss_item.bin_vulnerability = oss_item.bin_vulnerability
|
|
84
|
+
matched_oss_item.bin_tlsh = oss_item.bin_tlsh
|
|
85
|
+
matched_oss_item.bin_sha1 = oss_item.bin_sha1
|
|
86
|
+
matched_oss_array = matched_oss_item.get_print_array(scanner_name)[0]
|
|
87
|
+
correct_contents.append(matched_oss_array)
|
|
88
|
+
oss_item.exclude = True
|
|
89
|
+
if oss_item.comment:
|
|
90
|
+
oss_item.comment += '/'
|
|
91
|
+
oss_item.comment += 'Excluded by sbom-info.yaml'
|
|
92
|
+
correct_contents[idx] = oss_item.get_print_array(scanner_name)[0]
|
|
93
|
+
else:
|
|
87
94
|
oss_item.exclude = True
|
|
88
95
|
if oss_item.comment:
|
|
89
96
|
oss_item.comment += '/'
|
fosslight_util/output_format.py
CHANGED
|
@@ -56,6 +56,55 @@ def check_output_format(output='', format='', customized_format={}):
|
|
|
56
56
|
return success, msg, output_path, output_file, output_extension
|
|
57
57
|
|
|
58
58
|
|
|
59
|
+
def check_output_formats(output='', formats=[], customized_format={}):
|
|
60
|
+
success = True
|
|
61
|
+
msg = ''
|
|
62
|
+
output_path = ''
|
|
63
|
+
output_files = []
|
|
64
|
+
output_extensions = []
|
|
65
|
+
|
|
66
|
+
if customized_format:
|
|
67
|
+
support_format = customized_format
|
|
68
|
+
else:
|
|
69
|
+
support_format = SUPPORT_FORMAT
|
|
70
|
+
|
|
71
|
+
if formats:
|
|
72
|
+
# If -f option exist
|
|
73
|
+
formats = [format.lower() for format in formats]
|
|
74
|
+
for format in formats:
|
|
75
|
+
if format not in list(support_format.keys()):
|
|
76
|
+
success = False
|
|
77
|
+
msg = 'Enter the supported format with -f option: ' + ', '.join(list(support_format.keys()))
|
|
78
|
+
else:
|
|
79
|
+
output_extensions.append(support_format[format])
|
|
80
|
+
|
|
81
|
+
if success:
|
|
82
|
+
if output != '':
|
|
83
|
+
basename_extension = ''
|
|
84
|
+
if not os.path.isdir(output):
|
|
85
|
+
output_path = os.path.dirname(output)
|
|
86
|
+
|
|
87
|
+
basename = os.path.basename(output)
|
|
88
|
+
basename_file, basename_extension = os.path.splitext(basename)
|
|
89
|
+
if basename_extension:
|
|
90
|
+
if formats:
|
|
91
|
+
if basename_extension not in output_extensions:
|
|
92
|
+
success = False
|
|
93
|
+
msg = f"The format of output file(-o:'{output}') should be in the format list(-f:'{formats}')."
|
|
94
|
+
else:
|
|
95
|
+
if basename_extension not in support_format.values():
|
|
96
|
+
success = False
|
|
97
|
+
msg = 'Enter the supported file extension: ' + ', '.join(list(support_format.values()))
|
|
98
|
+
output_extensions.append(basename_extension)
|
|
99
|
+
output_files = [basename_file for _ in range(len(output_extensions))]
|
|
100
|
+
else:
|
|
101
|
+
output_path = output
|
|
102
|
+
if not output_extensions:
|
|
103
|
+
output_extensions = ['.xlsx']
|
|
104
|
+
|
|
105
|
+
return success, msg, output_path, output_files, output_extensions
|
|
106
|
+
|
|
107
|
+
|
|
59
108
|
def write_output_file(output_file_without_ext, file_extension, sheet_list, extended_header={}, hide_header={}, cover=""):
|
|
60
109
|
success = True
|
|
61
110
|
msg = ''
|
|
@@ -3,12 +3,12 @@ fosslight_util/_get_downloadable_url.py,sha256=63ZPI4KCpUFgL4oheKm8zvekuCRzpwNkV
|
|
|
3
3
|
fosslight_util/compare_yaml.py,sha256=0bapoyS0yrzkiK70K57E8-3wZ_D6mZAJ-24Eq9TYBlk,2632
|
|
4
4
|
fosslight_util/constant.py,sha256=j9uhncoC2Fn4j4ATNsjUoS91nVXhyGzU6xLyWFj941A,1834
|
|
5
5
|
fosslight_util/convert_excel_to_yaml.py,sha256=7ZsAMMQJIEXrmcl_28nSHvFpGMi1ZiRZYpEfI5O8vP8,2298
|
|
6
|
-
fosslight_util/correct.py,sha256=
|
|
6
|
+
fosslight_util/correct.py,sha256=O8c4vIl5Hdc46Ijr63LfcTjIZE5fgqN2iKRadHqluUU,6253
|
|
7
7
|
fosslight_util/cover.py,sha256=GZAeGoQGGCx7OEddErS_Mj6pbMCQrdr5jX-CixU4iAA,1607
|
|
8
8
|
fosslight_util/download.py,sha256=X-R2RTWwmhx_LSIBZhIxzPTJZ2GwasZnhIsZ5m3hUig,14997
|
|
9
9
|
fosslight_util/help.py,sha256=xhAf43fuRLOU3TE7jqaxVTizVn4aANDvHaHYQAdaqYc,2154
|
|
10
10
|
fosslight_util/oss_item.py,sha256=Wc2ka8cZc3D9JiJXl4-Y69A_qcGuyMiyYq053Srq638,7267
|
|
11
|
-
fosslight_util/output_format.py,sha256=
|
|
11
|
+
fosslight_util/output_format.py,sha256=r_OuYyQGCsCMkjJ3NYUyl4DJDYEDGZI7AWzz4fXPwSg,4883
|
|
12
12
|
fosslight_util/parsing_yaml.py,sha256=m1kg6sYBJTmLmobsD-fjFxOz2NuIVjUvoEvXxmvBOpU,4561
|
|
13
13
|
fosslight_util/read_excel.py,sha256=3zW2F6Azj4ufsrStBQGArBDCLG-BTJGG54HIqMxlx_A,5392
|
|
14
14
|
fosslight_util/set_log.py,sha256=GsUtbtqmYKgBltHzeaxV3H9gaUWMYQYDJEhr_LdEGoo,3258
|
|
@@ -23,9 +23,9 @@ fosslight_util/write_yaml.py,sha256=nzuIPdjOAOM4NS5VtU-KFrft41fKEF05-cl0OlEHj7Y,
|
|
|
23
23
|
fosslight_util/resources/frequentLicenselist.json,sha256=GUhzK6tu7ok10fekOnmVmUgIGRC-acGABZKTNKfDyYA,4776157
|
|
24
24
|
fosslight_util/resources/frequent_license_nick_list.json,sha256=ryU2C_6ZxHbz90_sUN9OvI9GXkCMLu7oGcmd9W79YYo,5005
|
|
25
25
|
fosslight_util/resources/licenses.json,sha256=mK55z-bhY7Mjpj2KsO1crKGGL-X3F6MBFQJ0zLlx010,240843
|
|
26
|
-
fosslight_util-1.4.
|
|
27
|
-
fosslight_util-1.4.
|
|
28
|
-
fosslight_util-1.4.
|
|
29
|
-
fosslight_util-1.4.
|
|
30
|
-
fosslight_util-1.4.
|
|
31
|
-
fosslight_util-1.4.
|
|
26
|
+
fosslight_util-1.4.47.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
27
|
+
fosslight_util-1.4.47.dist-info/METADATA,sha256=za9smj8HiWDYAHLX5Oe3zcO1Fag9GxVGtteVGRhs5EY,6418
|
|
28
|
+
fosslight_util-1.4.47.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
29
|
+
fosslight_util-1.4.47.dist-info/entry_points.txt,sha256=bzXX5i7HZ13V8BLKvtu_9KO3ZjtRypH-XszOXT6I3bU,69
|
|
30
|
+
fosslight_util-1.4.47.dist-info/top_level.txt,sha256=2qyYWGLakgBRy4BqoBNt-I5C29tBr_e93e5e1pbuTGA,15
|
|
31
|
+
fosslight_util-1.4.47.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|