fosslight-util 1.4.40__tar.gz → 1.4.41__tar.gz
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-1.4.40 → fosslight_util-1.4.41}/PKG-INFO +1 -1
- {fosslight_util-1.4.40 → fosslight_util-1.4.41}/setup.py +1 -1
- {fosslight_util-1.4.40 → fosslight_util-1.4.41}/src/fosslight_util/correct.py +4 -3
- {fosslight_util-1.4.40 → fosslight_util-1.4.41}/src/fosslight_util/download.py +2 -2
- {fosslight_util-1.4.40 → fosslight_util-1.4.41}/src/fosslight_util/oss_item.py +58 -11
- {fosslight_util-1.4.40 → fosslight_util-1.4.41}/src/fosslight_util/parsing_yaml.py +6 -0
- {fosslight_util-1.4.40 → fosslight_util-1.4.41}/src/fosslight_util/read_excel.py +4 -1
- {fosslight_util-1.4.40 → fosslight_util-1.4.41}/src/fosslight_util/write_excel.py +4 -0
- {fosslight_util-1.4.40 → fosslight_util-1.4.41}/src/fosslight_util/write_yaml.py +11 -6
- {fosslight_util-1.4.40 → fosslight_util-1.4.41}/src/fosslight_util.egg-info/PKG-INFO +1 -1
- {fosslight_util-1.4.40 → fosslight_util-1.4.41}/LICENSE +0 -0
- {fosslight_util-1.4.40 → fosslight_util-1.4.41}/MANIFEST.in +0 -0
- {fosslight_util-1.4.40 → fosslight_util-1.4.41}/README.md +0 -0
- {fosslight_util-1.4.40 → fosslight_util-1.4.41}/requirements.txt +0 -0
- {fosslight_util-1.4.40 → fosslight_util-1.4.41}/setup.cfg +0 -0
- {fosslight_util-1.4.40 → fosslight_util-1.4.41}/src/fosslight_util/__init__.py +0 -0
- {fosslight_util-1.4.40 → fosslight_util-1.4.41}/src/fosslight_util/_get_downloadable_url.py +0 -0
- {fosslight_util-1.4.40 → fosslight_util-1.4.41}/src/fosslight_util/compare_yaml.py +0 -0
- {fosslight_util-1.4.40 → fosslight_util-1.4.41}/src/fosslight_util/constant.py +0 -0
- {fosslight_util-1.4.40 → fosslight_util-1.4.41}/src/fosslight_util/convert_excel_to_yaml.py +0 -0
- {fosslight_util-1.4.40 → fosslight_util-1.4.41}/src/fosslight_util/cover.py +0 -0
- {fosslight_util-1.4.40 → fosslight_util-1.4.41}/src/fosslight_util/help.py +0 -0
- {fosslight_util-1.4.40 → fosslight_util-1.4.41}/src/fosslight_util/output_format.py +0 -0
- {fosslight_util-1.4.40 → fosslight_util-1.4.41}/src/fosslight_util/resources/frequentLicenselist.json +0 -0
- {fosslight_util-1.4.40 → fosslight_util-1.4.41}/src/fosslight_util/resources/frequent_license_nick_list.json +0 -0
- {fosslight_util-1.4.40 → fosslight_util-1.4.41}/src/fosslight_util/resources/licenses.json +0 -0
- {fosslight_util-1.4.40 → fosslight_util-1.4.41}/src/fosslight_util/set_log.py +0 -0
- {fosslight_util-1.4.40 → fosslight_util-1.4.41}/src/fosslight_util/spdx_licenses.py +0 -0
- {fosslight_util-1.4.40 → fosslight_util-1.4.41}/src/fosslight_util/timer_thread.py +0 -0
- {fosslight_util-1.4.40 → fosslight_util-1.4.41}/src/fosslight_util/write_opossum.py +0 -0
- {fosslight_util-1.4.40 → fosslight_util-1.4.41}/src/fosslight_util/write_scancodejson.py +0 -0
- {fosslight_util-1.4.40 → fosslight_util-1.4.41}/src/fosslight_util/write_spdx.py +0 -0
- {fosslight_util-1.4.40 → fosslight_util-1.4.41}/src/fosslight_util/write_txt.py +0 -0
- {fosslight_util-1.4.40 → fosslight_util-1.4.41}/src/fosslight_util.egg-info/SOURCES.txt +0 -0
- {fosslight_util-1.4.40 → fosslight_util-1.4.41}/src/fosslight_util.egg-info/dependency_links.txt +0 -0
- {fosslight_util-1.4.40 → fosslight_util-1.4.41}/src/fosslight_util.egg-info/entry_points.txt +0 -0
- {fosslight_util-1.4.40 → fosslight_util-1.4.41}/src/fosslight_util.egg-info/requires.txt +0 -0
- {fosslight_util-1.4.40 → fosslight_util-1.4.41}/src/fosslight_util.egg-info/top_level.txt +0 -0
|
@@ -48,12 +48,13 @@ def correct_with_yaml(correct_filepath, path_to_scan, scanner_oss_list):
|
|
|
48
48
|
if sheet_name not in constant.supported_sheet_and_scanner.keys():
|
|
49
49
|
continue
|
|
50
50
|
correct_contents = copy.deepcopy(sheet_contents)
|
|
51
|
+
scanner_name = constant.supported_sheet_and_scanner[sheet_name]
|
|
51
52
|
for idx, oss_raw_item in enumerate(sheet_contents):
|
|
52
53
|
if len(oss_raw_item) < 9:
|
|
53
54
|
logger.warning(f"sheet list is too short ({len(oss_raw_item)}): {oss_raw_item}")
|
|
54
55
|
continue
|
|
55
56
|
oss_item = OssItem('')
|
|
56
|
-
oss_item.set_sheet_item(oss_raw_item)
|
|
57
|
+
oss_item.set_sheet_item(oss_raw_item, scanner_name)
|
|
57
58
|
|
|
58
59
|
matched_yi = []
|
|
59
60
|
oss_rel_path = os.path.normpath(os.path.join(rel_path, oss_item.source_name_or_path[0]))
|
|
@@ -75,13 +76,13 @@ def correct_with_yaml(correct_filepath, path_to_scan, scanner_oss_list):
|
|
|
75
76
|
if matched_oss_item.comment:
|
|
76
77
|
matched_oss_item.comment += '/'
|
|
77
78
|
matched_oss_item.comment += 'Loaded from sbom-info.yaml'
|
|
78
|
-
matched_oss_array = matched_oss_item.get_print_array()[0]
|
|
79
|
+
matched_oss_array = matched_oss_item.get_print_array(scanner_name)[0]
|
|
79
80
|
correct_contents.append(matched_oss_array)
|
|
80
81
|
oss_item.exclude = True
|
|
81
82
|
if oss_item.comment:
|
|
82
83
|
oss_item.comment += '/'
|
|
83
84
|
oss_item.comment += 'Excluded by sbom-info.yaml'
|
|
84
|
-
correct_contents[idx] = oss_item.get_print_array()[0]
|
|
85
|
+
correct_contents[idx] = oss_item.get_print_array(scanner_name)[0]
|
|
85
86
|
|
|
86
87
|
if sheet_name == 'SRC_FL_Source':
|
|
87
88
|
for n_idx, ni in enumerate(matched_yaml):
|
|
@@ -62,7 +62,7 @@ def change_src_link_to_https(src_link):
|
|
|
62
62
|
|
|
63
63
|
|
|
64
64
|
def parse_src_link(src_link):
|
|
65
|
-
src_info = {}
|
|
65
|
+
src_info = {"url": src_link}
|
|
66
66
|
src_link_changed = ""
|
|
67
67
|
if src_link.startswith("git://") or src_link.startswith("https://") or src_link.startswith("http://"):
|
|
68
68
|
src_link_split = src_link.split(';')
|
|
@@ -79,7 +79,7 @@ def parse_src_link(src_link):
|
|
|
79
79
|
src_info["url"] = src_link_changed
|
|
80
80
|
src_info["branch"] = branch_info
|
|
81
81
|
src_info["tag"] = tag_info
|
|
82
|
-
|
|
82
|
+
return src_info
|
|
83
83
|
|
|
84
84
|
|
|
85
85
|
def main():
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import logging
|
|
7
7
|
import os
|
|
8
|
-
from fosslight_util.constant import LOGGER_NAME
|
|
8
|
+
from fosslight_util.constant import LOGGER_NAME, FL_DEPENDENCY, FL_BINARY
|
|
9
9
|
|
|
10
10
|
_logger = logging.getLogger(LOGGER_NAME)
|
|
11
11
|
|
|
@@ -25,6 +25,11 @@ class OssItem:
|
|
|
25
25
|
self._yocto_recipe = []
|
|
26
26
|
self._yocto_package = []
|
|
27
27
|
self.is_binary = False
|
|
28
|
+
self._depends_on = []
|
|
29
|
+
self.purl = ""
|
|
30
|
+
self.bin_vulnerability = ""
|
|
31
|
+
self.bin_tlsh = ""
|
|
32
|
+
self.bin_sha1 = ""
|
|
28
33
|
|
|
29
34
|
def __del__(self):
|
|
30
35
|
pass
|
|
@@ -123,11 +128,29 @@ class OssItem:
|
|
|
123
128
|
self._yocto_package = [item.strip() for item in self._yocto_package]
|
|
124
129
|
self._yocto_package = list(set(self._yocto_package))
|
|
125
130
|
|
|
126
|
-
|
|
131
|
+
@property
|
|
132
|
+
def depends_on(self):
|
|
133
|
+
return self._depends_on
|
|
134
|
+
|
|
135
|
+
@depends_on.setter
|
|
136
|
+
def depends_on(self, value):
|
|
137
|
+
if not value:
|
|
138
|
+
self._depends_on = []
|
|
139
|
+
else:
|
|
140
|
+
if not isinstance(value, list):
|
|
141
|
+
value = value.split(",")
|
|
142
|
+
self._depends_on.extend(value)
|
|
143
|
+
self._depends_on = [item.strip() for item in self._depends_on]
|
|
144
|
+
self._depends_on = list(set(self._depends_on))
|
|
145
|
+
|
|
146
|
+
def set_sheet_item(self, item, scanner_name=''):
|
|
127
147
|
if len(item) < 9:
|
|
128
148
|
_logger.warning(f"sheet list is too short ({len(item)}): {item}")
|
|
129
149
|
return
|
|
130
|
-
|
|
150
|
+
if scanner_name == FL_DEPENDENCY:
|
|
151
|
+
self.purl = item[0]
|
|
152
|
+
else:
|
|
153
|
+
self.source_name_or_path = item[0]
|
|
131
154
|
self.name = item[1]
|
|
132
155
|
self.version = item[2]
|
|
133
156
|
self.license = item[3]
|
|
@@ -137,19 +160,39 @@ class OssItem:
|
|
|
137
160
|
self.exclude = item[7]
|
|
138
161
|
self.comment = item[8]
|
|
139
162
|
|
|
140
|
-
|
|
163
|
+
if len(item) >= 10 and scanner_name == FL_DEPENDENCY:
|
|
164
|
+
self.depends_on = item[9]
|
|
165
|
+
if len(item) >= 10 and scanner_name == FL_BINARY:
|
|
166
|
+
self.bin_vulnerability = item[9]
|
|
167
|
+
if len(item) >= 12:
|
|
168
|
+
self.bin_tlsh = item[10]
|
|
169
|
+
self.bin_sha1 = item[11]
|
|
170
|
+
|
|
171
|
+
def get_print_array(self, scanner_name=''):
|
|
141
172
|
items = []
|
|
142
|
-
if
|
|
143
|
-
self.source_name_or_path
|
|
173
|
+
if scanner_name != FL_DEPENDENCY:
|
|
174
|
+
if len(self.source_name_or_path) == 0:
|
|
175
|
+
self.source_name_or_path.append("")
|
|
144
176
|
if len(self.license) == 0:
|
|
145
177
|
self.license.append("")
|
|
146
178
|
|
|
147
179
|
exclude = "Exclude" if self.exclude else ""
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
180
|
+
lic = ",".join(self.license)
|
|
181
|
+
if scanner_name == FL_DEPENDENCY:
|
|
182
|
+
items = [self.purl, self.name, self.version, lic,
|
|
183
|
+
self.download_location, self.homepage, self.copyright, exclude, self.comment]
|
|
184
|
+
if len(self.depends_on) > 0:
|
|
185
|
+
items.append(",".join(self.depends_on))
|
|
186
|
+
else:
|
|
187
|
+
for source_name_or_path in self.source_name_or_path:
|
|
188
|
+
if scanner_name == FL_BINARY:
|
|
189
|
+
oss_item = [os.path.join(self.relative_path, source_name_or_path), self.name, self.version, lic,
|
|
190
|
+
self.download_location, self.homepage, self.copyright, exclude, self.comment,
|
|
191
|
+
self.bin_vulnerability, self.bin_tlsh, self.bin_sha1]
|
|
192
|
+
else:
|
|
193
|
+
oss_item = [os.path.join(self.relative_path, source_name_or_path), self.name, self.version, lic,
|
|
194
|
+
self.download_location, self.homepage, self.copyright, exclude, self.comment]
|
|
195
|
+
items.append(oss_item)
|
|
153
196
|
return items
|
|
154
197
|
|
|
155
198
|
def get_print_json(self):
|
|
@@ -171,6 +214,10 @@ class OssItem:
|
|
|
171
214
|
json_item["exclude"] = self.exclude
|
|
172
215
|
if self.comment != "":
|
|
173
216
|
json_item["comment"] = self.comment
|
|
217
|
+
if len(self.depends_on) > 0:
|
|
218
|
+
json_item["depends on"] = self.depends_on
|
|
219
|
+
if self.purl != "":
|
|
220
|
+
json_item["purl"] = self.purl
|
|
174
221
|
|
|
175
222
|
return json_item
|
|
176
223
|
|
|
@@ -115,6 +115,12 @@ def set_value_switch(oss, key, value, yaml_file=""):
|
|
|
115
115
|
oss.yocto_package = value
|
|
116
116
|
elif key == 'yocto_recipe':
|
|
117
117
|
oss.yocto_recipe = value
|
|
118
|
+
elif key == 'vulnerability link':
|
|
119
|
+
oss.bin_vulnerability = value
|
|
120
|
+
elif key == 'tlsh':
|
|
121
|
+
oss.bin_tlsh = value
|
|
122
|
+
elif key == 'sha1':
|
|
123
|
+
oss.bin_sha1 = value
|
|
118
124
|
else:
|
|
119
125
|
if yaml_file != "":
|
|
120
126
|
_logger.debug(f"file:{yaml_file} - key:{key} cannot be parsed")
|
|
@@ -75,7 +75,10 @@ def read_oss_report(excel_file: str, sheet_names: str = "") -> List[OssItem]:
|
|
|
75
75
|
"Exclude": IDX_CANNOT_FOUND,
|
|
76
76
|
"Copyright Text": IDX_CANNOT_FOUND,
|
|
77
77
|
"Comment": IDX_CANNOT_FOUND,
|
|
78
|
-
"File Name or Path": IDX_CANNOT_FOUND
|
|
78
|
+
"File Name or Path": IDX_CANNOT_FOUND,
|
|
79
|
+
"Vulnerability Link": IDX_CANNOT_FOUND,
|
|
80
|
+
"TLSH": IDX_CANNOT_FOUND,
|
|
81
|
+
"SHA1": IDX_CANNOT_FOUND
|
|
79
82
|
}
|
|
80
83
|
num_cols = xl_sheet.ncols
|
|
81
84
|
num_rows = xl_sheet.nrows
|
|
@@ -301,6 +301,10 @@ def merge_excels(find_excel_dir, final_out, merge_files='', cover=''):
|
|
|
301
301
|
sheet_name = f"{f_short_name}_{sheet_name}"
|
|
302
302
|
df_excel.to_excel(writer, sheet_name, index=False)
|
|
303
303
|
added_sheet_names.append(sheet_name)
|
|
304
|
+
|
|
305
|
+
if sheet_name == 'BIN_FL_Binary':
|
|
306
|
+
bin_sheet = writer.sheets[sheet_name]
|
|
307
|
+
bin_sheet.set_column("L:M", None, None, {"hidden": True}) # 'TLSH', 'SHA1' column hide
|
|
304
308
|
writer.close()
|
|
305
309
|
except Exception as ex:
|
|
306
310
|
msg = str(ex)
|
|
@@ -35,11 +35,16 @@ def write_yaml(output_file, sheet_list_origin, separate_yaml=False):
|
|
|
35
35
|
for sheet_name, sheet_contents in sheet_list.items():
|
|
36
36
|
if sheet_name not in constant.supported_sheet_and_scanner.keys():
|
|
37
37
|
continue
|
|
38
|
+
scanner_name = constant.supported_sheet_and_scanner[sheet_name]
|
|
39
|
+
sheet_contents_with_scanner = []
|
|
40
|
+
for i in sheet_contents:
|
|
41
|
+
i.insert(0, scanner_name)
|
|
42
|
+
sheet_contents_with_scanner.append(i)
|
|
38
43
|
if not separate_yaml:
|
|
39
|
-
merge_sheet.extend(
|
|
44
|
+
merge_sheet.extend(sheet_contents_with_scanner)
|
|
40
45
|
else:
|
|
41
46
|
output_file = f'{separate_output_file}_{sheet_name}.yaml'
|
|
42
|
-
convert_sheet_to_yaml(
|
|
47
|
+
convert_sheet_to_yaml(sheet_contents_with_scanner, output_file)
|
|
43
48
|
output_files.append(output_file)
|
|
44
49
|
|
|
45
50
|
if not separate_yaml:
|
|
@@ -61,13 +66,13 @@ def write_yaml(output_file, sheet_list_origin, separate_yaml=False):
|
|
|
61
66
|
return success, error_msg, output
|
|
62
67
|
|
|
63
68
|
|
|
64
|
-
def convert_sheet_to_yaml(
|
|
65
|
-
|
|
69
|
+
def convert_sheet_to_yaml(sheet_contents_with_scanner, output_file):
|
|
70
|
+
sheet_contents_with_scanner = [list(t) for t in set(tuple(e) for e in sorted(sheet_contents_with_scanner))]
|
|
66
71
|
|
|
67
72
|
yaml_dict = {}
|
|
68
|
-
for sheet_item in
|
|
73
|
+
for sheet_item in sheet_contents_with_scanner:
|
|
69
74
|
item = OssItem('')
|
|
70
|
-
item.set_sheet_item(sheet_item)
|
|
75
|
+
item.set_sheet_item(sheet_item[1:], sheet_item[0])
|
|
71
76
|
create_yaml_with_ossitem(item, yaml_dict)
|
|
72
77
|
|
|
73
78
|
with open(output_file, 'w') as f:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fosslight_util-1.4.40 → fosslight_util-1.4.41}/src/fosslight_util.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{fosslight_util-1.4.40 → fosslight_util-1.4.41}/src/fosslight_util.egg-info/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|