From bc087cfefbfa4d11e726d61fea1b85e6bace9f77 Mon Sep 17 00:00:00 2001 From: Gregory Becker Date: Fri, 6 May 2016 12:28:46 -0700 Subject: Fixed database to account for hashes when reading install records --- lib/spack/spack/database.py | 4 ++++ lib/spack/spack/spec.py | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/spack/spack/database.py b/lib/spack/spack/database.py index 25f4f69a89..9b7c944bc9 100644 --- a/lib/spack/spack/database.py +++ b/lib/spack/spack/database.py @@ -203,6 +203,10 @@ class Database(object): 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) diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index b604420140..93befbec33 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -755,7 +755,8 @@ class Spec(object): """ 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 @@ class Spec(object): else: d['compiler'] = None d.update(self.versions.to_dict()) + return { self.name : d } @@ -810,6 +812,9 @@ class Spec(object): 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 @@ class SpecParser(spack.parse.Parser): 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 -- cgit v1.2.3-70-g09d2