summaryrefslogtreecommitdiffstats
path: root/build/download
diff options
context:
space:
mode:
authorMilan Verespej <m.verespej@partner.samsung.com>2019-06-05 15:23:42 +0200
committerMilan Verešpej <m.verespej@partner.samsung.com>2019-06-05 13:44:50 +0000
commit301b83a48f3b613191ae555081ef37f12f448608 (patch)
treef94e08c78bf5bc37b794ffd4d7d1fc771db2e7b4 /build/download
parentd3cb6429d6d3cdcd625906e702140a51fc146847 (diff)
Add directory remove on failed cloning
While downloading git repositories there was no removing of created destination directory which could led to false detection of downloaded repository. This script adds directory remove in such case plus fixes some minor typos in logging and help strings. Issue-ID: OOM-1803 Change-Id: Iec672bc8248e7b2daee06717985e11f7e05aa5be Signed-off-by: Milan Verespej <m.verespej@partner.samsung.com>
Diffstat (limited to 'build/download')
-rwxr-xr-xbuild/download/git_repos.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/build/download/git_repos.py b/build/download/git_repos.py
index aff01b80..1d8c2979 100755
--- a/build/download/git_repos.py
+++ b/build/download/git_repos.py
@@ -21,6 +21,7 @@
import argparse
import subprocess
+import shutil
import logging
import sys
import os
@@ -63,18 +64,20 @@ def download(git_list, dst_dir, progress):
clone_repo(dst, *repo)
progress.update(progress.value + 1)
except subprocess.CalledProcessError as err:
+ if os.path.isdir(dst):
+ shutil.rmtree(dst)
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))
- raise RuntimeError('Download unsuccesfull')
+ raise RuntimeError('Download unsuccessful')
def run_cli():
parser = argparse.ArgumentParser(description='Download git repositories from list')
parser.add_argument('git_list', metavar='git-list',
- help='File with list of npm packages to download.')
+ help='File with list of git repos to download.')
parser.add_argument('--output-dir', '-o', default=os.getcwd(),
help='Download destination')