netcdf : fixed typo in configure option

openssl : smarter URL computation
This commit is contained in:
alalazo 2016-02-01 08:33:03 +01:00
parent cd54793913
commit 360abb070a
2 changed files with 27 additions and 4 deletions

View file

@ -1,5 +1,6 @@
from spack import *
class Netcdf(Package):
"""NetCDF is a set of software libraries and self-describing, machine-independent
data formats that support the creation, access, and sharing of array-oriented
@ -44,7 +45,7 @@ def install(self, spec, prefix):
]
if '+mpi' in spec:
config_args.append('--enable-parallel')
config_args.append('--enable-parallel4')
CPPFLAGS.append("-I%s/include" % spec['hdf5'].prefix)
LDFLAGS.append( "-L%s/lib" % spec['hdf5'].prefix)

View file

@ -1,3 +1,5 @@
import urllib
from spack import *
class Openssl(Package):
@ -9,9 +11,10 @@ class Openssl(Package):
homepage = "http://www.openssl.org"
url = "http://www.openssl.org/source/openssl-1.0.1h.tar.gz"
version('1.0.1h', '8d6d684a9430d5cc98a62a5d8fbda8cf') # Not available
version('1.0.2d', '38dd619b2e77cbac69b99f52a053d25a') # Not available
version('1.0.2e', '5262bfa25b60ed9de9f28d5d52d77fc5') # Not available
version('1.0.1h', '8d6d684a9430d5cc98a62a5d8fbda8cf')
version('1.0.1r', '1abd905e079542ccae948af37e393d28')
version('1.0.2d', '38dd619b2e77cbac69b99f52a053d25a')
version('1.0.2e', '5262bfa25b60ed9de9f28d5d52d77fc5')
version('1.0.2f', 'b3bf73f507172be9292ea2a8c28b659d')
depends_on("zlib")
@ -39,3 +42,22 @@ def install(self, spec, prefix):
make()
make("install")
def url_for_version(self, version):
# This URL is computed pinging the place where the latest version is stored. To avoid slowdown
# due to repeated pinging, we store the URL in a private attribute
openssl_url = getattr(self, '_openssl_url', None)
if openssl_url is None:
latest = 'http://www.openssl.org/source/openssl-{version}.tar.gz'
older = 'http://www.openssl.org/source/old/{version_number}/openssl-{version_full}.tar.gz'
# Try to use the url where the latest tarballs are stored. If the url does not exist (404), then
# return the url for older format
version_number = '.'.join([str(x) for x in version[:-1]])
older_url = older.format(version_number=version_number, version_full=version)
latest_url = latest.format(version=version)
response = urllib.urlopen(latest.format(version=version))
openssl_url = older_url if response.getcode() == 404 else latest_url
self._openssl_url = openssl_url
return openssl_url