2323import fosslight_util .constant as constant
2424from fosslight_util .output_format import check_output_format
2525from fosslight_reuse ._fosslight_reuse import run_lint as reuse_lint
26- from .common import copy_file , call_analysis_api
26+ from .common import (copy_file , call_analysis_api ,
27+ overwrite_excel , extract_name_from_link )
2728from fosslight_util .write_excel import merge_excels
2829
2930OUTPUT_EXCEL_PREFIX = "FOSSLight-Report_"
@@ -90,7 +91,7 @@ def run_dependency(path_to_analyze, output_file_with_path, params=""):
9091def run_scanner (src_path , dep_arguments , output_path , keep_raw_data = False ,
9192 run_src = True , run_bin = True , run_dep = True , run_reuse = True ,
9293 remove_src_data = True , result_log = {}, output_file = "" ,
93- output_extension = "" , num_cores = - 1 , db_url = "" ):
94+ output_extension = "" , num_cores = - 1 , db_url = "" , default_oss_name = "" ):
9495 create_csv = False
9596 final_excel_dir = output_path
9697 success = True
@@ -157,6 +158,8 @@ def run_scanner(src_path, dep_arguments, output_path, keep_raw_data=False,
157158 try :
158159 output_file_without_ext = os .path .join (final_excel_dir , output_file )
159160 final_report = f"{ output_file_without_ext } { output_extension } "
161+ if remove_src_data :
162+ overwrite_excel (_output_dir , default_oss_name )
160163 success , output_files = merge_excels (_output_dir , final_report , create_csv )
161164
162165 if success and output_files :
@@ -187,7 +190,7 @@ def download_source(link, out_dir):
187190 try :
188191 success , final_excel_dir , result_log = init (out_dir )
189192 temp_src_dir = os .path .join (
190- _output_dir , SRC_DIR_FROM_LINK_PREFIX + start_time )
193+ _output_dir , SRC_DIR_FROM_LINK_PREFIX + start_time )
191194
192195 logger .info (f"Link to download: { link } " )
193196 success , msg = cli_download_and_extract (
@@ -254,6 +257,7 @@ def run_main(mode, src_path, dep_arguments, output_file_or_dir, file_format, url
254257
255258 if url_to_analyze != "" :
256259 remove_downloaded_source = True
260+ default_oss_name = extract_name_from_link (url_to_analyze )
257261 success , src_path = download_source (url_to_analyze , output_path )
258262
259263 if mode == "reuse" :
@@ -274,7 +278,7 @@ def run_main(mode, src_path, dep_arguments, output_file_or_dir, file_format, url
274278 run_scanner (src_path , dep_arguments , output_path , keep_raw_data ,
275279 run_src , run_bin , run_dep , run_reuse ,
276280 remove_downloaded_source , {}, output_file ,
277- output_extension , num_cores , db_url )
281+ output_extension , num_cores , db_url , default_oss_name )
278282
279283 except Exception as ex :
280284 logger .warning (str (ex ))
0 commit comments