Commit b52533eb authored by Andre Sailer's avatar Andre Sailer
Browse files

install_binary_tarfile: add retry loop for download

parent 0c635d40
Pipeline #3288930 passed with stage
in 7 minutes and 43 seconds
...@@ -36,19 +36,23 @@ def install_tarfile(urltarfile, prefix, lcgprefix, with_hash=True, with_link=Tru ...@@ -36,19 +36,23 @@ def install_tarfile(urltarfile, prefix, lcgprefix, with_hash=True, with_link=Tru
sys.exit(1) sys.exit(1)
print('==== Downloading and installing %s' % urltarfile) print('==== Downloading and installing %s' % urltarfile)
try: counter = 0
resp = urllib2.urlopen(urltarfile) success = False
tar = tarfile.open(fileobj=resp, mode='r|gz', errorlevel=1) while counter < 5 and not success:
dirname, version = os.path.split(tar.next().name) counter += 1
tar.extractall(path=prefix) try:
except urllib2.HTTPError as detail: resp = urllib2.urlopen(urltarfile)
print('Error downloading %s : %s' % (urltarfile, detail)) tar = tarfile.open(fileobj=resp, mode='r|gz', errorlevel=1)
sys.exit(1) dirname, version = os.path.split(tar.next().name)
except tarfile.ReadError as detail: tar.extractall(path=prefix)
print('Error untaring %s : %s' %(urltarfile, detail)) success = True
sys.exit(1) except urllib2.HTTPError as detail:
except: print('Error downloading %s : %s' % (urltarfile, detail))
print('Unexpected error:', sys.exc_info()[0]) except tarfile.ReadError as detail:
print('Error untaring %s : %s' %(urltarfile, detail))
except:
print('Unexpected error:', sys.exc_info()[0])
if not success:
sys.exit(1) sys.exit(1)
#---rename the version directory---------------------------------------------- #---rename the version directory----------------------------------------------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment