diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2022-04-15 01:32:13 -0700 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2022-05-13 10:45:12 -0700 |
commit | 6db215dd890d02afb26c2a946d976a52c01209f4 (patch) | |
tree | bd13cff7606d3656ebdd794ff15456da107cb867 /lib | |
parent | 72b38851eb132b0358d91cd341ee23a522ddfd93 (diff) | |
download | spack-6db215dd890d02afb26c2a946d976a52c01209f4.tar.gz spack-6db215dd890d02afb26c2a946d976a52c01209f4.tar.bz2 spack-6db215dd890d02afb26c2a946d976a52c01209f4.tar.xz spack-6db215dd890d02afb26c2a946d976a52c01209f4.zip |
spec: fix serialization, avoid double call to node_dict_with_hashes
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/spec.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index 3d3e23e253..e0a417cb76 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -2029,10 +2029,12 @@ class Spec(object): node_list = [] # Using a list to preserve preorder traversal for hash. hash_set = set() for s in self.traverse(order='pre', deptype=hash.deptype): - spec_hash = s.node_dict_with_hashes(hash)[hash.name] + spec_hash = s._cached_hash(hash) + if spec_hash not in hash_set: node_list.append(s.node_dict_with_hashes(hash)) hash_set.add(spec_hash) + if s.build_spec is not s: build_spec_list = s.build_spec.to_dict(hash)['spec']['nodes'] for node in build_spec_list: @@ -2040,6 +2042,7 @@ class Spec(object): if node_hash not in hash_set: node_list.append(node) hash_set.add(node_hash) + meta_dict = syaml.syaml_dict([('version', specfile_format_version)]) inner_dict = syaml.syaml_dict([('_meta', meta_dict), ('nodes', node_list)]) spec_dict = syaml.syaml_dict([('spec', inner_dict)]) |