tools, icu: actually failover if there are multiple URLs
Building on #23269, if multiple ICU download URLs are present, try the next one in case of error. Part of the ICU 63.1 bump, but independent code-wise. https://github.com/nodejs/node/issues/23244 PR-URL: https://github.com/nodejs/node/pull/23715 Fixes: https://github.com/nodejs/node/issues/22344 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
This commit is contained in:
parent
5d80ae3acd
commit
d8f2d27261
@ -1287,8 +1287,8 @@ def configure_intl(o):
|
|||||||
if (md5 == gotmd5):
|
if (md5 == gotmd5):
|
||||||
return targetfile
|
return targetfile
|
||||||
else:
|
else:
|
||||||
error('Expected: %s *MISMATCH*' % md5)
|
warn('Expected: %s *MISMATCH*' % md5)
|
||||||
error('\n ** Corrupted ZIP? Delete %s to retry download.\n' % targetfile)
|
warn('\n ** Corrupted ZIP? Delete %s to retry download.\n' % targetfile)
|
||||||
return None
|
return None
|
||||||
icu_config = {
|
icu_config = {
|
||||||
'variables': {}
|
'variables': {}
|
||||||
@ -1432,11 +1432,12 @@ def configure_intl(o):
|
|||||||
# ICU source dir relative to tools/icu (for .gyp file)
|
# ICU source dir relative to tools/icu (for .gyp file)
|
||||||
o['variables']['icu_path'] = icu_full_path
|
o['variables']['icu_path'] = icu_full_path
|
||||||
if not os.path.isdir(icu_full_path):
|
if not os.path.isdir(icu_full_path):
|
||||||
warn('* ECMA-402 (Intl) support didn\'t find ICU in %s..' % icu_full_path)
|
|
||||||
# can we download (or find) a zipfile?
|
# can we download (or find) a zipfile?
|
||||||
localzip = icu_download(icu_full_path)
|
localzip = icu_download(icu_full_path)
|
||||||
if localzip:
|
if localzip:
|
||||||
nodedownload.unpack(localzip, icu_parent_path)
|
nodedownload.unpack(localzip, icu_parent_path)
|
||||||
|
else:
|
||||||
|
warn('* ECMA-402 (Intl) support didn\'t find ICU in %s..' % icu_full_path)
|
||||||
if not os.path.isdir(icu_full_path):
|
if not os.path.isdir(icu_full_path):
|
||||||
error('''Cannot build Intl without ICU in %s.
|
error('''Cannot build Intl without ICU in %s.
|
||||||
Fix, or disable with "--with-intl=none"''' % icu_full_path)
|
Fix, or disable with "--with-intl=none"''' % icu_full_path)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# Moved some utilities here from ../../configure
|
# Moved some utilities here from ../../configure
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import urllib
|
import urllib
|
||||||
import hashlib
|
import hashlib
|
||||||
import sys
|
import sys
|
||||||
@ -36,10 +37,13 @@ def retrievefile(url, targetfile):
|
|||||||
sys.stdout.write(' <%s>\nConnecting...\r' % url)
|
sys.stdout.write(' <%s>\nConnecting...\r' % url)
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
ConfigOpener().retrieve(url, targetfile, reporthook=reporthook)
|
ConfigOpener().retrieve(url, targetfile, reporthook=reporthook)
|
||||||
print '' # clear the line
|
print('') # clear the line
|
||||||
return targetfile
|
return targetfile
|
||||||
|
except IOError as err:
|
||||||
|
print(' ** IOError %s\n' % err)
|
||||||
|
return None
|
||||||
except:
|
except:
|
||||||
print ' ** Error occurred while downloading\n <%s>' % url
|
print(' ** Error occurred while downloading\n <%s>' % url)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def md5sum(targetfile):
|
def md5sum(targetfile):
|
||||||
@ -56,12 +60,12 @@ def unpack(packedfile, parent_path):
|
|||||||
"""Unpacks packedfile into parent_path. Assumes .zip. Returns parent_path"""
|
"""Unpacks packedfile into parent_path. Assumes .zip. Returns parent_path"""
|
||||||
if zipfile.is_zipfile(packedfile):
|
if zipfile.is_zipfile(packedfile):
|
||||||
with contextlib.closing(zipfile.ZipFile(packedfile, 'r')) as icuzip:
|
with contextlib.closing(zipfile.ZipFile(packedfile, 'r')) as icuzip:
|
||||||
print ' Extracting zipfile: %s' % packedfile
|
print(' Extracting zipfile: %s' % packedfile)
|
||||||
icuzip.extractall(parent_path)
|
icuzip.extractall(parent_path)
|
||||||
return parent_path
|
return parent_path
|
||||||
elif tarfile.is_tarfile(packedfile):
|
elif tarfile.is_tarfile(packedfile):
|
||||||
with contextlib.closing(tarfile.TarFile.open(packedfile, 'r')) as icuzip:
|
with contextlib.closing(tarfile.TarFile.open(packedfile, 'r')) as icuzip:
|
||||||
print ' Extracting tarfile: %s' % packedfile
|
print(' Extracting tarfile: %s' % packedfile)
|
||||||
icuzip.extractall(parent_path)
|
icuzip.extractall(parent_path)
|
||||||
return parent_path
|
return parent_path
|
||||||
else:
|
else:
|
||||||
@ -112,7 +116,7 @@ def parse(opt):
|
|||||||
theRet[anOpt] = True
|
theRet[anOpt] = True
|
||||||
else:
|
else:
|
||||||
# future proof: ignore unknown types
|
# future proof: ignore unknown types
|
||||||
print 'Warning: ignoring unknown --download= type "%s"' % anOpt
|
print('Warning: ignoring unknown --download= type "%s"' % anOpt)
|
||||||
# all done
|
# all done
|
||||||
return theRet
|
return theRet
|
||||||
|
|
||||||
@ -122,6 +126,6 @@ def candownload(auto_downloads, package):
|
|||||||
if auto_downloads[package]:
|
if auto_downloads[package]:
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
print """Warning: Not downloading package "%s". You could pass "--download=all"
|
print("""Warning: Not downloading package "%s". You could pass "--download=all"
|
||||||
(Windows: "download-all") to try auto-downloading it.""" % package
|
(Windows: "download-all") to try auto-downloading it.""" % package)
|
||||||
return False
|
return False
|
||||||
|
Loading…
x
Reference in New Issue
Block a user