summaryrefslogtreecommitdiffstats
path: root/build/download/git_repos.py
diff options
context:
space:
mode:
authorMilan Verespej <m.verespej@partner.samsung.com>2019-05-23 14:21:19 +0200
committerMilan Verespej <m.verespej@partner.samsung.com>2019-06-04 15:46:42 +0200
commit455be472dfdd4b3c9d2e1cc3c4962115760383f4 (patch)
tree076dc7f5d741d3685c6269f8ac6a5b0f92a2c53b /build/download/git_repos.py
parentdf7d7cc1294c6ea1fcab2ed4ac2ee7c375b29651 (diff)
Add base download script
This script is supposed to be used for convenience when downloading data from multiple lists at once. Issue-ID: OOM-1803 Change-Id: I4031ed3650f7880883e299b43c79e6bfd08c886c Signed-off-by: Milan Verespej <m.verespej@partner.samsung.com>
Diffstat (limited to 'build/download/git_repos.py')
-rwxr-xr-xbuild/download/git_repos.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/build/download/git_repos.py b/build/download/git_repos.py
index e388e94c..aff01b80 100755
--- a/build/download/git_repos.py
+++ b/build/download/git_repos.py
@@ -45,10 +45,9 @@ def download(git_list, dst_dir, progress):
if not base.check_tool('git'):
log.error('ERROR: git is not installed')
progress.finish(dirty=True)
- return 1
+ raise RuntimeError('git missing')
- git_set = {tuple(item.split()) for item in base.load_list(git_list)
- if not item.startswith('#')}
+ git_set = {tuple(item.split()) for item in base.load_list(git_list)}
error_count = 0
@@ -64,14 +63,13 @@ def download(git_list, dst_dir, progress):
clone_repo(dst, *repo)
progress.update(progress.value + 1)
except subprocess.CalledProcessError as err:
- log.error(err.output.decode())
+ log.exception(err.output.decode())
error_count += 1
base.finish_progress(progress, error_count, log)
if error_count > 0:
log.error('{} were not downloaded. Check logs for details'.format(error_count))
- return error_count
-
+ raise RuntimeError('Download unsuccesfull')
def run_cli():
parser = argparse.ArgumentParser(description='Download git repositories from list')
@@ -85,8 +83,11 @@ def run_cli():
logging.basicConfig(stream=sys.stdout, level=logging.INFO, format='%(message)s')
progress = base.init_progress('git repositories')
-
- sys.exit(download(args.git_list, args.output_dir, progress))
+ try:
+ download(args.git_list, args.output_dir, progress)
+ except RuntimeError as err:
+ log.exception(err)
+ sys.exit(1)
if __name__ == '__main__':