summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralalazo <massimiliano.culpo@googlemail.com>2017-08-02 15:37:52 +0200
committerTodd Gamblin <tgamblin@llnl.gov>2018-02-13 02:18:28 -0800
commitc62b3eef559e9d47ee6fe5136a2edebca5111fad (patch)
tree14475ffcdcf11f96ce5795037e7b67ee50ef721b
parent4e48bae0962c6494f421198afb756498e9580b66 (diff)
downloadspack-c62b3eef559e9d47ee6fe5136a2edebca5111fad.tar.gz
spack-c62b3eef559e9d47ee6fe5136a2edebca5111fad.tar.bz2
spack-c62b3eef559e9d47ee6fe5136a2edebca5111fad.tar.xz
spack-c62b3eef559e9d47ee6fe5136a2edebca5111fad.zip
filter_compiler_path: added the possibility to narrow search path
Following a comment from Todd, the search path for the files listed in `filter_compiler_wrappers` can now be narrowed. Anyhow, the function implementation still makes use of `find`, the rationale being that we have already seen packages that install artifacts in e.g. architecture dependent folders. The possibility to have a relative search path might be a good compromise between the previous approach and the one suggested in the review. Also: 'ignore_absent' and 'backup' keyword arguments can be optionally forwarded to `filter_file`.
-rw-r--r--lib/spack/spack/mixins.py43
-rw-r--r--var/spack/repos/builtin/packages/hdf5/package.py2
-rw-r--r--var/spack/repos/builtin/packages/mpich/package.py4
-rw-r--r--var/spack/repos/builtin/packages/mvapich2/package.py4
-rw-r--r--var/spack/repos/builtin/packages/openmpi/package.py3
-rw-r--r--var/spack/repos/builtin/packages/r/package.py4
6 files changed, 45 insertions, 15 deletions
diff --git a/lib/spack/spack/mixins.py b/lib/spack/spack/mixins.py
index 82e6f8bdad..0a43e76961 100644
--- a/lib/spack/spack/mixins.py
+++ b/lib/spack/spack/mixins.py
@@ -143,24 +143,47 @@ def filter_compiler_wrappers(*files, **kwargs):
whatever compiler they were built with.
Args:
- *files: files to be filtered
- **kwargs: at present supports the keyword 'after' to specify after
- which phase the files should be filtered (defaults to 'install').
+ *files: files to be filtered relative to the search root (which is,
+ by default, the installation prefix)
+
+ **kwargs: allowed keyword arguments
+
+ after
+ specifies after which phase the files should be
+ filtered (defaults to 'install')
+
+ relative_root
+ path relative to prefix where to start searching for
+ the files to be filtered. If not set the install prefix
+ wil be used as the search root. **It is highly recommended
+ to set this, as searching from the installation prefix may
+ affect performance severely in some cases**.
+
+ ignore_absent, backup
+ these two keyword arguments, if present, will be forwarded
+ to ``filter_file`` (see its documentation for more information
+ on their behavior)
"""
after = kwargs.get('after', 'install')
+ relative_root = kwargs.get('relative_root', None)
+
+ filter_kwargs = {
+ 'ignore_absent': kwargs.get('ignore_absent', True),
+ 'backup': kwargs.get('backup', False),
+ 'string': True
+ }
def _filter_compiler_wrappers_impl(self):
+ # Compute the absolute path of the search root
+ root = os.path.join(
+ self.prefix, relative_root
+ ) if relative_root else self.prefix
+
# Compute the absolute path of the files to be filtered and
# remove links from the list.
- abs_files = llnl.util.filesystem.find(self.prefix, files)
+ abs_files = llnl.util.filesystem.find(root, files)
abs_files = [x for x in abs_files if not os.path.islink(x)]
- filter_kwargs = {
- 'ignore_absent': True,
- 'backup': False,
- 'string': True
- }
-
x = llnl.util.filesystem.FileFilter(*abs_files)
x.filter(os.environ['CC'], self.compiler.cc, **filter_kwargs)
diff --git a/var/spack/repos/builtin/packages/hdf5/package.py b/var/spack/repos/builtin/packages/hdf5/package.py
index 3c729412ab..0ead42d41b 100644
--- a/var/spack/repos/builtin/packages/hdf5/package.py
+++ b/var/spack/repos/builtin/packages/hdf5/package.py
@@ -97,7 +97,7 @@ class Hdf5(AutotoolsPackage):
patch('h5f90global-mult-obj-same-equivalence-same-common-block.patch',
when='@1.10.1%intel@18')
- filter_compiler_wrappers('h5cc', 'h5c++', 'h5fc')
+ filter_compiler_wrappers('h5cc', 'h5c++', 'h5fc', relative_root='bin')
def url_for_version(self, version):
url = "https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-{0}/hdf5-{1}/src/hdf5-{1}.tar.gz"
diff --git a/var/spack/repos/builtin/packages/mpich/package.py b/var/spack/repos/builtin/packages/mpich/package.py
index 69dd75e3e1..5573b71197 100644
--- a/var/spack/repos/builtin/packages/mpich/package.py
+++ b/var/spack/repos/builtin/packages/mpich/package.py
@@ -71,7 +71,9 @@ spack package at this time.''',
provides('mpi@:3.0', when='@3:')
provides('mpi@:1.3', when='@1:')
- filter_compiler_wrappers('mpicc', 'mpicxx', 'mpif77', 'mpif90')
+ filter_compiler_wrappers(
+ 'mpicc', 'mpicxx', 'mpif77', 'mpif90', 'mpifort', relative_root='bin'
+ )
# fix MPI_Barrier segmentation fault
# see https://lists.mpich.org/pipermail/discuss/2016-May/004764.html
diff --git a/var/spack/repos/builtin/packages/mvapich2/package.py b/var/spack/repos/builtin/packages/mvapich2/package.py
index 256418da9c..8dab2e9d6d 100644
--- a/var/spack/repos/builtin/packages/mvapich2/package.py
+++ b/var/spack/repos/builtin/packages/mvapich2/package.py
@@ -107,7 +107,9 @@ class Mvapich2(AutotoolsPackage):
depends_on('libpciaccess', when=(sys.platform != 'darwin'))
depends_on('cuda', when='+cuda')
- filter_compiler_wrappers('mpicc', 'mpicxx', 'mpif77', 'mpif90', 'mpifort')
+ filter_compiler_wrappers(
+ 'mpicc', 'mpicxx', 'mpif77', 'mpif90', 'mpifort', relative_root='bin'
+ )
def url_for_version(self, version):
base_url = "http://mvapich.cse.ohio-state.edu/download"
diff --git a/var/spack/repos/builtin/packages/openmpi/package.py b/var/spack/repos/builtin/packages/openmpi/package.py
index 343b69ea7e..889455aae0 100644
--- a/var/spack/repos/builtin/packages/openmpi/package.py
+++ b/var/spack/repos/builtin/packages/openmpi/package.py
@@ -228,7 +228,8 @@ class Openmpi(AutotoolsPackage):
'mpif90-vt-wrapper-data.txt',
'mpif90-wrapper-data.txt',
'mpif77-vt-wrapper-data.txt',
- 'mpif77-wrapper-data.txt'
+ 'mpif77-wrapper-data.txt',
+ relative_root=os.path.join('share', 'openmpi')
)
def url_for_version(self, version):
diff --git a/var/spack/repos/builtin/packages/r/package.py b/var/spack/repos/builtin/packages/r/package.py
index cb955579a3..4b5dd05c33 100644
--- a/var/spack/repos/builtin/packages/r/package.py
+++ b/var/spack/repos/builtin/packages/r/package.py
@@ -88,7 +88,9 @@ class R(AutotoolsPackage):
patch('zlib.patch', when='@:3.3.2')
- filter_compiler_wrappers('Makeconf')
+ filter_compiler_wrappers(
+ 'Makeconf', relative_root=os.path.join('rlib', 'R', 'etc')
+ )
@property
def etcdir(self):