fosslight-util 1.4.44__tar.gz → 1.4.45__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.44 → fosslight_util-1.4.45}/PKG-INFO +1 -1
- {fosslight_util-1.4.44 → fosslight_util-1.4.45}/setup.py +1 -1
- {fosslight_util-1.4.44 → fosslight_util-1.4.45}/src/fosslight_util/download.py +39 -26
- {fosslight_util-1.4.44 → fosslight_util-1.4.45}/src/fosslight_util/oss_item.py +2 -2
- {fosslight_util-1.4.44 → fosslight_util-1.4.45}/src/fosslight_util/parsing_yaml.py +2 -1
- {fosslight_util-1.4.44 → fosslight_util-1.4.45}/src/fosslight_util/read_excel.py +2 -0
- {fosslight_util-1.4.44 → fosslight_util-1.4.45}/src/fosslight_util/write_excel.py +3 -3
- {fosslight_util-1.4.44 → fosslight_util-1.4.45}/src/fosslight_util/write_yaml.py +1 -1
- {fosslight_util-1.4.44 → fosslight_util-1.4.45}/src/fosslight_util.egg-info/PKG-INFO +1 -1
- {fosslight_util-1.4.44 → fosslight_util-1.4.45}/LICENSE +0 -0
- {fosslight_util-1.4.44 → fosslight_util-1.4.45}/MANIFEST.in +0 -0
- {fosslight_util-1.4.44 → fosslight_util-1.4.45}/README.md +0 -0
- {fosslight_util-1.4.44 → fosslight_util-1.4.45}/requirements.txt +0 -0
- {fosslight_util-1.4.44 → fosslight_util-1.4.45}/setup.cfg +0 -0
- {fosslight_util-1.4.44 → fosslight_util-1.4.45}/src/fosslight_util/__init__.py +0 -0
- {fosslight_util-1.4.44 → fosslight_util-1.4.45}/src/fosslight_util/_get_downloadable_url.py +0 -0
- {fosslight_util-1.4.44 → fosslight_util-1.4.45}/src/fosslight_util/compare_yaml.py +0 -0
- {fosslight_util-1.4.44 → fosslight_util-1.4.45}/src/fosslight_util/constant.py +0 -0
- {fosslight_util-1.4.44 → fosslight_util-1.4.45}/src/fosslight_util/convert_excel_to_yaml.py +0 -0
- {fosslight_util-1.4.44 → fosslight_util-1.4.45}/src/fosslight_util/correct.py +0 -0
- {fosslight_util-1.4.44 → fosslight_util-1.4.45}/src/fosslight_util/cover.py +0 -0
- {fosslight_util-1.4.44 → fosslight_util-1.4.45}/src/fosslight_util/help.py +0 -0
- {fosslight_util-1.4.44 → fosslight_util-1.4.45}/src/fosslight_util/output_format.py +0 -0
- {fosslight_util-1.4.44 → fosslight_util-1.4.45}/src/fosslight_util/resources/frequentLicenselist.json +0 -0
- {fosslight_util-1.4.44 → fosslight_util-1.4.45}/src/fosslight_util/resources/frequent_license_nick_list.json +0 -0
- {fosslight_util-1.4.44 → fosslight_util-1.4.45}/src/fosslight_util/resources/licenses.json +0 -0
- {fosslight_util-1.4.44 → fosslight_util-1.4.45}/src/fosslight_util/set_log.py +0 -0
- {fosslight_util-1.4.44 → fosslight_util-1.4.45}/src/fosslight_util/spdx_licenses.py +0 -0
- {fosslight_util-1.4.44 → fosslight_util-1.4.45}/src/fosslight_util/timer_thread.py +0 -0
- {fosslight_util-1.4.44 → fosslight_util-1.4.45}/src/fosslight_util/write_opossum.py +0 -0
- {fosslight_util-1.4.44 → fosslight_util-1.4.45}/src/fosslight_util/write_scancodejson.py +0 -0
- {fosslight_util-1.4.44 → fosslight_util-1.4.45}/src/fosslight_util/write_spdx.py +0 -0
- {fosslight_util-1.4.44 → fosslight_util-1.4.45}/src/fosslight_util/write_txt.py +0 -0
- {fosslight_util-1.4.44 → fosslight_util-1.4.45}/src/fosslight_util.egg-info/SOURCES.txt +0 -0
- {fosslight_util-1.4.44 → fosslight_util-1.4.45}/src/fosslight_util.egg-info/dependency_links.txt +0 -0
- {fosslight_util-1.4.44 → fosslight_util-1.4.45}/src/fosslight_util.egg-info/entry_points.txt +0 -0
- {fosslight_util-1.4.44 → fosslight_util-1.4.45}/src/fosslight_util.egg-info/requires.txt +0 -0
- {fosslight_util-1.4.44 → fosslight_util-1.4.45}/src/fosslight_util.egg-info/top_level.txt +0 -0
|
@@ -46,12 +46,14 @@ class Alarm(threading.Thread):
|
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
class TimeOutException(Exception):
|
|
49
|
-
|
|
49
|
+
def __init__(self, message, error_code):
|
|
50
|
+
super().__init__(message)
|
|
51
|
+
self.error_code = error_code
|
|
50
52
|
|
|
51
53
|
|
|
52
54
|
def alarm_handler(signum, frame):
|
|
53
55
|
logger.warning("download timeout! (%d sec)", SIGNAL_TIMEOUT)
|
|
54
|
-
raise TimeOutException()
|
|
56
|
+
raise TimeOutException(f'Timeout ({SIGNAL_TIMEOUT} sec)', 1)
|
|
55
57
|
|
|
56
58
|
|
|
57
59
|
def change_src_link_to_https(src_link):
|
|
@@ -127,6 +129,7 @@ def cli_download_and_extract(link: str, target_dir: str, log_dir: str, checkout_
|
|
|
127
129
|
|
|
128
130
|
success = True
|
|
129
131
|
msg = ""
|
|
132
|
+
msg_wget = ""
|
|
130
133
|
oss_name = ""
|
|
131
134
|
oss_version = ""
|
|
132
135
|
log_file_name = "fosslight_download_" + \
|
|
@@ -156,16 +159,20 @@ def cli_download_and_extract(link: str, target_dir: str, log_dir: str, checkout_
|
|
|
156
159
|
|
|
157
160
|
success, downloaded_file, msg_wget, oss_name, oss_version = download_wget(link, target_dir, compressed_only)
|
|
158
161
|
if success:
|
|
159
|
-
success = extract_compressed_file(downloaded_file, target_dir, True)
|
|
162
|
+
success = extract_compressed_file(downloaded_file, target_dir, True, compressed_only)
|
|
160
163
|
# Download from rubygems.org
|
|
161
164
|
elif is_rubygems and shutil.which("gem"):
|
|
162
165
|
success = gem_download(link, target_dir, checkout_to)
|
|
163
166
|
if msg:
|
|
164
167
|
msg = f'git fail: {msg}'
|
|
165
|
-
if
|
|
166
|
-
msg = f'
|
|
168
|
+
if is_rubygems:
|
|
169
|
+
msg = f'gem download: {success}'
|
|
167
170
|
else:
|
|
168
|
-
|
|
171
|
+
if msg_wget:
|
|
172
|
+
msg = f'{msg}, wget fail: {msg_wget}'
|
|
173
|
+
else:
|
|
174
|
+
msg = f'{msg}, wget success'
|
|
175
|
+
|
|
169
176
|
except Exception as error:
|
|
170
177
|
success = False
|
|
171
178
|
msg = str(error)
|
|
@@ -232,13 +239,14 @@ def download_git_clone(git_url, target_dir, checkout_to="", tag="", branch=""):
|
|
|
232
239
|
if github_token != "":
|
|
233
240
|
callbacks = git.RemoteCallbacks(credentials=git.UserPass("foo", github_token)) # username is not used, so set to dummy
|
|
234
241
|
|
|
235
|
-
if platform.system() != "Windows":
|
|
236
|
-
signal.signal(signal.SIGALRM, alarm_handler)
|
|
237
|
-
signal.alarm(SIGNAL_TIMEOUT)
|
|
238
|
-
else:
|
|
239
|
-
alarm = Alarm(SIGNAL_TIMEOUT)
|
|
240
|
-
alarm.start()
|
|
241
242
|
try:
|
|
243
|
+
if platform.system() != "Windows":
|
|
244
|
+
signal.signal(signal.SIGALRM, alarm_handler)
|
|
245
|
+
signal.alarm(SIGNAL_TIMEOUT)
|
|
246
|
+
else:
|
|
247
|
+
alarm = Alarm(SIGNAL_TIMEOUT)
|
|
248
|
+
alarm.start()
|
|
249
|
+
|
|
242
250
|
Path(target_dir).mkdir(parents=True, exist_ok=True)
|
|
243
251
|
repo = git.clone_repository(git_url, target_dir,
|
|
244
252
|
bare=False, repository=None,
|
|
@@ -273,13 +281,15 @@ def download_wget(link, target_dir, compressed_only):
|
|
|
273
281
|
oss_name = ""
|
|
274
282
|
oss_version = ""
|
|
275
283
|
downloaded_file = ""
|
|
276
|
-
|
|
277
|
-
signal.signal(signal.SIGALRM, alarm_handler)
|
|
278
|
-
signal.alarm(SIGNAL_TIMEOUT)
|
|
279
|
-
else:
|
|
280
|
-
alarm = Alarm(SIGNAL_TIMEOUT)
|
|
281
|
-
alarm.start()
|
|
284
|
+
|
|
282
285
|
try:
|
|
286
|
+
if platform.system() != "Windows":
|
|
287
|
+
signal.signal(signal.SIGALRM, alarm_handler)
|
|
288
|
+
signal.alarm(SIGNAL_TIMEOUT)
|
|
289
|
+
else:
|
|
290
|
+
alarm = Alarm(SIGNAL_TIMEOUT)
|
|
291
|
+
alarm.start()
|
|
292
|
+
|
|
283
293
|
Path(target_dir).mkdir(parents=True, exist_ok=True)
|
|
284
294
|
|
|
285
295
|
ret, new_link, oss_name, oss_version = get_downloadable_url(link)
|
|
@@ -320,14 +330,14 @@ def extract_compressed_dir(src_dir, target_dir, remove_after_extract=True):
|
|
|
320
330
|
try:
|
|
321
331
|
files_path = [os.path.join(src_dir, x) for x in os.listdir(src_dir)]
|
|
322
332
|
for fname in files_path:
|
|
323
|
-
extract_compressed_file(fname, target_dir, remove_after_extract)
|
|
333
|
+
extract_compressed_file(fname, target_dir, remove_after_extract, True)
|
|
324
334
|
except Exception as error:
|
|
325
335
|
logger.debug(f"Extract files in dir - failed: {error}")
|
|
326
336
|
return False
|
|
327
337
|
return True
|
|
328
338
|
|
|
329
339
|
|
|
330
|
-
def extract_compressed_file(fname, extract_path, remove_after_extract=True):
|
|
340
|
+
def extract_compressed_file(fname, extract_path, remove_after_extract=True, compressed_only=True):
|
|
331
341
|
success = True
|
|
332
342
|
try:
|
|
333
343
|
is_compressed_file = True
|
|
@@ -349,7 +359,8 @@ def extract_compressed_file(fname, extract_path, remove_after_extract=True):
|
|
|
349
359
|
decompress_bz2(fname, extract_path)
|
|
350
360
|
else:
|
|
351
361
|
is_compressed_file = False
|
|
352
|
-
|
|
362
|
+
if compressed_only:
|
|
363
|
+
success = False
|
|
353
364
|
logger.warning(f"Unsupported file extension: {fname}")
|
|
354
365
|
|
|
355
366
|
if remove_after_extract and is_compressed_file:
|
|
@@ -419,11 +430,13 @@ def gem_download(link, target_dir, checkout_to):
|
|
|
419
430
|
fetch_result = subprocess.check_output(fetch_cmd, universal_newlines=True)
|
|
420
431
|
fetch_result = fetch_result.replace('\n', '').split(' ')[-1]
|
|
421
432
|
downloaded_gem = f"{fetch_result}.gem"
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
433
|
+
if not os.path.isfile(downloaded_gem):
|
|
434
|
+
success = False
|
|
435
|
+
else:
|
|
436
|
+
# gem unpack
|
|
437
|
+
subprocess.check_output(['gem', 'unpack', downloaded_gem], universal_newlines=True)
|
|
438
|
+
# move unpacked file to target directory
|
|
439
|
+
shutil.move(fetch_result, target_dir)
|
|
427
440
|
except Exception as error:
|
|
428
441
|
success = False
|
|
429
442
|
logger.warning(f"gem download - failed: {error}")
|
|
@@ -201,7 +201,7 @@ class OssItem:
|
|
|
201
201
|
|
|
202
202
|
json_item["version"] = self.version
|
|
203
203
|
if len(self.source_name_or_path) > 0:
|
|
204
|
-
json_item["source
|
|
204
|
+
json_item["source path"] = self.source_name_or_path
|
|
205
205
|
if len(self.license) > 0:
|
|
206
206
|
json_item["license"] = self.license
|
|
207
207
|
if self.download_location != "":
|
|
@@ -217,7 +217,7 @@ class OssItem:
|
|
|
217
217
|
if len(self.depends_on) > 0:
|
|
218
218
|
json_item["depends on"] = self.depends_on
|
|
219
219
|
if self.purl != "":
|
|
220
|
-
json_item["
|
|
220
|
+
json_item["package url"] = self.purl
|
|
221
221
|
|
|
222
222
|
return json_item
|
|
223
223
|
|
|
@@ -101,7 +101,8 @@ def set_value_switch(oss, key, value, yaml_file=""):
|
|
|
101
101
|
oss.download_location = value
|
|
102
102
|
elif key in ['license', 'license text']:
|
|
103
103
|
oss.license = value
|
|
104
|
-
elif key in ['file name or path', 'source name or path', '
|
|
104
|
+
elif key in ['file name or path', 'source name or path', 'source path',
|
|
105
|
+
'file', 'binary name', 'binary path']:
|
|
105
106
|
oss.source_name_or_path = value
|
|
106
107
|
elif key in ['copyright text', 'copyright']:
|
|
107
108
|
oss.copyright = value
|
|
@@ -66,7 +66,9 @@ def read_oss_report(excel_file: str, sheet_names: str = "") -> List[OssItem]:
|
|
|
66
66
|
_item_idx = {
|
|
67
67
|
"ID": IDX_CANNOT_FOUND,
|
|
68
68
|
"Source Name or Path": IDX_CANNOT_FOUND,
|
|
69
|
+
"Source Path": IDX_CANNOT_FOUND,
|
|
69
70
|
"Binary Name": IDX_CANNOT_FOUND,
|
|
71
|
+
"Binary Path": IDX_CANNOT_FOUND,
|
|
70
72
|
"OSS Name": IDX_CANNOT_FOUND,
|
|
71
73
|
"OSS Version": IDX_CANNOT_FOUND,
|
|
72
74
|
"License": IDX_CANNOT_FOUND,
|
|
@@ -15,15 +15,15 @@ import fosslight_util.constant as constant
|
|
|
15
15
|
from jsonmerge import merge
|
|
16
16
|
from fosslight_util.cover import CoverItem
|
|
17
17
|
|
|
18
|
-
_HEADER = {'BIN (': ['ID', 'Binary
|
|
18
|
+
_HEADER = {'BIN (': ['ID', 'Binary Path', 'Source Code Path',
|
|
19
19
|
'NOTICE.html', 'OSS Name', 'OSS Version',
|
|
20
20
|
'License', 'Download Location', 'Homepage',
|
|
21
21
|
'Copyright Text', 'Exclude', 'Comment'],
|
|
22
|
-
'SRC': ['ID', 'Source
|
|
22
|
+
'SRC': ['ID', 'Source Path', 'OSS Name',
|
|
23
23
|
'OSS Version', 'License', 'Download Location',
|
|
24
24
|
'Homepage', 'Copyright Text', 'Exclude',
|
|
25
25
|
'Comment'],
|
|
26
|
-
'BIN': ['ID', 'Binary
|
|
26
|
+
'BIN': ['ID', 'Binary Path', 'OSS Name', 'OSS Version',
|
|
27
27
|
'License', 'Download Location', 'Homepage',
|
|
28
28
|
'Copyright Text', 'Exclude', 'Comment']}
|
|
29
29
|
_OUTPUT_FILE_PREFIX = "FOSSLight-Report_"
|
|
@@ -93,7 +93,7 @@ def create_yaml_with_ossitem(item, yaml_dict):
|
|
|
93
93
|
oss_info.get('homepage', '') == item.homepage and \
|
|
94
94
|
oss_info.get('download location', '') == item.download_location and \
|
|
95
95
|
oss_info.get('exclude', False) == item.exclude:
|
|
96
|
-
oss_info.get('source
|
|
96
|
+
oss_info.get('source path', []).extend(item.source_name_or_path)
|
|
97
97
|
oss_info.pop('comment', None)
|
|
98
98
|
merged = True
|
|
99
99
|
break
|
|
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
|
|
File without changes
|
{fosslight_util-1.4.44 → fosslight_util-1.4.45}/src/fosslight_util.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{fosslight_util-1.4.44 → fosslight_util-1.4.45}/src/fosslight_util.egg-info/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|