Fixed database to account for hashes when reading install records

This commit is contained in:
Gregory Becker 2016-05-06 12:28:46 -07:00
parent 9f37e4c907
commit bc087cfefb
2 changed files with 12 additions and 1 deletions

View File

@ -203,6 +203,10 @@ def _read_spec_from_yaml(self, hash_key, installs, parent_key=None):
spec_dict = installs[hash_key]['spec']
# Install records don't include hash with spec, so we add it in here
# to ensure it is read properly.
spec_dict['hash'] = hash_key
# Build spec from dict first.
spec = Spec.from_node_dict(spec_dict)

View File

@ -755,7 +755,8 @@ def dag_hash(self, length=None):
"""
Return a hash of the entire spec DAG, including connectivity.
"""
if self.hash:
print self, "++"
if getattr(self, 'hash', None):
return self.hash
else:
yaml_text = yaml.dump(
@ -787,6 +788,7 @@ def to_node_dict(self):
else:
d['compiler'] = None
d.update(self.versions.to_dict())
return { self.name : d }
@ -810,6 +812,9 @@ def from_node_dict(node):
spec.versions = VersionList.from_dict(node)
spec.architecture = node['arch']
if 'hash' in node:
spec.hash = node['hash']
if node['compiler'] is None:
spec.compiler = None
else:
@ -2121,6 +2126,8 @@ def spec(self, name, check_valid_token = False):
if spec_name != '':
self.check_identifier(spec_name)
print spec_name, "++"
# This will init the spec without calling __init__.
spec = Spec.__new__(Spec)
spec.name = spec_name