summaryrefslogtreecommitdiff
path: root/lib/spack/spack/spec.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/spack/spack/spec.py')
-rw-r--r--lib/spack/spack/spec.py30
1 files changed, 22 insertions, 8 deletions
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
index 1b5f41d4c4..5c082d90c8 100644
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -1782,15 +1782,24 @@ class Spec(object):
def concretize(self):
"""A spec is concrete if it describes one build of a package uniquely.
- This will ensure that this spec is concrete.
+ This will ensure that this spec is concrete.
- If this spec could describe more than one version, variant, or build
- of a package, this will add constraints to make it concrete.
+ If this spec could describe more than one version, variant, or build
+ of a package, this will add constraints to make it concrete.
- Some rigorous validation and checks are also performed on the spec.
- Concretizing ensures that it is self-consistent and that it's
- consistent with requirements of its pacakges. See flatten() and
- normalize() for more details on this.
+ Some rigorous validation and checks are also performed on the spec.
+ Concretizing ensures that it is self-consistent and that it's
+ consistent with requirements of its pacakges. See flatten() and
+ normalize() for more details on this.
+
+ It also ensures that:
+
+ .. code-block:: python
+
+ for x in self.traverse():
+ assert x.package.spec == x
+
+ which may not be true *during* the concretization step.
"""
if not self.name:
raise SpecError("Attempting to concretize anonymous spec")
@@ -1844,6 +1853,11 @@ class Spec(object):
if matches:
raise ConflictsInSpecError(self, matches)
+ # At this point the spec-package mutual references should
+ # be self-consistent
+ for x in self.traverse():
+ x.package.spec = x
+
def _mark_concrete(self, value=True):
"""Mark this spec and its dependencies as concrete.
@@ -2463,7 +2477,7 @@ class Spec(object):
def _dup(self, other, deps=True, cleardeps=True, caches=None):
"""Copy the spec other into self. This is an overwriting
- copy. It does not copy any dependents (parents), but by default
+ copy. It does not copy any dependents (parents), but by default
copies dependencies.
To duplicate an entire DAG, call _dup() on the root of the DAG.