Merge branch 'bugfix/openssl' into features/env_objects_flying_around

This commit is contained in:
alalazo 2016-03-18 11:08:55 +01:00
commit 82ba0c6c07

View File

@ -1,4 +1,4 @@
import urllib import urllib2
import llnl.util.tty as tty import llnl.util.tty as tty
from spack import * from spack import *
@ -37,17 +37,22 @@ def url_for_version(self, version):
version_number = '.'.join([str(x) for x in version[:-1]]) version_number = '.'.join([str(x) for x in version[:-1]])
older_url = older.format(version_number=version_number, version_full=version) older_url = older.format(version_number=version_number, version_full=version)
latest_url = latest.format(version=version) latest_url = latest.format(version=version)
response = urllib.urlopen(latest.format(version=version)) try:
if response.getcode() == 404: response = urllib2.urlopen(latest.format(version=version), timeout=5)
openssl_url = older_url if response.getcode() == 404:
# Checks if we already warned the user for this particular version of OpenSSL. openssl_url = older_url
# If not we display a warning message and mark this version # Checks if we already warned the user for this particular version of OpenSSL.
if not warnings_given_to_user.get(version, False): # If not we display a warning message and mark this version
tty.warn('This installation depends on an old version of OpenSSL, which may have known security issues. ') if not warnings_given_to_user.get(version, False):
tty.warn('Consider updating to the latest version of this package.') tty.warn('This installation depends on an old version of OpenSSL, which may have known security issues. ')
tty.warn('More details at {homepage}'.format(homepage=Openssl.homepage)) tty.warn('Consider updating to the latest version of this package.')
warnings_given_to_user[version] = True tty.warn('More details at {homepage}'.format(homepage=Openssl.homepage))
else: warnings_given_to_user[version] = True
else:
openssl_url = latest_url
except urllib2.URLError:
tty.warn('Cannot connect to network to retrieve OpenSSL version. Using default url.')
warnings_given_to_user[version] = True
openssl_url = latest_url openssl_url = latest_url
# Store the computed URL # Store the computed URL
openssl_urls[version] = openssl_url openssl_urls[version] = openssl_url