Repository: spack/spack

Issue:
votca-csg doesn't concertize 
```
$ spack spec votca-csg
Input spec
--------------------------------
votca-csg

Concretized
--------------------------------
==> Error: An unsatisfiable version constraint has been detected for spec:

    votca-tools


while trying to concretize the partial spec:

    votca-csg@1.5.1%gcc@9.2.0 build_type=RelWithDebInfo arch=linux-gentoo2-ivybridge
        ^cmake@3.15.5%gcc@9.2.0~doc+ncurses+openssl+ownlibs~qt arch=linux-gentoo2-ivybridge
            ^ncurses
                ^pkgconfig
            ^openssl
                ^perl@5.14.0:
                    ^gdbm
                        ^readline
                ^zlib@1.2.11%gcc@9.2.0+optimize+pic+shared arch=linux-gentoo2-ivybridge
        ^gromacs@2019.4%gcc@9.2.0 build_type=RelWithDebInfo ~cuda~double~double_precision~mdrun_only~mpi+openmp~plumed+rdtscp+shared simd=auto arch=linux-gentoo2-ivybridge
            ^fftw@3.3.8%gcc@9.2.0+mpi~openmp~pfft_patches precision=double,float arch=linux-gentoo2-ivybridge
                ^mpi
        ^hdf5@1.10.5%gcc@9.2.0~cxx~debug~fortran~hl~mpi+pic+shared~szip~threadsafe arch=linux-gentoo2-ivybridge
        ^votca-tools


votca-csg requires votca-tools version , but spec asked for 
```

Remove all version before 1.5.1 helps:
```diff
diff --git a/var/spack/repos/builtin/packages/votca-csg/package.py b/var/spack/repos/builtin/packages/votca-csg/package.py
index feadf4081..5a2f47bf0 100644
--- a/var/spack/repos/builtin/packages/votca-csg/package.py
+++ b/var/spack/repos/builtin/packages/votca-csg/package.py
@@ -21,12 +21,9 @@ class VotcaCsg(CMakePackage):

     version('develop', branch='master')
     version('1.5.1', sha256='7fca1261bd267bf38d2edd26259730fed3126c0c3fd91fb81940dbe17bb568fd')
-    version('1.5', sha256='160387cdc51f87dd20ff2e2eed97086beee415d48f3c92f4199f6109068c8ff4')
-    version('1.4.1', sha256='41dccaecadd0165c011bec36a113629e27745a5a133d1a042efe4356acdb5450')
-    version('1.4', sha256='c13e7febd792de8c3d426203f089bd4d33b8067f9db5e8840e4579c88b61146e')

     depends_on("cmake@2.8:", type='build')
-    for v in ["1.4", "1.4.1", "1.5", "1.5.1", "develop"]:
+    for v in ["1.5.1", "develop"]:
         depends_on('votca-tools@%s' % v, when="@%s" % v)
     depends_on("gromacs~mpi@5.1:")
     depends_on("hdf5~mpi")
```



Discussion:
There appears to be some issue with including a `x.y` and an `x.y.z` version (e.g. `1.5` and `1.5.1`). For example removing `1.5` and `1.4` also works. I'm looking into why this is the case.
The concretizer is getting confused about the `1.5` and `1.5.1` `when` specs: if we specifically want `votca-csg@1.5` for example, then the `depends_on` for `votca-tools@1.5` and `votca-tools@1.5.1` are both satisfied because `1.5` is considered to satisfy those requests. We can get around this by replacing a constraint like:

```
depends_on(votca-tools, when=@1.5)
```

with

```
depends_on(votca-tools, when=@1.5:1.5.0)
```
I'm removing the "concretization" tag because IMO this is best fixed by adjusting the constraints in the `votca-csg` package. If you agree, would you be inclined to submit a PR updating those constraints?
> I'm removing the "concretization" tag because IMO this is best fixed by adjusting the constraints in the `votca-csg` package. If you agree, would you be inclined to submit a PR updating those constraints?

Sound ok to me, will do!

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/votca-csg/package.py b/var/spack/repos/builtin/packages/votca-csg/package.py
--- a/var/spack/repos/builtin/packages/votca-csg/package.py
+++ b/var/spack/repos/builtin/packages/votca-csg/package.py
@@ -27,6 +27,6 @@ class VotcaCsg(CMakePackage):
 
     depends_on("cmake@2.8:", type='build')
     for v in ["1.4", "1.4.1", "1.5", "1.5.1", "develop"]:
-        depends_on('votca-tools@%s' % v, when="@%s" % v)
+        depends_on('votca-tools@%s' % v, when="@%s:%s.0" % (v, v))
     depends_on("gromacs~mpi@5.1:")
     depends_on("hdf5~mpi")
diff --git a/var/spack/repos/builtin/packages/votca-ctp/package.py b/var/spack/repos/builtin/packages/votca-ctp/package.py
--- a/var/spack/repos/builtin/packages/votca-ctp/package.py
+++ b/var/spack/repos/builtin/packages/votca-ctp/package.py
@@ -25,6 +25,6 @@ class VotcaCtp(CMakePackage):
 
     depends_on("cmake@2.8:", type='build')
     for v in ["1.5", "1.5.1", "develop"]:
-        depends_on('votca-tools@%s' % v, when="@%s" % v)
-        depends_on('votca-csg@%s' % v, when="@%s" % v)
+        depends_on('votca-tools@%s' % v, when="@%s:%s.0" % (v, v))
+        depends_on('votca-csg@%s' % v, when="@%s:%s.0" % (v, v))
     depends_on("gsl")
diff --git a/var/spack/repos/builtin/packages/votca-xtp/package.py b/var/spack/repos/builtin/packages/votca-xtp/package.py
--- a/var/spack/repos/builtin/packages/votca-xtp/package.py
+++ b/var/spack/repos/builtin/packages/votca-xtp/package.py
@@ -26,8 +26,7 @@ class VotcaXtp(CMakePackage):
 
     depends_on("cmake@2.8:", type='build')
     for v in ["1.4.1", "1.5", "1.5.1", "develop"]:
-        depends_on('votca-tools@%s' % v, when="@%s" % v)
-        depends_on('votca-csg@%s' % v, when="@%s" % v)
-    depends_on("votca-ctp@develop", when='@develop')
+        depends_on('votca-tools@%s' % v, when="@%s:%s.0" % (v, v))
+        depends_on('votca-csg@%s' % v, when="@%s:%s.0" % (v, v))
     depends_on("libxc", when='@1.5:')
     depends_on("ceres-solver", when='@1.5:')


Test patch: