Skip to content

Commit 4df7605

Browse files
committed
Modify to remove dup. oss
1 parent 07a4fba commit 4df7605

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/fosslight_binary/_binary.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def __init__(self, value):
2929
self.binary_name_without_path = ""
3030
self.bin_name_with_path = value
3131
self.found_in_owasp = False
32-
self.is_binary = True
32+
self.found_in_bin_db = False
3333

3434
def __del__(self):
3535
pass

src/fosslight_binary/_binary_dao.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,20 @@ def get_oss_info_from_db(bin_info_list, dburl=""):
4343
for idx, row in df_result.iterrows():
4444
if not item.found_in_owasp:
4545
oss_from_db = OssItem(row['ossname'], row['ossversion'], row['license'])
46-
bin_oss_items.append(oss_from_db)
46+
47+
if not bin_oss_items:
48+
bin_oss_items.append(oss_from_db)
49+
else:
50+
for ossItem in bin_oss_items:
51+
if not (ossItem.name == oss_from_db.name and
52+
ossItem.version == oss_from_db.version and
53+
ossItem.license == oss_from_db.license):
54+
bin_oss_items.append(oss_from_db)
4755

4856
if bin_oss_items:
4957
item.set_oss_items(bin_oss_items)
5058
item.comment = "Binary DB result"
59+
item.found_in_binary = True
5160

5261
disconnect_lge_bin_db()
5362
return bin_info_list, _cnt_auto_identified

0 commit comments

Comments
 (0)