diff --git a/lib/spack/spack/environment.py b/lib/spack/spack/environment.py index 5b526bbe11368d5cec31d25dd95799c8118b3f06..56440fbe92206589d6c4248228ce760dabee5c1e 100644 --- a/lib/spack/spack/environment.py +++ b/lib/spack/spack/environment.py @@ -511,10 +511,15 @@ def regenerate(self, all_specs, roots): specs = all_specs if self.link == 'all' else roots for spec in specs: # The view does not store build deps, so if we want it to - # recognize environment specs (which do store build deps), then - # they need to be stripped + # recognize environment specs (which do store build deps), + # then they need to be stripped. if spec.concrete: # Do not link unconcretized roots - specs_for_view.append(spec.copy(deps=('link', 'run'))) + # We preserve _hash _normal to avoid recomputing DAG + # hashes (DAG hashes don't consider build deps) + spec_copy = spec.copy(deps=('link', 'run')) + spec_copy._hash = spec._hash + spec_copy._normal = spec._normal + specs_for_view.append(spec_copy) # regeneration queries the database quite a bit; this read # transaction ensures that we don't repeatedly lock/unlock. diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index 86ac62e0d75eda08ad0ca979ab80c33def3d4cb2..c553da796dcb2a75240af623495de9e8bed9bd26 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -2999,7 +2999,7 @@ def _dup(self, other, deps=True, cleardeps=True, caches=None): before possibly copying the dependencies of ``other`` onto ``self`` caches (bool or None): preserve cached fields such as - ``_normal``, ``_concrete``, and ``_cmp_key_cache``. By + ``_normal``, ``_hash``, and ``_cmp_key_cache``. By default this is ``False`` if DAG structure would be changed by the copy, ``True`` if it's an exact copy.