spec: remove hashes_final as it's no longer needed.

`hashes_final` was used to indicate when a spec was concrete but possibly lacked
`full_hash` or `build_hash` fields. This was only necessary because older Spacks
didn't generate them, and we want to avoid recomputing them, as we likely do not
have the same package files as existed at concretization time.

Now, we don't need to do that -- there is only the DAG hash and specs are either
concrete and have a `dag_hash`, or not concrete and have no `dag_hash`. There's
no middle ground.
This commit is contained in:
Todd Gamblin 2022-03-21 00:21:48 -07:00
parent 0dd373846f
commit d20cc7b124

View File

@ -1209,14 +1209,6 @@ def __init__(self, spec_like=None, normal=False,
self.external_path = external_path
self.external_modules = Spec._format_module_list(external_modules)
# Older spack versions may have either computed different hashes or
# computed them differently, and we may not have the necessary
# information to recompute them if we read in old specs.
# Old concrete specs are marked "final" when read in to indicate
# that we shouldn't recompute the current dag_hash. New specs are
# not final; we can lazily compute their hashes.
self._hashes_final = False
# This attribute is used to store custom information for
# external specs. None signal that it was not set yet.
self.extra_attributes = None
@ -2064,21 +2056,7 @@ def node_dict_with_hashes(self, hash=ht.dag_hash):
# to be included. This is effectively the last chance we get to compute
# it accurately.
if self.concrete:
# dag_hash can be written out if:
# 1. it's precomputed (i.e. we read it from somewhere
# and it was already on the spec)
# 2. we can still compute it lazily (i.e. we just made the spec and
# have the full dependency graph on-hand)
#
# we want to avoid recomputing the dag_hash for specs we read
# in from the DB or elsewhere, as we may not have the info
# (like patches, package versions, etc.) that we need to
# compute it. Unknown hashes are better than wrong hashes.
write_dag_hash = (
self._hashes_final and self._hash or # cached and final
not self._hashes_final) # lazily compute
if write_dag_hash:
node[ht.dag_hash.name] = self.dag_hash()
node[ht.dag_hash.name] = self.dag_hash()
else:
node['concrete'] = False
@ -2166,11 +2144,6 @@ def from_node_dict(node):
# specs read in are concrete unless marked abstract
spec._concrete = node.get('concrete', True)
# this spec may have been built with older packages than we have
# on-hand, and we may not have the build dependencies, so mark it
# so we don't recompute dag_hash.
spec._hashes_final = spec._concrete
if 'patches' in node:
patches = node['patches']
if len(patches) > 0:
@ -3768,7 +3741,6 @@ def _dup(self, other, deps=True, cleardeps=True):
self._dup_deps(other, deptypes)
self._concrete = other._concrete
self._hashes_final = other._hashes_final
if self._concrete:
self._hash = other._hash