Repository: spack/spack

Issue:
Installation issue: CP2K
CP2K leads to spec conflict for

```
spack install cp2k@7.1 +elpa
```

Issue is caused by code below,

```
    depends_on('elpa@2011.12:2017.11+openmp', when='+openmp+elpa@6.0:')
    depends_on('elpa@2018.05:+openmp', when='+openmp+elpa@7.0:')
    depends_on('elpa@2011.12:2016.13~openmp', when='~openmp+elpa@:5.999')
    depends_on('elpa@2011.12:2017.11~openmp', when='~openmp+elpa@6.0:')
    depends_on('elpa@2018.05:~openmp', when='~openmp+elpa@7.0:')
```

Issued may be fixed as follows,

```
    **depends_on('elpa@2011.12:2017.11+openmp', when='+openmp+elpa@6.0:6.999')**
    depends_on('elpa@2018.05:+openmp', when='+openmp+elpa@7.0:')
    depends_on('elpa@2011.12:2016.13~openmp', when='~openmp+elpa@:5.999')
    **depends_on('elpa@2011.12:2017.11~openmp', when='~openmp+elpa@6.0:6.999')**
    depends_on('elpa@2018.05:~openmp', when='~openmp+elpa@7.0:')
```



Discussion:
@dev-zero 
yes, will add to my next PR for updating CP2K

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/cp2k/package.py b/var/spack/repos/builtin/packages/cp2k/package.py
--- a/var/spack/repos/builtin/packages/cp2k/package.py
+++ b/var/spack/repos/builtin/packages/cp2k/package.py
@@ -30,7 +30,7 @@ class Cp2k(MakefilePackage, CudaPackage):
     version('master', branch='master', submodules="True")
 
     variant('mpi', default=True, description='Enable MPI support')
-    variant('openmp', default=False, description='Enable OpenMP support')
+    variant('openmp', default=True, description='Enable OpenMP support')
     variant('smm', default='libxsmm', values=('libxsmm', 'libsmm', 'blas'),
             description='Library for small matrix multiplications')
     variant('plumed', default=False, description='Enable PLUMED support')
@@ -103,10 +103,10 @@ class Cp2k(MakefilePackage, CudaPackage):
     depends_on('cosma+scalapack', when='+cosma')
     depends_on('cosma+cuda+scalapack', when='+cosma+cuda')
     depends_on('elpa@2011.12:2016.13+openmp', when='+openmp+elpa@:5.999')
-    depends_on('elpa@2011.12:2017.11+openmp', when='+openmp+elpa@6.0:')
+    depends_on('elpa@2011.12:2017.11+openmp', when='+openmp+elpa@6.0:6.999')
     depends_on('elpa@2018.05:+openmp', when='+openmp+elpa@7.0:')
     depends_on('elpa@2011.12:2016.13~openmp', when='~openmp+elpa@:5.999')
-    depends_on('elpa@2011.12:2017.11~openmp', when='~openmp+elpa@6.0:')
+    depends_on('elpa@2011.12:2017.11~openmp', when='~openmp+elpa@6.0:6.999')
     depends_on('elpa@2018.05:~openmp', when='~openmp+elpa@7.0:')
     depends_on('plumed+shared+mpi', when='+plumed+mpi')
     depends_on('plumed+shared~mpi', when='+plumed~mpi')
@@ -119,8 +119,10 @@ class Cp2k(MakefilePackage, CudaPackage):
     # only OpenMP should be consistenly used, all other common things
     # like ELPA, SCALAPACK are independent and Spack will ensure that
     # a consistent/compat. combination is pulled in to the dependency graph.
-    depends_on('sirius+fortran+vdwxc+shared+openmp', when='+sirius+openmp')
-    depends_on('sirius+fortran+vdwxc+shared~openmp', when='+sirius~openmp')
+    depends_on('sirius@:6.999+fortran+vdwxc+shared+openmp', when='@:7.999+sirius+openmp')
+    depends_on('sirius@:6.999+fortran+vdwxc+shared~openmp', when='@:7.999+sirius~openmp')
+
+    depends_on('sirius@7:+fortran+vdwxc+shared+openmp', when='@8:+sirius+openmp')
 
     # the bundled libcusmm uses numpy in the parameter prediction (v7+)
     # which is written using Python 3
@@ -152,6 +154,8 @@ class Cp2k(MakefilePackage, CudaPackage):
     # cp2k with option smm=blas on aarch64
     conflicts('smm=libxsmm',  when='target=aarch64:', msg='libxsmm is not available on arm')
 
+    conflicts('~openmp', when='@8:', msg='Building without OpenMP is not supported in CP2K 8+')
+
     @property
     def makefile_architecture(self):
         return '{0.architecture}-{0.compiler.name}'.format(self.spec)
@@ -432,7 +436,7 @@ def edit(self, spec, prefix):
         if spec.satisfies('+sirius'):
             sirius = spec['sirius']
             cppflags.append('-D__SIRIUS')
-            fcflags += ['-I{0}'.format(os.path.join(sirius.prefix, 'fortran'))]
+            fcflags += ['-I{0}'.format(sirius.prefix.include.sirius)]
             libs += list(sirius.libs)
 
         if spec.satisfies('+cuda'):
diff --git a/var/spack/repos/builtin/packages/sirius/package.py b/var/spack/repos/builtin/packages/sirius/package.py
--- a/var/spack/repos/builtin/packages/sirius/package.py
+++ b/var/spack/repos/builtin/packages/sirius/package.py
@@ -21,7 +21,9 @@ class Sirius(CMakePackage, CudaPackage):
     version('develop', branch='develop')
     version('master', branch='master')
 
-    version('6.5.6', sha256='c8120100bde4477545eae489ea7f9140d264a3f88696ec92728616d78f214cae')
+    version('7.0.0', sha256='da783df11e7b65668e29ba8d55c8a6827e2216ad6d88040f84f42ac20fd1bb99')
+    version('6.5.6', sha256='c8120100bde4477545eae489ea7f9140d264a3f88696ec92728616d78f214cae',
+            preferred=True)
     version('6.5.5', sha256='0b23d3a8512682eea67aec57271031c65f465b61853a165015b38f7477651dd1')
     version('6.5.4', sha256='5f731926b882a567d117afa5e0ed33291f1db887fce52f371ba51f014209b85d')
     version('6.5.3', sha256='eae0c303f332425a8c792d4455dca62557931b28a5df8b4c242652d5ffddd580')
diff --git a/var/spack/repos/builtin/packages/spfft/package.py b/var/spack/repos/builtin/packages/spfft/package.py
--- a/var/spack/repos/builtin/packages/spfft/package.py
+++ b/var/spack/repos/builtin/packages/spfft/package.py
@@ -34,6 +34,7 @@ class Spfft(CMakePackage, CudaPackage):
             values=('Debug', 'Release', 'RelWithDebInfo'))
     depends_on('fftw-api@3')
     depends_on('mpi', when='+mpi')
+    depends_on('cmake@3.11:', type='build')
 
     # ROCM variants + dependencies
     variant('rocm', default=False, description="Use ROCm backend")


Test patch: