fosslight-util 2.1.15__tar.gz → 2.1.17__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-2.1.15 → fosslight_util-2.1.17}/PKG-INFO +1 -1
- {fosslight_util-2.1.15 → fosslight_util-2.1.17}/setup.py +1 -1
- {fosslight_util-2.1.15 → fosslight_util-2.1.17}/src/fosslight_util/download.py +34 -13
- {fosslight_util-2.1.15 → fosslight_util-2.1.17}/src/fosslight_util.egg-info/PKG-INFO +1 -1
- {fosslight_util-2.1.15 → fosslight_util-2.1.17}/LICENSE +0 -0
- {fosslight_util-2.1.15 → fosslight_util-2.1.17}/MANIFEST.in +0 -0
- {fosslight_util-2.1.15 → fosslight_util-2.1.17}/README.md +0 -0
- {fosslight_util-2.1.15 → fosslight_util-2.1.17}/requirements.txt +0 -0
- {fosslight_util-2.1.15 → fosslight_util-2.1.17}/setup.cfg +0 -0
- {fosslight_util-2.1.15 → fosslight_util-2.1.17}/src/fosslight_util/__init__.py +0 -0
- {fosslight_util-2.1.15 → fosslight_util-2.1.17}/src/fosslight_util/_get_downloadable_url.py +0 -0
- {fosslight_util-2.1.15 → fosslight_util-2.1.17}/src/fosslight_util/compare_yaml.py +0 -0
- {fosslight_util-2.1.15 → fosslight_util-2.1.17}/src/fosslight_util/constant.py +0 -0
- {fosslight_util-2.1.15 → fosslight_util-2.1.17}/src/fosslight_util/correct.py +0 -0
- {fosslight_util-2.1.15 → fosslight_util-2.1.17}/src/fosslight_util/cover.py +0 -0
- {fosslight_util-2.1.15 → fosslight_util-2.1.17}/src/fosslight_util/exclude.py +0 -0
- {fosslight_util-2.1.15 → fosslight_util-2.1.17}/src/fosslight_util/help.py +0 -0
- {fosslight_util-2.1.15 → fosslight_util-2.1.17}/src/fosslight_util/oss_item.py +0 -0
- {fosslight_util-2.1.15 → fosslight_util-2.1.17}/src/fosslight_util/output_format.py +0 -0
- {fosslight_util-2.1.15 → fosslight_util-2.1.17}/src/fosslight_util/parsing_yaml.py +0 -0
- {fosslight_util-2.1.15 → fosslight_util-2.1.17}/src/fosslight_util/read_excel.py +0 -0
- {fosslight_util-2.1.15 → fosslight_util-2.1.17}/src/fosslight_util/resources/frequentLicenselist.json +0 -0
- {fosslight_util-2.1.15 → fosslight_util-2.1.17}/src/fosslight_util/resources/frequent_license_nick_list.json +0 -0
- {fosslight_util-2.1.15 → fosslight_util-2.1.17}/src/fosslight_util/resources/licenses.json +0 -0
- {fosslight_util-2.1.15 → fosslight_util-2.1.17}/src/fosslight_util/set_log.py +0 -0
- {fosslight_util-2.1.15 → fosslight_util-2.1.17}/src/fosslight_util/spdx_licenses.py +0 -0
- {fosslight_util-2.1.15 → fosslight_util-2.1.17}/src/fosslight_util/timer_thread.py +0 -0
- {fosslight_util-2.1.15 → fosslight_util-2.1.17}/src/fosslight_util/write_cyclonedx.py +0 -0
- {fosslight_util-2.1.15 → fosslight_util-2.1.17}/src/fosslight_util/write_excel.py +0 -0
- {fosslight_util-2.1.15 → fosslight_util-2.1.17}/src/fosslight_util/write_opossum.py +0 -0
- {fosslight_util-2.1.15 → fosslight_util-2.1.17}/src/fosslight_util/write_scancodejson.py +0 -0
- {fosslight_util-2.1.15 → fosslight_util-2.1.17}/src/fosslight_util/write_spdx.py +0 -0
- {fosslight_util-2.1.15 → fosslight_util-2.1.17}/src/fosslight_util/write_txt.py +0 -0
- {fosslight_util-2.1.15 → fosslight_util-2.1.17}/src/fosslight_util/write_yaml.py +0 -0
- {fosslight_util-2.1.15 → fosslight_util-2.1.17}/src/fosslight_util.egg-info/SOURCES.txt +0 -0
- {fosslight_util-2.1.15 → fosslight_util-2.1.17}/src/fosslight_util.egg-info/dependency_links.txt +0 -0
- {fosslight_util-2.1.15 → fosslight_util-2.1.17}/src/fosslight_util.egg-info/entry_points.txt +0 -0
- {fosslight_util-2.1.15 → fosslight_util-2.1.17}/src/fosslight_util.egg-info/requires.txt +0 -0
- {fosslight_util-2.1.15 → fosslight_util-2.1.17}/src/fosslight_util.egg-info/top_level.txt +0 -0
|
@@ -26,6 +26,7 @@ import platform
|
|
|
26
26
|
import subprocess
|
|
27
27
|
import re
|
|
28
28
|
from typing import Tuple
|
|
29
|
+
import urllib.parse
|
|
29
30
|
|
|
30
31
|
logger = logging.getLogger(constant.LOGGER_NAME)
|
|
31
32
|
compression_extension = {".tar.bz2", ".tar.gz", ".tar.xz", ".tgz", ".tar", ".zip", ".jar", ".bz2"}
|
|
@@ -94,7 +95,8 @@ def parse_src_link(src_link):
|
|
|
94
95
|
|
|
95
96
|
def cli_download_and_extract(link: str, target_dir: str, log_dir: str, checkout_to: str = "",
|
|
96
97
|
compressed_only: bool = False, ssh_key: str = "",
|
|
97
|
-
id: str = "", git_token: str = ""
|
|
98
|
+
id: str = "", git_token: str = "",
|
|
99
|
+
called_cli: bool = True) -> Tuple[bool, str, str, str]:
|
|
98
100
|
global logger
|
|
99
101
|
|
|
100
102
|
success = True
|
|
@@ -126,7 +128,8 @@ def cli_download_and_extract(link: str, target_dir: str, log_dir: str, checkout_
|
|
|
126
128
|
success_git, msg, oss_name, oss_version = download_git_clone(link, target_dir,
|
|
127
129
|
checkout_to,
|
|
128
130
|
tag, branch,
|
|
129
|
-
ssh_key, id, git_token
|
|
131
|
+
ssh_key, id, git_token,
|
|
132
|
+
called_cli)
|
|
130
133
|
link = change_ssh_link_to_https(link)
|
|
131
134
|
if (not is_rubygems) and (not success_git):
|
|
132
135
|
if os.path.isfile(target_dir):
|
|
@@ -204,28 +207,44 @@ def get_github_token(git_url):
|
|
|
204
207
|
return github_token
|
|
205
208
|
|
|
206
209
|
|
|
207
|
-
def download_git_repository(refs_to_checkout, git_url, target_dir, tag):
|
|
210
|
+
def download_git_repository(refs_to_checkout, git_url, target_dir, tag, called_cli=True):
|
|
208
211
|
success = False
|
|
209
212
|
oss_version = ""
|
|
210
213
|
|
|
211
214
|
logger.info(f"Download git url :{git_url}")
|
|
215
|
+
env = os.environ.copy()
|
|
216
|
+
if not called_cli:
|
|
217
|
+
env["GIT_TERMINAL_PROMPT"] = "0"
|
|
212
218
|
if refs_to_checkout:
|
|
213
219
|
try:
|
|
214
220
|
# gitPython uses the branch argument the same whether you check out to a branch or a tag.
|
|
215
|
-
Repo.clone_from(git_url, target_dir, branch=refs_to_checkout)
|
|
216
|
-
|
|
217
|
-
|
|
221
|
+
Repo.clone_from(git_url, target_dir, branch=refs_to_checkout, env=env)
|
|
222
|
+
if any(Path(target_dir).iterdir()):
|
|
223
|
+
success = True
|
|
224
|
+
oss_version = refs_to_checkout
|
|
225
|
+
logger.info(f"Files found in {target_dir} after clone.")
|
|
226
|
+
else:
|
|
227
|
+
logger.info(f"No files found in {target_dir} after clone.")
|
|
228
|
+
success = False
|
|
218
229
|
except GitCommandError as error:
|
|
219
|
-
logger.
|
|
230
|
+
logger.info(f"Git checkout error:{error}")
|
|
231
|
+
success = False
|
|
232
|
+
except Exception as e:
|
|
233
|
+
logger.info(f"Repo.clone_from error:{e}")
|
|
220
234
|
success = False
|
|
221
235
|
|
|
222
236
|
if not success:
|
|
223
|
-
Repo.clone_from(git_url, target_dir)
|
|
224
|
-
|
|
237
|
+
Repo.clone_from(git_url, target_dir, env=env)
|
|
238
|
+
if any(Path(target_dir).iterdir()):
|
|
239
|
+
success = True
|
|
240
|
+
else:
|
|
241
|
+
logger.info(f"No files found in {target_dir} after clone.")
|
|
242
|
+
success = False
|
|
225
243
|
return success, oss_version
|
|
226
244
|
|
|
227
245
|
|
|
228
|
-
def download_git_clone(git_url, target_dir, checkout_to="", tag="", branch="",
|
|
246
|
+
def download_git_clone(git_url, target_dir, checkout_to="", tag="", branch="",
|
|
247
|
+
ssh_key="", id="", git_token="", called_cli=True):
|
|
229
248
|
oss_name = get_github_ossname(git_url)
|
|
230
249
|
refs_to_checkout = decide_checkout(checkout_to, tag, branch)
|
|
231
250
|
msg = ""
|
|
@@ -249,17 +268,19 @@ def download_git_clone(git_url, target_dir, checkout_to="", tag="", branch="", s
|
|
|
249
268
|
logger.info(f"Download git with ssh_key:{git_url}")
|
|
250
269
|
git_ssh_cmd = f'ssh -i {ssh_key}'
|
|
251
270
|
with Git().custom_environment(GIT_SSH_COMMAND=git_ssh_cmd):
|
|
252
|
-
success, oss_version = download_git_repository(refs_to_checkout, git_url, target_dir, tag)
|
|
271
|
+
success, oss_version = download_git_repository(refs_to_checkout, git_url, target_dir, tag, called_cli)
|
|
253
272
|
else:
|
|
254
273
|
if id and git_token:
|
|
255
274
|
try:
|
|
256
275
|
m = re.match(r"^(ht|f)tp(s?)\:\/\/", git_url)
|
|
257
276
|
protocol = m.group()
|
|
258
277
|
if protocol:
|
|
259
|
-
|
|
278
|
+
encoded_git_token = urllib.parse.quote(git_token, safe='')
|
|
279
|
+
encoded_id = urllib.parse.quote(id, safe='')
|
|
280
|
+
git_url = git_url.replace(protocol, f"{protocol}{encoded_id}:{encoded_git_token}@")
|
|
260
281
|
except Exception as error:
|
|
261
282
|
logger.info(f"Failed to insert id, token to git url:{error}")
|
|
262
|
-
success, oss_version = download_git_repository(refs_to_checkout, git_url, target_dir, tag)
|
|
283
|
+
success, oss_version = download_git_repository(refs_to_checkout, git_url, target_dir, tag, called_cli)
|
|
263
284
|
|
|
264
285
|
logger.info(f"git checkout: {oss_version}")
|
|
265
286
|
refs_to_checkout = oss_version
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fosslight_util-2.1.15 → fosslight_util-2.1.17}/src/fosslight_util.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{fosslight_util-2.1.15 → fosslight_util-2.1.17}/src/fosslight_util.egg-info/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|