Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: build/linux/sysroot_scripts/install-sysroot.py

Issue 1708743002: Add retry logic to install-sysroot.py (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/linux/sysroot_scripts/install-sysroot.py
diff --git a/build/linux/sysroot_scripts/install-sysroot.py b/build/linux/sysroot_scripts/install-sysroot.py
index dc492c6a56efb84de9ccef7f9acfb0c20025a13d..5e515a1731592f1c87bda89515cd331d881042be 100755
--- a/build/linux/sysroot_scripts/install-sysroot.py
+++ b/build/linux/sysroot_scripts/install-sysroot.py
@@ -135,7 +135,14 @@ def InstallDefaultSysroots():
InstallSysroot(target_arch)
-def main():
+def main(args):
+ parser = optparse.OptionParser('usage: %prog [OPTIONS]', description=__doc__)
+ parser.add_option('--running-as-hook', action='store_true',
+ default=False, help='Used when running from gclient hooks.'
+ ' Installs default sysroot images.')
+ parser.add_option('--arch', type='choice', choices=valid_archs,
+ help='Sysroot architecture: %s' % ', '.join(valid_archs))
+ options, _ = parser.parse_args(args)
if options.running_as_hook and not sys.platform.startswith('linux'):
return 0
@@ -196,7 +203,8 @@ def InstallSysroot(target_arch):
print 'Downloading %s' % url
sys.stdout.flush()
sys.stderr.flush()
- subprocess.check_call(['curl', '--fail', '-L', url, '-o', tarball])
+ subprocess.check_call(
+ ['curl', '--fail', '--retry', '3', '-L', url, '-o', tarball])
sha1sum = GetSha1(tarball)
if sha1sum != tarball_sha1sum:
raise Error('Tarball sha1sum is wrong.'
@@ -209,11 +217,8 @@ def InstallSysroot(target_arch):
if __name__ == '__main__':
- parser = optparse.OptionParser('usage: %prog [OPTIONS]', description=__doc__)
- parser.add_option('--running-as-hook', action='store_true',
- default=False, help='Used when running from gclient hooks.'
- ' Installs default sysroot images.')
- parser.add_option('--arch', type='choice', choices=valid_archs,
- help='Sysroot architecture: %s' % ', '.join(valid_archs))
- options, _ = parser.parse_args()
- sys.exit(main())
+ try:
+ sys.exit(main(sys.argv[1:]))
+ except Error as e:
+ sys.stderr.write(str(e) + '\n')
+ sys.exit(1)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698