summaryrefslogtreecommitdiffstats
path: root/project.py
diff options
context:
space:
mode:
Diffstat (limited to 'project.py')
-rw-r--r--project.py26
1 files changed, 17 insertions, 9 deletions
diff --git a/project.py b/project.py
index bfe4a340..e0e9b7fe 100644
--- a/project.py
+++ b/project.py
@@ -1487,9 +1487,9 @@ class Project(object):
1487 else: 1487 else:
1488 alt_dir = None 1488 alt_dir = None
1489 1489
1490 if clone_bundle \ 1490 if (clone_bundle
1491 and alt_dir is None \ 1491 and alt_dir is None
1492 and self._ApplyCloneBundle(initial=is_new, quiet=quiet): 1492 and self._ApplyCloneBundle(initial=is_new, quiet=quiet, verbose=verbose)):
1493 is_new = False 1493 is_new = False
1494 1494
1495 if not current_branch_only: 1495 if not current_branch_only:
@@ -2415,7 +2415,7 @@ class Project(object):
2415 2415
2416 return ok 2416 return ok
2417 2417
2418 def _ApplyCloneBundle(self, initial=False, quiet=False): 2418 def _ApplyCloneBundle(self, initial=False, quiet=False, verbose=False):
2419 if initial and \ 2419 if initial and \
2420 (self.manifest.manifestProject.config.GetString('repo.depth') or 2420 (self.manifest.manifestProject.config.GetString('repo.depth') or
2421 self.clone_depth): 2421 self.clone_depth):
@@ -2439,7 +2439,8 @@ class Project(object):
2439 return False 2439 return False
2440 2440
2441 if not exist_dst: 2441 if not exist_dst:
2442 exist_dst = self._FetchBundle(bundle_url, bundle_tmp, bundle_dst, quiet) 2442 exist_dst = self._FetchBundle(bundle_url, bundle_tmp, bundle_dst, quiet,
2443 verbose)
2443 if not exist_dst: 2444 if not exist_dst:
2444 return False 2445 return False
2445 2446
@@ -2460,13 +2461,13 @@ class Project(object):
2460 platform_utils.remove(bundle_tmp) 2461 platform_utils.remove(bundle_tmp)
2461 return ok 2462 return ok
2462 2463
2463 def _FetchBundle(self, srcUrl, tmpPath, dstPath, quiet): 2464 def _FetchBundle(self, srcUrl, tmpPath, dstPath, quiet, verbose):
2464 if os.path.exists(dstPath): 2465 if os.path.exists(dstPath):
2465 platform_utils.remove(dstPath) 2466 platform_utils.remove(dstPath)
2466 2467
2467 cmd = ['curl', '--fail', '--output', tmpPath, '--netrc', '--location'] 2468 cmd = ['curl', '--fail', '--output', tmpPath, '--netrc', '--location']
2468 if quiet: 2469 if quiet:
2469 cmd += ['--silent'] 2470 cmd += ['--silent', '--show-error']
2470 if os.path.exists(tmpPath): 2471 if os.path.exists(tmpPath):
2471 size = os.stat(tmpPath).st_size 2472 size = os.stat(tmpPath).st_size
2472 if size >= 1024: 2473 if size >= 1024:
@@ -2488,12 +2489,17 @@ class Project(object):
2488 2489
2489 if IsTrace(): 2490 if IsTrace():
2490 Trace('%s', ' '.join(cmd)) 2491 Trace('%s', ' '.join(cmd))
2492 if verbose:
2493 print('%s: Downloading bundle: %s' % (self.name, srcUrl))
2494 stdout = None if verbose else subprocess.PIPE
2495 stderr = None if verbose else subprocess.STDOUT
2491 try: 2496 try:
2492 proc = subprocess.Popen(cmd) 2497 proc = subprocess.Popen(cmd, stdout=stdout, stderr=stderr)
2493 except OSError: 2498 except OSError:
2494 return False 2499 return False
2495 2500
2496 curlret = proc.wait() 2501 (output, _) = proc.communicate()
2502 curlret = proc.returncode
2497 2503
2498 if curlret == 22: 2504 if curlret == 22:
2499 # From curl man page: 2505 # From curl man page:
@@ -2504,6 +2510,8 @@ class Project(object):
2504 print("Server does not provide clone.bundle; ignoring.", 2510 print("Server does not provide clone.bundle; ignoring.",
2505 file=sys.stderr) 2511 file=sys.stderr)
2506 return False 2512 return False
2513 elif curlret and not verbose and output:
2514 print('%s' % output, file=sys.stderr)
2507 2515
2508 if os.path.exists(tmpPath): 2516 if os.path.exists(tmpPath):
2509 if curlret == 0 and self._IsValidBundle(tmpPath, quiet): 2517 if curlret == 0 and self._IsValidBundle(tmpPath, quiet):