fosslight-scanner 2.0.1__tar.gz → 2.1.1__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_scanner-2.0.1 → fosslight_scanner-2.1.1}/PKG-INFO +1 -1
- fosslight_scanner-2.1.1/requirements.txt +11 -0
- {fosslight_scanner-2.0.1 → fosslight_scanner-2.1.1}/setup.py +1 -1
- {fosslight_scanner-2.0.1 → fosslight_scanner-2.1.1}/src/fosslight_scanner/_help.py +2 -1
- {fosslight_scanner-2.0.1 → fosslight_scanner-2.1.1}/src/fosslight_scanner/_run_compare.py +11 -9
- {fosslight_scanner-2.0.1 → fosslight_scanner-2.1.1}/src/fosslight_scanner/cli.py +2 -2
- {fosslight_scanner-2.0.1 → fosslight_scanner-2.1.1}/src/fosslight_scanner/fosslight_scanner.py +90 -55
- {fosslight_scanner-2.0.1 → fosslight_scanner-2.1.1}/src/fosslight_scanner.egg-info/PKG-INFO +1 -1
- fosslight_scanner-2.1.1/src/fosslight_scanner.egg-info/requires.txt +11 -0
- fosslight_scanner-2.0.1/requirements.txt +0 -11
- fosslight_scanner-2.0.1/src/fosslight_scanner.egg-info/requires.txt +0 -11
- {fosslight_scanner-2.0.1 → fosslight_scanner-2.1.1}/LICENSE +0 -0
- {fosslight_scanner-2.0.1 → fosslight_scanner-2.1.1}/MANIFEST.in +0 -0
- {fosslight_scanner-2.0.1 → fosslight_scanner-2.1.1}/README.md +0 -0
- {fosslight_scanner-2.0.1 → fosslight_scanner-2.1.1}/setup.cfg +0 -0
- {fosslight_scanner-2.0.1 → fosslight_scanner-2.1.1}/src/fosslight_scanner/__init__.py +0 -0
- {fosslight_scanner-2.0.1 → fosslight_scanner-2.1.1}/src/fosslight_scanner/_get_input.py +0 -0
- {fosslight_scanner-2.0.1 → fosslight_scanner-2.1.1}/src/fosslight_scanner/_parse_setting.py +0 -0
- {fosslight_scanner-2.0.1 → fosslight_scanner-2.1.1}/src/fosslight_scanner/common.py +0 -0
- {fosslight_scanner-2.0.1 → fosslight_scanner-2.1.1}/src/fosslight_scanner/resources/bom_compare.html +0 -0
- {fosslight_scanner-2.0.1 → fosslight_scanner-2.1.1}/src/fosslight_scanner.egg-info/SOURCES.txt +0 -0
- {fosslight_scanner-2.0.1 → fosslight_scanner-2.1.1}/src/fosslight_scanner.egg-info/dependency_links.txt +0 -0
- {fosslight_scanner-2.0.1 → fosslight_scanner-2.1.1}/src/fosslight_scanner.egg-info/entry_points.txt +0 -0
- {fosslight_scanner-2.0.1 → fosslight_scanner-2.1.1}/src/fosslight_scanner.egg-info/top_level.txt +0 -0
|
@@ -15,7 +15,7 @@ with open('requirements.txt', 'r', 'utf-8') as f:
|
|
|
15
15
|
if __name__ == "__main__":
|
|
16
16
|
setup(
|
|
17
17
|
name='fosslight_scanner',
|
|
18
|
-
version='2.
|
|
18
|
+
version='2.1.1',
|
|
19
19
|
package_dir={"": "src"},
|
|
20
20
|
packages=find_packages(where='src'),
|
|
21
21
|
description='FOSSLight Scanner',
|
|
@@ -25,8 +25,9 @@ _HELP_MESSAGE_SCANNER = """
|
|
|
25
25
|
* Compare mode input file: Two FOSSLight reports (supports excel, yaml)
|
|
26
26
|
(ex, -p {before_name}.xlsx {after_name}.xlsx)
|
|
27
27
|
-w <link>\t\t Link to be analyzed can be downloaded by wget or git clone
|
|
28
|
-
-f <format
|
|
28
|
+
-f <formats> [<format> ...]\t FOSSLight Report file format (excel, csv, opossum, yaml, spdx-tag, spdx-yaml, spdx-json, spdx-xml)
|
|
29
29
|
* Compare mode result file: supports excel, json, yaml, html
|
|
30
|
+
* Multiple formats can be specified separated by space.
|
|
30
31
|
-e <path>\t\t Path to exclude from analysis (ex, -e {dir} {file})
|
|
31
32
|
-o <output>\t\t Output directory or file
|
|
32
33
|
-c <number>\t\t Number of processes to analyze source
|
|
@@ -203,7 +203,7 @@ def write_compared_result(output_file, compared_result, file_ext, before_f='', a
|
|
|
203
203
|
def get_comparison_result_filename(output_path, output_file, output_extension, _start_time):
|
|
204
204
|
result_file = ""
|
|
205
205
|
compare_prefix = f"fosslight_compare_{_start_time}"
|
|
206
|
-
if output_file !=
|
|
206
|
+
if output_file != '':
|
|
207
207
|
result_file = f"{output_file}{output_extension}"
|
|
208
208
|
else:
|
|
209
209
|
if output_extension == XLSX_EXT or output_extension == "":
|
|
@@ -232,7 +232,7 @@ def count_compared_result(compared_result):
|
|
|
232
232
|
logger.info(f"Comparison result: {count_str}")
|
|
233
233
|
|
|
234
234
|
|
|
235
|
-
def run_compare(before_f, after_f, output_path,
|
|
235
|
+
def run_compare(before_f, after_f, output_path, output_files, file_ext, _start_time, _output_dir):
|
|
236
236
|
ret = False
|
|
237
237
|
before_yaml = ''
|
|
238
238
|
after_yaml = ''
|
|
@@ -254,8 +254,6 @@ def run_compare(before_f, after_f, output_path, output_file, file_ext, _start_ti
|
|
|
254
254
|
tmp_a_yaml = f'{os.path.basename(after_f).rstrip(XLSX_EXT)}{YAML_EXT}'
|
|
255
255
|
after_yaml = after_f if after_ext == YAML_EXT else os.path.join(_output_dir, tmp_a_yaml)
|
|
256
256
|
|
|
257
|
-
result_file = get_comparison_result_filename(output_path, output_file, file_ext, _start_time)
|
|
258
|
-
|
|
259
257
|
before_basepath = os.path.dirname(before_f)
|
|
260
258
|
after_basepath = os.path.dirname(after_f)
|
|
261
259
|
if XLSX_EXT == before_ext:
|
|
@@ -267,13 +265,17 @@ def run_compare(before_f, after_f, output_path, output_file, file_ext, _start_ti
|
|
|
267
265
|
elif YAML_EXT == after_ext:
|
|
268
266
|
after_fileitems, _, _ = parsing_yml(after_yaml, after_basepath)
|
|
269
267
|
|
|
268
|
+
if output_files:
|
|
269
|
+
output_file = output_files[0]
|
|
270
270
|
compared_result = compare_yaml(before_fileitems, after_fileitems)
|
|
271
271
|
if compared_result != '':
|
|
272
272
|
count_compared_result(compared_result)
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
273
|
+
for f_ext in file_ext:
|
|
274
|
+
result_file = get_comparison_result_filename(output_path, output_file, f_ext, _start_time)
|
|
275
|
+
ret, result_file = write_compared_result(result_file, compared_result, f_ext, before_yaml, after_yaml)
|
|
276
|
+
if ret:
|
|
277
|
+
logger.info(f"Output file: {result_file}")
|
|
278
|
+
else:
|
|
279
|
+
logger.error("Fail to write compared result file.")
|
|
278
280
|
|
|
279
281
|
return ret
|
|
@@ -74,9 +74,9 @@ def main():
|
|
|
74
74
|
dest='path', nargs='+', default="")
|
|
75
75
|
parser.add_argument('--wget', '-w', help='Link to be analyzed',
|
|
76
76
|
type=str, dest='link', default="")
|
|
77
|
-
parser.add_argument('--
|
|
77
|
+
parser.add_argument('--formats', '-f',
|
|
78
78
|
help='Scanner output file format (excel,yaml), Compare mode (excel,html,yaml,json)',
|
|
79
|
-
type=str, dest='format', default=
|
|
79
|
+
type=str, dest='format',nargs='*', default=[])
|
|
80
80
|
parser.add_argument('--output', '-o', help='Output directory or file',
|
|
81
81
|
type=str, dest='output', default="")
|
|
82
82
|
parser.add_argument('--dependency', '-d', help='Dependency arguments',
|
{fosslight_scanner-2.0.1 → fosslight_scanner-2.1.1}/src/fosslight_scanner/fosslight_scanner.py
RENAMED
|
@@ -12,6 +12,7 @@ import yaml
|
|
|
12
12
|
import shutil
|
|
13
13
|
import shlex
|
|
14
14
|
import subprocess
|
|
15
|
+
import platform
|
|
15
16
|
from pathlib import Path
|
|
16
17
|
from datetime import datetime
|
|
17
18
|
|
|
@@ -23,7 +24,7 @@ from ._get_input import get_input_mode
|
|
|
23
24
|
from fosslight_util.set_log import init_log
|
|
24
25
|
from fosslight_util.timer_thread import TimerThread
|
|
25
26
|
import fosslight_util.constant as constant
|
|
26
|
-
from fosslight_util.output_format import
|
|
27
|
+
from fosslight_util.output_format import check_output_formats_v2
|
|
27
28
|
from fosslight_prechecker._precheck import run_lint as prechecker_lint
|
|
28
29
|
from fosslight_util.cover import CoverItem
|
|
29
30
|
from fosslight_util.oss_item import ScannerItem
|
|
@@ -56,7 +57,7 @@ SCANNER_MODE = [
|
|
|
56
57
|
]
|
|
57
58
|
|
|
58
59
|
|
|
59
|
-
def run_dependency(path_to_analyze, output_file_with_path, params="", path_to_exclude=[]):
|
|
60
|
+
def run_dependency(path_to_analyze, output_file_with_path, params="", path_to_exclude=[], formats=[]):
|
|
60
61
|
result = []
|
|
61
62
|
|
|
62
63
|
package_manager = ""
|
|
@@ -99,7 +100,7 @@ def run_dependency(path_to_analyze, output_file_with_path, params="", path_to_ex
|
|
|
99
100
|
output_file_with_path,
|
|
100
101
|
pip_activate_cmd, pip_deactivate_cmd,
|
|
101
102
|
output_custom_dir, app_name,
|
|
102
|
-
github_token, path_to_exclude=path_to_exclude
|
|
103
|
+
github_token, formats, True, path_to_exclude=path_to_exclude
|
|
103
104
|
)
|
|
104
105
|
if success:
|
|
105
106
|
result = scan_item
|
|
@@ -114,33 +115,65 @@ def source_analysis_wrapper(*args, **kwargs):
|
|
|
114
115
|
source_write_json_file = kwargs.pop('source_write_json_file', False)
|
|
115
116
|
source_print_matched_text = kwargs.pop('source_print_matched_text', False)
|
|
116
117
|
source_time_out = kwargs.pop('source_time_out', 120)
|
|
118
|
+
formats = kwargs.pop('formats', [])
|
|
117
119
|
args = list(args)
|
|
118
120
|
args.insert(2, source_write_json_file)
|
|
119
121
|
args.insert(5, source_print_matched_text)
|
|
122
|
+
args.insert(6, formats)
|
|
120
123
|
|
|
121
124
|
return source_analysis(*args, selected_scanner=selected_scanner, time_out=source_time_out, **kwargs)
|
|
122
125
|
|
|
123
126
|
|
|
124
127
|
def run_scanner(src_path, dep_arguments, output_path, keep_raw_data=False,
|
|
125
128
|
run_src=True, run_bin=True, run_dep=True, run_prechecker=False,
|
|
126
|
-
remove_src_data=True, result_log={},
|
|
127
|
-
|
|
129
|
+
remove_src_data=True, result_log={}, output_files=[],
|
|
130
|
+
output_extensions=[], num_cores=-1, db_url="",
|
|
128
131
|
default_oss_name="", default_oss_version="", url="",
|
|
129
132
|
correct_mode=True, correct_fpath="", ui_mode=False, path_to_exclude=[],
|
|
130
133
|
selected_source_scanner="all", source_write_json_file=False, source_print_matched_text=False,
|
|
131
|
-
source_time_out=120, binary_simple=False):
|
|
134
|
+
source_time_out=120, binary_simple=False, formats=[]):
|
|
132
135
|
final_excel_dir = output_path
|
|
133
136
|
success = True
|
|
134
137
|
all_cover_items = []
|
|
135
138
|
all_scan_item = ScannerItem(PKG_NAME, _start_time)
|
|
139
|
+
_json_ext = '.json'
|
|
136
140
|
if not remove_src_data:
|
|
137
141
|
success, final_excel_dir, result_log = init(output_path)
|
|
138
142
|
|
|
139
|
-
if
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
143
|
+
if not output_files:
|
|
144
|
+
# If -o does not contains file name, set default name
|
|
145
|
+
while len(output_files) < len(output_extensions):
|
|
146
|
+
output_files.append(None)
|
|
147
|
+
to_remove = [] # elements of spdx format on windows that should be removed
|
|
148
|
+
for i, output_extension in enumerate(output_extensions):
|
|
149
|
+
if output_files[i] is None or output_files[i] == "":
|
|
150
|
+
if formats:
|
|
151
|
+
if formats[i].startswith('spdx') or formats[i].startswith('cyclonedx'):
|
|
152
|
+
if platform.system() == 'Windows':
|
|
153
|
+
logger.warning(f'{formats[i]} is not supported on Windows. Please remove {formats[i]} from format.')
|
|
154
|
+
to_remove.append(i)
|
|
155
|
+
else:
|
|
156
|
+
if formats[i].startswith('spdx'):
|
|
157
|
+
output_files[i] = f"fosslight_spdx_all_{_start_time}"
|
|
158
|
+
elif formats[i].startswith('cyclonedx'):
|
|
159
|
+
output_files[i] = f'fosslight_cyclonedx_all_{_start_time}'
|
|
160
|
+
else:
|
|
161
|
+
if output_extension == _json_ext:
|
|
162
|
+
output_files[i] = f"fosslight_opossum_all_{_start_time}"
|
|
163
|
+
else:
|
|
164
|
+
output_files[i] = f"fosslight_report_all_{_start_time}"
|
|
165
|
+
else:
|
|
166
|
+
if output_extension == _json_ext:
|
|
167
|
+
output_files[i] = f"fosslight_opossum_all_{_start_time}"
|
|
168
|
+
else:
|
|
169
|
+
output_files[i] = f"fosslight_report_all_{_start_time}"
|
|
170
|
+
for index in sorted(to_remove, reverse=True):
|
|
171
|
+
# remove elements of spdx format on windows
|
|
172
|
+
del output_files[index]
|
|
173
|
+
del output_extensions[index]
|
|
174
|
+
del formats[index]
|
|
175
|
+
if len(output_extensions) < 1:
|
|
176
|
+
sys.exit(0)
|
|
144
177
|
|
|
145
178
|
if not correct_fpath:
|
|
146
179
|
correct_fpath = src_path
|
|
@@ -150,21 +183,16 @@ def run_scanner(src_path, dep_arguments, output_path, keep_raw_data=False,
|
|
|
150
183
|
abs_path = os.path.abspath(src_path)
|
|
151
184
|
|
|
152
185
|
if success:
|
|
153
|
-
output_files = {"SRC": f"fosslight_src_{_start_time}{output_extension}",
|
|
154
|
-
"BIN": f"fosslight_bin_{_start_time}{output_extension}",
|
|
155
|
-
"DEP": f"fosslight_dep_{_start_time}{output_extension}",
|
|
156
|
-
"PRECHECKER": f"fosslight_lint_{_start_time}.yaml"}
|
|
157
186
|
if run_prechecker:
|
|
158
|
-
output_prechecker = os.path.join(_output_dir, output_files["PRECHECKER"])
|
|
159
187
|
success, result = call_analysis_api(src_path, "Prechecker Lint",
|
|
160
188
|
-1, prechecker_lint,
|
|
161
|
-
abs_path, False,
|
|
189
|
+
abs_path, False, _output_dir,
|
|
162
190
|
exclude_path=path_to_exclude)
|
|
163
191
|
|
|
164
192
|
if run_src:
|
|
165
193
|
try:
|
|
166
194
|
if fosslight_source_installed:
|
|
167
|
-
src_output =
|
|
195
|
+
src_output = _output_dir
|
|
168
196
|
success, result = call_analysis_api(
|
|
169
197
|
src_path,
|
|
170
198
|
"Source Analysis",
|
|
@@ -177,17 +205,17 @@ def run_scanner(src_path, dep_arguments, output_path, keep_raw_data=False,
|
|
|
177
205
|
selected_scanner=selected_source_scanner,
|
|
178
206
|
source_write_json_file=source_write_json_file,
|
|
179
207
|
source_print_matched_text=source_print_matched_text,
|
|
180
|
-
source_time_out=source_time_out
|
|
208
|
+
source_time_out=source_time_out,
|
|
209
|
+
formats=formats
|
|
181
210
|
)
|
|
182
211
|
if success:
|
|
183
212
|
all_scan_item.file_items.update(result[2].file_items)
|
|
184
213
|
all_cover_items.append(result[2].cover)
|
|
185
214
|
|
|
186
215
|
else: # Run fosslight_source by using docker image
|
|
187
|
-
src_output = os.path.join("output", output_files["SRC"])
|
|
188
216
|
output_rel_path = os.path.relpath(abs_path, os.getcwd())
|
|
189
217
|
command = shlex.quote(f"docker run -it -v {_output_dir}:/app/output "
|
|
190
|
-
f"fosslight -p {output_rel_path} -o
|
|
218
|
+
f"fosslight -p {output_rel_path} -o output")
|
|
191
219
|
if path_to_exclude:
|
|
192
220
|
command += f" -e {' '.join(path_to_exclude)}"
|
|
193
221
|
command_result = subprocess.run(command, stdout=subprocess.PIPE, text=True)
|
|
@@ -200,8 +228,8 @@ def run_scanner(src_path, dep_arguments, output_path, keep_raw_data=False,
|
|
|
200
228
|
success, result = call_analysis_api(src_path, "Binary Analysis",
|
|
201
229
|
1, binary_analysis.find_binaries,
|
|
202
230
|
abs_path,
|
|
203
|
-
|
|
204
|
-
|
|
231
|
+
_output_dir,
|
|
232
|
+
formats, db_url, binary_simple,
|
|
205
233
|
correct_mode, correct_fpath,
|
|
206
234
|
path_to_exclude=path_to_exclude)
|
|
207
235
|
if success:
|
|
@@ -209,11 +237,10 @@ def run_scanner(src_path, dep_arguments, output_path, keep_raw_data=False,
|
|
|
209
237
|
all_cover_items.append(result.cover)
|
|
210
238
|
|
|
211
239
|
if run_dep:
|
|
212
|
-
dep_scanitem = run_dependency(src_path,
|
|
213
|
-
dep_arguments, path_to_exclude)
|
|
240
|
+
dep_scanitem = run_dependency(src_path, _output_dir,
|
|
241
|
+
dep_arguments, path_to_exclude, formats)
|
|
214
242
|
all_scan_item.file_items.update(dep_scanitem.file_items)
|
|
215
243
|
all_cover_items.append(dep_scanitem.cover)
|
|
216
|
-
|
|
217
244
|
else:
|
|
218
245
|
return
|
|
219
246
|
|
|
@@ -221,8 +248,6 @@ def run_scanner(src_path, dep_arguments, output_path, keep_raw_data=False,
|
|
|
221
248
|
logger.error(f"Scanning: {ex}")
|
|
222
249
|
|
|
223
250
|
try:
|
|
224
|
-
output_file_without_ext = os.path.join(final_excel_dir, output_file)
|
|
225
|
-
final_report = f"{output_file_without_ext}{output_extension}"
|
|
226
251
|
cover = CoverItem(tool_name=PKG_NAME,
|
|
227
252
|
start_time=_start_time,
|
|
228
253
|
input_path=abs_path,
|
|
@@ -239,17 +264,32 @@ def run_scanner(src_path, dep_arguments, output_path, keep_raw_data=False,
|
|
|
239
264
|
|
|
240
265
|
if remove_src_data:
|
|
241
266
|
all_scan_item = update_oss_item(all_scan_item, default_oss_name, default_oss_version, url)
|
|
242
|
-
|
|
267
|
+
|
|
268
|
+
combined_paths_and_files = [os.path.join(final_excel_dir, file) for file in output_files]
|
|
269
|
+
results = []
|
|
270
|
+
final_reports = []
|
|
271
|
+
for combined_path_and_file, output_extension, output_format in zip(combined_paths_and_files, output_extensions, formats):
|
|
272
|
+
results.append(write_output_file(combined_path_and_file, output_extension, all_scan_item, {}, {}, output_format))
|
|
273
|
+
for success, msg, result_file in results:
|
|
274
|
+
if success:
|
|
275
|
+
final_reports.append(result_file)
|
|
276
|
+
logger.info(f"Output file: {result_file}")
|
|
277
|
+
else:
|
|
278
|
+
logger.error(f"Fail to generate result file {result_file}. msg:({msg})")
|
|
279
|
+
|
|
243
280
|
if success:
|
|
244
|
-
if
|
|
245
|
-
logger.info(f'Generated the result file: {
|
|
246
|
-
result_log["Output File"] =
|
|
281
|
+
if final_reports:
|
|
282
|
+
logger.info(f'Generated the result file: {", ".join(final_reports)}')
|
|
283
|
+
result_log["Output File"] = ', '.join(final_reports)
|
|
247
284
|
else:
|
|
248
285
|
result_log["Output File"] = 'Nothing is detected from the scanner so output file is not generated.'
|
|
249
|
-
else:
|
|
250
|
-
logger.error(f"Fail to generate a result file({final_report}): {err_msg}")
|
|
251
286
|
|
|
252
287
|
if ui_mode:
|
|
288
|
+
if output_files:
|
|
289
|
+
output_file = output_files[0]
|
|
290
|
+
else:
|
|
291
|
+
output_file = OUTPUT_REPORT_PREFIX + _start_time
|
|
292
|
+
output_file_without_ext = os.path.join(final_excel_dir, output_file)
|
|
253
293
|
ui_mode_report = f"{output_file_without_ext}.json"
|
|
254
294
|
success, err_msg = create_scancodejson(all_scan_item, ui_mode_report, src_path)
|
|
255
295
|
if success and os.path.isfile(ui_mode_report):
|
|
@@ -328,7 +368,7 @@ def run_main(mode_list, path_arg, dep_arguments, output_file_or_dir, file_format
|
|
|
328
368
|
source_time_out=120, binary_simple=False):
|
|
329
369
|
global _executed_path, _start_time
|
|
330
370
|
|
|
331
|
-
|
|
371
|
+
output_files = []
|
|
332
372
|
default_oss_name = ""
|
|
333
373
|
default_oss_version = ""
|
|
334
374
|
src_path = ""
|
|
@@ -349,10 +389,10 @@ def run_main(mode_list, path_arg, dep_arguments, output_file_or_dir, file_format
|
|
|
349
389
|
before_comp_f = path_arg[0]
|
|
350
390
|
after_comp_f = path_arg[1]
|
|
351
391
|
else:
|
|
352
|
-
logger.error("Enter two FOSSLight report file with 'p' option.")
|
|
392
|
+
logger.error("(compare mode) Enter two FOSSLight report file with 'p' option.")
|
|
353
393
|
return False
|
|
354
394
|
else:
|
|
355
|
-
CUSTOMIZED_FORMAT = {
|
|
395
|
+
CUSTOMIZED_FORMAT = {}
|
|
356
396
|
if isinstance(path_arg, list):
|
|
357
397
|
if len(path_arg) == 1:
|
|
358
398
|
src_path = path_arg[0]
|
|
@@ -368,12 +408,14 @@ def run_main(mode_list, path_arg, dep_arguments, output_file_or_dir, file_format
|
|
|
368
408
|
extract_folder = src_path
|
|
369
409
|
break
|
|
370
410
|
else:
|
|
371
|
-
logger.warning(f"Cannot analyze with multiple path: {path_arg}")
|
|
411
|
+
logger.warning(f"(-p option) Cannot analyze with multiple path: {path_arg}")
|
|
372
412
|
|
|
373
|
-
success, msg, output_path,
|
|
374
|
-
|
|
413
|
+
success, msg, output_path, output_files, output_extensions, formats = check_output_formats_v2(output_file_or_dir, file_format,
|
|
414
|
+
CUSTOMIZED_FORMAT)
|
|
375
415
|
if output_path == "":
|
|
376
416
|
output_path = _executed_path
|
|
417
|
+
else:
|
|
418
|
+
output_path = os.path.abspath(output_path)
|
|
377
419
|
|
|
378
420
|
if not success:
|
|
379
421
|
logger.error(msg)
|
|
@@ -381,18 +423,18 @@ def run_main(mode_list, path_arg, dep_arguments, output_file_or_dir, file_format
|
|
|
381
423
|
try:
|
|
382
424
|
if "compare" in mode_list:
|
|
383
425
|
if before_comp_f == '' or after_comp_f == '':
|
|
384
|
-
logger.error("before and after files are necessary.")
|
|
426
|
+
logger.error("(compare mode) before and after files are necessary.")
|
|
385
427
|
return False
|
|
386
428
|
if not os.path.exists(os.path.join(_executed_path, before_comp_f)):
|
|
387
|
-
logger.error("Cannot find before FOSSLight report file (1st param with -y option).")
|
|
429
|
+
logger.error("(compare mode) Cannot find before FOSSLight report file (1st param with -y option).")
|
|
388
430
|
return False
|
|
389
431
|
if not os.path.exists(os.path.join(_executed_path, after_comp_f)):
|
|
390
|
-
logger.error("Cannot find after FOSSLight report file (2nd param with -y option).")
|
|
432
|
+
logger.error("(compare mode) Cannot find after FOSSLight report file (2nd param with -y option).")
|
|
391
433
|
return False
|
|
392
434
|
ret, final_excel_dir, result_log = init(output_path)
|
|
393
435
|
|
|
394
436
|
run_compare(os.path.join(_executed_path, before_comp_f), os.path.join(_executed_path, after_comp_f),
|
|
395
|
-
final_excel_dir,
|
|
437
|
+
final_excel_dir, output_files, output_extensions, _start_time, _output_dir)
|
|
396
438
|
else:
|
|
397
439
|
run_src = False
|
|
398
440
|
run_bin = False
|
|
@@ -430,27 +472,20 @@ def run_main(mode_list, path_arg, dep_arguments, output_file_or_dir, file_format
|
|
|
430
472
|
remove_downloaded_source = True
|
|
431
473
|
success, src_path, default_oss_name, default_oss_version = download_source(url_to_analyze, output_path)
|
|
432
474
|
|
|
433
|
-
if output_extension == ".yaml":
|
|
434
|
-
correct_mode = False
|
|
435
|
-
correct_fpath = ""
|
|
436
|
-
else:
|
|
437
|
-
if not correct_fpath:
|
|
438
|
-
correct_fpath = src_path
|
|
439
|
-
|
|
440
475
|
if src_path != "":
|
|
441
476
|
run_scanner(src_path, dep_arguments, output_path, keep_raw_data,
|
|
442
477
|
run_src, run_bin, run_dep, run_prechecker,
|
|
443
|
-
remove_downloaded_source, {},
|
|
444
|
-
|
|
478
|
+
remove_downloaded_source, {}, output_files,
|
|
479
|
+
output_extensions, num_cores, db_url,
|
|
445
480
|
default_oss_name, default_oss_version, url_to_analyze,
|
|
446
481
|
correct_mode, correct_fpath, ui_mode, path_to_exclude,
|
|
447
482
|
selected_source_scanner, source_write_json_file, source_print_matched_text, source_time_out,
|
|
448
|
-
binary_simple)
|
|
483
|
+
binary_simple, formats)
|
|
449
484
|
|
|
450
485
|
if extract_folder:
|
|
451
486
|
shutil.rmtree(extract_folder)
|
|
452
487
|
else:
|
|
453
|
-
logger.error("No mode has been selected for analysis.")
|
|
488
|
+
logger.error("(mode) No mode has been selected for analysis.")
|
|
454
489
|
try:
|
|
455
490
|
if not keep_raw_data:
|
|
456
491
|
logger.debug(f"Remove temporary files: {_output_dir}")
|
|
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_scanner-2.0.1 → fosslight_scanner-2.1.1}/src/fosslight_scanner/resources/bom_compare.html
RENAMED
|
File without changes
|
{fosslight_scanner-2.0.1 → fosslight_scanner-2.1.1}/src/fosslight_scanner.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{fosslight_scanner-2.0.1 → fosslight_scanner-2.1.1}/src/fosslight_scanner.egg-info/entry_points.txt
RENAMED
|
File without changes
|
{fosslight_scanner-2.0.1 → fosslight_scanner-2.1.1}/src/fosslight_scanner.egg-info/top_level.txt
RENAMED
|
File without changes
|