Add new timeout fetch_option
This allows packages to override the global connect_timeout.
This commit is contained in:
parent
b7cfd05ef7
commit
f580b340f8
@ -329,12 +329,6 @@ def _fetch_from_url(self, url):
|
|||||||
url,
|
url,
|
||||||
]
|
]
|
||||||
|
|
||||||
connect_timeout = spack.config.get('config:connect_timeout')
|
|
||||||
|
|
||||||
if connect_timeout > 0:
|
|
||||||
# Timeout if can't establish a connection after n sec.
|
|
||||||
curl_args.extend(['--connect-timeout', str(connect_timeout)])
|
|
||||||
|
|
||||||
if not spack.config.get('config:verify_ssl'):
|
if not spack.config.get('config:verify_ssl'):
|
||||||
curl_args.append('-k')
|
curl_args.append('-k')
|
||||||
|
|
||||||
@ -343,6 +337,8 @@ def _fetch_from_url(self, url):
|
|||||||
else:
|
else:
|
||||||
curl_args.append('-sS') # just errors when not.
|
curl_args.append('-sS') # just errors when not.
|
||||||
|
|
||||||
|
connect_timeout = spack.config.get('config:connect_timeout')
|
||||||
|
|
||||||
if self.extra_options:
|
if self.extra_options:
|
||||||
cookie = self.extra_options.get('cookie')
|
cookie = self.extra_options.get('cookie')
|
||||||
if cookie:
|
if cookie:
|
||||||
@ -350,6 +346,14 @@ def _fetch_from_url(self, url):
|
|||||||
curl_args.append('-b') # specify cookie
|
curl_args.append('-b') # specify cookie
|
||||||
curl_args.append(cookie)
|
curl_args.append(cookie)
|
||||||
|
|
||||||
|
timeout = self.extra_options.get('timeout')
|
||||||
|
if timeout:
|
||||||
|
connect_timeout = max(connect_timeout, int(timeout))
|
||||||
|
|
||||||
|
if connect_timeout > 0:
|
||||||
|
# Timeout if can't establish a connection after n sec.
|
||||||
|
curl_args.extend(['--connect-timeout', str(connect_timeout)])
|
||||||
|
|
||||||
# Run curl but grab the mime type from the http headers
|
# Run curl but grab the mime type from the http headers
|
||||||
curl = self.curl
|
curl = self.curl
|
||||||
with working_dir(self.stage.path):
|
with working_dir(self.stage.path):
|
||||||
|
@ -16,9 +16,12 @@ class Bzip2(Package):
|
|||||||
homepage = "https://sourceware.org/bzip2/"
|
homepage = "https://sourceware.org/bzip2/"
|
||||||
url = "https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz"
|
url = "https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz"
|
||||||
|
|
||||||
version('1.0.8', sha256='ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269')
|
# The server is sometimes a bit slow to respond
|
||||||
version('1.0.7', sha256='e768a87c5b1a79511499beb41500bcc4caf203726fff46a6f5f9ad27fe08ab2b')
|
fetch_options = {'timeout': 60}
|
||||||
version('1.0.6', sha256='a2848f34fcd5d6cf47def00461fcb528a0484d8edef8208d6d2e2909dc61d9cd')
|
|
||||||
|
version('1.0.8', sha256='ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269', fetch_options=fetch_options)
|
||||||
|
version('1.0.7', sha256='e768a87c5b1a79511499beb41500bcc4caf203726fff46a6f5f9ad27fe08ab2b', fetch_options=fetch_options)
|
||||||
|
version('1.0.6', sha256='a2848f34fcd5d6cf47def00461fcb528a0484d8edef8208d6d2e2909dc61d9cd', fetch_options=fetch_options)
|
||||||
|
|
||||||
variant('shared', default=True, description='Enables the build of shared libraries.')
|
variant('shared', default=True, description='Enables the build of shared libraries.')
|
||||||
|
|
||||||
|
@ -13,8 +13,12 @@ class Libffi(AutotoolsPackage):
|
|||||||
run time."""
|
run time."""
|
||||||
homepage = "https://sourceware.org/libffi/"
|
homepage = "https://sourceware.org/libffi/"
|
||||||
|
|
||||||
|
# The server is sometimes a bit slow to respond
|
||||||
|
fetch_options = {'timeout': 60}
|
||||||
|
|
||||||
version('3.2.1', sha256='d06ebb8e1d9a22d19e38d63fdb83954253f39bedc5d46232a05645685722ca37',
|
version('3.2.1', sha256='d06ebb8e1d9a22d19e38d63fdb83954253f39bedc5d46232a05645685722ca37',
|
||||||
url="https://sourceware.org/pub/libffi/libffi-3.2.1.tar.gz")
|
url="https://sourceware.org/pub/libffi/libffi-3.2.1.tar.gz",
|
||||||
|
fetch_options=fetch_options)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def headers(self):
|
def headers(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user