fosslight-util 2.1.10__py3-none-any.whl → 2.1.12__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 +4 -6
- fosslight_util/download.py +7 -11
- fosslight_util/write_cyclonedx.py +3 -2
- fosslight_util/write_scancodejson.py +31 -14
- {fosslight_util-2.1.10.dist-info → fosslight_util-2.1.12.dist-info}/METADATA +1 -1
- {fosslight_util-2.1.10.dist-info → fosslight_util-2.1.12.dist-info}/RECORD +10 -10
- {fosslight_util-2.1.10.dist-info → fosslight_util-2.1.12.dist-info}/LICENSE +0 -0
- {fosslight_util-2.1.10.dist-info → fosslight_util-2.1.12.dist-info}/WHEEL +0 -0
- {fosslight_util-2.1.10.dist-info → fosslight_util-2.1.12.dist-info}/entry_points.txt +0 -0
- {fosslight_util-2.1.10.dist-info → fosslight_util-2.1.12.dist-info}/top_level.txt +0 -0
fosslight_util/correct.py
CHANGED
|
@@ -61,17 +61,15 @@ def correct_with_yaml(correct_filepath, path_to_scan, scan_item):
|
|
|
61
61
|
|
|
62
62
|
yaml_path_exists = True
|
|
63
63
|
exclude_fileitems.append(idx)
|
|
64
|
-
|
|
65
|
-
if not yaml_path_exists:
|
|
64
|
+
if scanner_name == FOSSLIGHT_SOURCE and not yaml_path_exists:
|
|
66
65
|
correct_item = copy.deepcopy(yaml_file_item)
|
|
67
66
|
if os.path.exists(os.path.normpath(yaml_file_item.source_name_or_path)):
|
|
68
67
|
correct_item.comment = 'Loaded from sbom-info.yaml'
|
|
69
68
|
correct_fileitems.append(correct_item)
|
|
70
69
|
else:
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
correct_fileitems.append(correct_item)
|
|
70
|
+
correct_item.exclude = True
|
|
71
|
+
correct_item.comment = 'Added by sbom-info.yaml'
|
|
72
|
+
correct_fileitems.append(correct_item)
|
|
75
73
|
if correct_fileitems:
|
|
76
74
|
scan_item.append_file_items(correct_fileitems, scanner_name)
|
|
77
75
|
find_match = True
|
fosslight_util/download.py
CHANGED
|
@@ -123,8 +123,10 @@ def cli_download_and_extract(link: str, target_dir: str, log_dir: str, checkout_
|
|
|
123
123
|
is_rubygems = src_info.get("rubygems", False)
|
|
124
124
|
|
|
125
125
|
# General download (git clone, wget)
|
|
126
|
-
success_git, msg, oss_name, oss_version = download_git_clone(link, target_dir,
|
|
127
|
-
|
|
126
|
+
success_git, msg, oss_name, oss_version = download_git_clone(link, target_dir,
|
|
127
|
+
checkout_to,
|
|
128
|
+
tag, branch,
|
|
129
|
+
ssh_key, id, git_token)
|
|
128
130
|
link = change_ssh_link_to_https(link)
|
|
129
131
|
if (not is_rubygems) and (not success_git):
|
|
130
132
|
if os.path.isfile(target_dir):
|
|
@@ -205,27 +207,21 @@ def get_github_token(git_url):
|
|
|
205
207
|
def download_git_repository(refs_to_checkout, git_url, target_dir, tag):
|
|
206
208
|
success = False
|
|
207
209
|
oss_version = ""
|
|
208
|
-
clone_default_branch_flag = False
|
|
209
210
|
|
|
210
211
|
logger.info(f"Download git url :{git_url}")
|
|
211
212
|
if refs_to_checkout:
|
|
212
213
|
try:
|
|
213
214
|
# gitPython uses the branch argument the same whether you check out to a branch or a tag.
|
|
214
|
-
|
|
215
|
+
Repo.clone_from(git_url, target_dir, branch=refs_to_checkout)
|
|
215
216
|
success = True
|
|
217
|
+
oss_version = refs_to_checkout
|
|
216
218
|
except GitCommandError as error:
|
|
217
219
|
logger.debug(f"Git checkout error:{error}")
|
|
218
220
|
success = False
|
|
219
221
|
|
|
220
222
|
if not success:
|
|
221
|
-
|
|
222
|
-
clone_default_branch_flag = True
|
|
223
|
+
Repo.clone_from(git_url, target_dir)
|
|
223
224
|
success = True
|
|
224
|
-
|
|
225
|
-
if refs_to_checkout != tag or clone_default_branch_flag:
|
|
226
|
-
oss_version = repo.active_branch.name
|
|
227
|
-
else:
|
|
228
|
-
oss_version = repo.git.describe('--tags')
|
|
229
225
|
return success, oss_version
|
|
230
226
|
|
|
231
227
|
|
|
@@ -73,7 +73,7 @@ def write_cyclonedx(output_file_without_ext, output_extension, scan_item):
|
|
|
73
73
|
comp_type = ComponentType.LIBRARY
|
|
74
74
|
|
|
75
75
|
for oss_item in file_item.oss_items:
|
|
76
|
-
if oss_item.name == '':
|
|
76
|
+
if oss_item.name == '' or oss_item.name == '-':
|
|
77
77
|
if scanner_name == FOSSLIGHT_DEPENDENCY:
|
|
78
78
|
continue
|
|
79
79
|
else:
|
|
@@ -93,7 +93,8 @@ def write_cyclonedx(output_file_without_ext, output_extension, scan_item):
|
|
|
93
93
|
if scanner_name == FOSSLIGHT_DEPENDENCY and file_item.purl:
|
|
94
94
|
comp.purl = PackageURL.from_string(file_item.purl)
|
|
95
95
|
if scanner_name != FOSSLIGHT_DEPENDENCY:
|
|
96
|
-
|
|
96
|
+
if file_item.checksum != '0':
|
|
97
|
+
comp.hashes = [HashType(alg=HashAlgorithm.SHA_1, content=file_item.checksum)]
|
|
97
98
|
|
|
98
99
|
if oss_item.download_location != '':
|
|
99
100
|
comp.external_references = [ExternalReference(url=XsUri(oss_item.download_location),
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import logging
|
|
7
7
|
import os
|
|
8
8
|
import json
|
|
9
|
-
from fosslight_util.constant import LOGGER_NAME
|
|
9
|
+
from fosslight_util.constant import LOGGER_NAME, FOSSLIGHT_DEPENDENCY
|
|
10
10
|
from fosslight_util.oss_item import ScannerItem
|
|
11
11
|
from typing import List
|
|
12
12
|
|
|
@@ -20,22 +20,27 @@ def write_scancodejson(output_dir: str, output_filename: str, oss_list: List[Sca
|
|
|
20
20
|
json_output['summary'] = {}
|
|
21
21
|
json_output['license_detections'] = []
|
|
22
22
|
json_output['files'] = []
|
|
23
|
+
json_output['dependencies'] = []
|
|
23
24
|
|
|
24
|
-
for file_items in oss_list.file_items.
|
|
25
|
+
for scanner, file_items in oss_list.file_items.items():
|
|
25
26
|
for fi in file_items:
|
|
26
|
-
if
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
fi.
|
|
32
|
-
|
|
27
|
+
if scanner == FOSSLIGHT_DEPENDENCY:
|
|
28
|
+
json_output['dependencies'] = add_item_in_deps(fi, json_output['dependencies'])
|
|
29
|
+
else:
|
|
30
|
+
if fi.exclude:
|
|
31
|
+
continue
|
|
32
|
+
if fi.oss_items and (all(oss_item.exclude for oss_item in fi.oss_items)):
|
|
33
|
+
continue
|
|
34
|
+
if not fi.source_name_or_path:
|
|
35
|
+
fi.source_name_or_path = EMPTY_FILE_PATH
|
|
36
|
+
json_output['files'] = add_item_in_files(fi, json_output['files'])
|
|
33
37
|
|
|
34
38
|
with open(os.path.join(output_dir, output_filename), 'w') as f:
|
|
35
39
|
json.dump(json_output, f, sort_keys=False, indent=4)
|
|
36
40
|
|
|
37
41
|
|
|
38
|
-
def
|
|
42
|
+
def get_oss_item_list(oss_items):
|
|
43
|
+
scan_oss_items = []
|
|
39
44
|
for oi in oss_items:
|
|
40
45
|
if oi.exclude:
|
|
41
46
|
continue
|
|
@@ -46,9 +51,9 @@ def append_oss_item_in_filesitem(oss_items, files_item):
|
|
|
46
51
|
oss_item['copyright'] = oi.copyright
|
|
47
52
|
oss_item['download_location'] = oi.download_location
|
|
48
53
|
oss_item['comment'] = oi.comment
|
|
49
|
-
|
|
54
|
+
scan_oss_items.append(oss_item)
|
|
50
55
|
|
|
51
|
-
return
|
|
56
|
+
return scan_oss_items
|
|
52
57
|
|
|
53
58
|
|
|
54
59
|
def add_item_in_files(file_item, files_list):
|
|
@@ -57,8 +62,20 @@ def add_item_in_files(file_item, files_list):
|
|
|
57
62
|
files_item['name'] = os.path.basename(file_item.source_name_or_path)
|
|
58
63
|
files_item['is_binary'] = file_item.is_binary
|
|
59
64
|
files_item['base_name'], files_item['extension'] = os.path.splitext(os.path.basename(file_item.source_name_or_path))
|
|
60
|
-
files_item['oss'] =
|
|
61
|
-
|
|
65
|
+
files_item['oss'] = get_oss_item_list(file_item.oss_items)
|
|
66
|
+
|
|
62
67
|
files_list.append(files_item)
|
|
63
68
|
|
|
64
69
|
return files_list
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def add_item_in_deps(file_item, deps_list):
|
|
73
|
+
deps_item = {}
|
|
74
|
+
deps_item['purl'] = file_item.purl
|
|
75
|
+
deps_item['scope'] = 'dependencies'
|
|
76
|
+
deps_item['depends_on'] = file_item.depends_on
|
|
77
|
+
deps_item['oss'] = get_oss_item_list(file_item.oss_items)
|
|
78
|
+
|
|
79
|
+
deps_list.append(deps_item)
|
|
80
|
+
|
|
81
|
+
return deps_list
|
|
@@ -2,9 +2,9 @@ fosslight_util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
2
2
|
fosslight_util/_get_downloadable_url.py,sha256=V-wjCHBNFOthOt1tMb6ZCJY7UnlrB_6JI0CFx03AARk,9310
|
|
3
3
|
fosslight_util/compare_yaml.py,sha256=eLqqCLgERxRHN5vsnpQVMXIEU862Lx66mD_y4uMgQE4,2916
|
|
4
4
|
fosslight_util/constant.py,sha256=Ig3ACm9_QirE4389Wt-IfxOqRkVOUjqGnX1B05z2Byo,2151
|
|
5
|
-
fosslight_util/correct.py,sha256=
|
|
5
|
+
fosslight_util/correct.py,sha256=1WEAL-9_KhjFPLucPhv0PNN3K7avm0z8mU6sTuSyeHM,3864
|
|
6
6
|
fosslight_util/cover.py,sha256=qqqKzxqFwKimal764FaugRUBcHWdeKt8af6xeK0mH8E,2040
|
|
7
|
-
fosslight_util/download.py,sha256=
|
|
7
|
+
fosslight_util/download.py,sha256=5nLe0oE1pUHEawM4kLlryusPBlk6ptEvy4HtqwFmCMs,16292
|
|
8
8
|
fosslight_util/exclude.py,sha256=fDmBsZJ_F7O9Oh2T-07R03XNbElo1tFaf_z01KfSAqU,2399
|
|
9
9
|
fosslight_util/help.py,sha256=M3_XahUkP794US9Q0NS6ujmGvrFFnKBHsTU95Fg1KpA,2181
|
|
10
10
|
fosslight_util/oss_item.py,sha256=8W2HlwqGH3l1iPPdvycrRYKsBSBpqAkqYyYtBVPgMtY,6868
|
|
@@ -14,19 +14,19 @@ fosslight_util/read_excel.py,sha256=-QvrdxaNqYOpIm1H7ZqIEh5NLvFPymZo6BAOZcQmQug,
|
|
|
14
14
|
fosslight_util/set_log.py,sha256=Xpa94AiOyGEK8ucaYkvkAllvlen1Pq_d6UG6kPYBYBc,3780
|
|
15
15
|
fosslight_util/spdx_licenses.py,sha256=GvMNe_D4v2meapTVwPu2BJXInnTo3_gIzg669eJhUu0,3691
|
|
16
16
|
fosslight_util/timer_thread.py,sha256=5VbZENQPD-N0NUmzEktqGr6Am-e7vxD79K05mmr29g0,433
|
|
17
|
-
fosslight_util/write_cyclonedx.py,sha256=
|
|
17
|
+
fosslight_util/write_cyclonedx.py,sha256=hq817j-0OM89B8jtZKgHgvVa0YEaYHlz_8R5vNpe21I,9662
|
|
18
18
|
fosslight_util/write_excel.py,sha256=G0fIslbWoOtWZCJxbBGLCpUKbhmwrrqhI5PHwRw8_44,9931
|
|
19
19
|
fosslight_util/write_opossum.py,sha256=ltmo6SkugKWdAYupeCqwE4-3lua0GwLpix1XqFC-tT8,11678
|
|
20
|
-
fosslight_util/write_scancodejson.py,sha256=
|
|
20
|
+
fosslight_util/write_scancodejson.py,sha256=dMCjTtUnNR5BCL6gBCleDT8bTSAN5Gg2RAfimmkGXUE,2692
|
|
21
21
|
fosslight_util/write_spdx.py,sha256=Ov9jBlfVrkWIymcfAxbupUxDZKfCOZZGOPZ4v-x230M,12108
|
|
22
22
|
fosslight_util/write_txt.py,sha256=BEFjYBppqk1CITx-fUN4vfvKv0XCs1GXWtc2Iu-etU4,629
|
|
23
23
|
fosslight_util/write_yaml.py,sha256=QlEKoIPQsEaYERfbP53TeKgnllYzhLQWm5wYjnWtVjE,3238
|
|
24
24
|
fosslight_util/resources/frequentLicenselist.json,sha256=GUhzK6tu7ok10fekOnmVmUgIGRC-acGABZKTNKfDyYA,4776157
|
|
25
25
|
fosslight_util/resources/frequent_license_nick_list.json,sha256=ryU2C_6ZxHbz90_sUN9OvI9GXkCMLu7oGcmd9W79YYo,5005
|
|
26
26
|
fosslight_util/resources/licenses.json,sha256=mK55z-bhY7Mjpj2KsO1crKGGL-X3F6MBFQJ0zLlx010,240843
|
|
27
|
-
fosslight_util-2.1.
|
|
28
|
-
fosslight_util-2.1.
|
|
29
|
-
fosslight_util-2.1.
|
|
30
|
-
fosslight_util-2.1.
|
|
31
|
-
fosslight_util-2.1.
|
|
32
|
-
fosslight_util-2.1.
|
|
27
|
+
fosslight_util-2.1.12.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
28
|
+
fosslight_util-2.1.12.dist-info/METADATA,sha256=MQjn_S8SMaHujkl1VVW4Mdkj4xGuC5MvaKakx9mCtLY,6500
|
|
29
|
+
fosslight_util-2.1.12.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
30
|
+
fosslight_util-2.1.12.dist-info/entry_points.txt,sha256=bzXX5i7HZ13V8BLKvtu_9KO3ZjtRypH-XszOXT6I3bU,69
|
|
31
|
+
fosslight_util-2.1.12.dist-info/top_level.txt,sha256=2qyYWGLakgBRy4BqoBNt-I5C29tBr_e93e5e1pbuTGA,15
|
|
32
|
+
fosslight_util-2.1.12.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|