Repository: spack/spack

Issue:
Environment expects invalid deplist to be a list of strings, gets a list of Spec objects.
### Steps to reproduce

I don't have a reproducer for you, but it's pretty clear from the exception and code what has gone wrong.  This happens when using a Spack 'Stack' matrix that ends up pairing invalid dependencies with packages.

### Error message

```
  File "/tmp/pflarr/new_spack/linux-rhel7-x86_64_v3-omnipath-none/spack/lib/spack/spack/environment/environment.py", line 2110, in _concretize_from_constraints
    return s.concretized(tests=tests)
  File "/tmp/pflarr/new_spack/linux-rhel7-x86_64_v3-omnipath-none/spack/lib/spack/spack/spec.py", line 2947, in concretized
    clone.concretize(tests=tests)
  File "/tmp/pflarr/new_spack/linux-rhel7-x86_64_v3-omnipath-none/spack/lib/spack/spack/spec.py", line 2909, in concretize
    self._new_concretize(tests)
  File "/tmp/pflarr/new_spack/linux-rhel7-x86_64_v3-omnipath-none/spack/lib/spack/spack/spec.py", line 2882, in _new_concretize
    result = solver.solve([self], tests=tests)
  File "/tmp/pflarr/new_spack/linux-rhel7-x86_64_v3-omnipath-none/spack/lib/spack/spack/solver/asp.py", line 2171, in solve
    setup_only=setup_only,
  File "/tmp/pflarr/new_spack/linux-rhel7-x86_64_v3-omnipath-none/spack/lib/spack/spack/solver/asp.py", line 568, in solve
    setup.setup(self, specs)
  File "/tmp/pflarr/new_spack/linux-rhel7-x86_64_v3-omnipath-none/spack/lib/spack/spack/solver/asp.py", line 1755, in setup
    raise spack.spec.InvalidDependencyError(spec.name, missing_deps)
spack.spec.InvalidDependencyError: Package paraview does not depend on cubelib%gcc

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/tmp/pflarr/new_spack/linux-rhel7-x86_64_v3-omnipath-none/spack/lib/spack/spack/util/parallel.py", line 53, in __call__
    value = self.func(*args, **kwargs)
  File "/tmp/pflarr/new_spack/linux-rhel7-x86_64_v3-omnipath-none/spack/lib/spack/spack/environment/environment.py", line 2132, in _concretize_task
    return _concretize_from_constraints(spec_constraints, tests)
  File "/tmp/pflarr/new_spack/linux-rhel7-x86_64_v3-omnipath-none/spack/lib/spack/spack/environment/environment.py", line 2112, in _concretize_from_constraints
    invalid_deps_string = ['^' + d for d in e.invalid_deps]
  File "/tmp/pflarr/new_spack/linux-rhel7-x86_64_v3-omnipath-none/spack/lib/spack/spack/environment/environment.py", line 2112, in <listcomp>
    invalid_deps_string = ['^' + d for d in e.invalid_deps]
TypeError: must be str, not Spec
```

### Information on your system

This is the lastest Spack develop branch.

### General information

- [X] I have run `spack debug report` and reported the version of Spack/Python/Platform
- [X] I have searched the issues of this repo and believe this is not a duplicate
- [X] I have run the failing commands in debug mode and reported the output


Discussion:

Resolving patch:
diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py
--- a/lib/spack/spack/solver/asp.py
+++ b/lib/spack/spack/solver/asp.py
@@ -1749,7 +1749,7 @@ def setup(self, driver, specs):
 
         # Fail if we already know an unreachable node is requested
         for spec in specs:
-            missing_deps = [d for d in spec.traverse()
+            missing_deps = [str(d) for d in spec.traverse()
                             if d.name not in possible and not d.virtual]
             if missing_deps:
                 raise spack.spec.InvalidDependencyError(spec.name, missing_deps)


Test patch:
diff --git a/lib/spack/spack/test/cmd/env.py b/lib/spack/spack/test/cmd/env.py
--- a/lib/spack/spack/test/cmd/env.py
+++ b/lib/spack/spack/test/cmd/env.py
@@ -1546,8 +1546,10 @@ def test_stack_yaml_force_remove_from_matrix(tmpdir):
 def test_stack_concretize_extraneous_deps(tmpdir, config, mock_packages):
     # FIXME: The new concretizer doesn't handle yet soft
     # FIXME: constraints for stacks
-    if spack.config.get('config:concretizer') == 'clingo':
-        pytest.skip('Clingo concretizer does not support soft constraints')
+    # FIXME: This now works for statically-determinable invalid deps
+    # FIXME: But it still does not work for dynamically determined invalid deps
+    # if spack.config.get('config:concretizer') == 'clingo':
+    #    pytest.skip('Clingo concretizer does not support soft constraints')
 
     filename = str(tmpdir.join('spack.yaml'))
     with open(filename, 'w') as f: