summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorscheibelp <scheibel1@llnl.gov>2016-10-18 22:34:46 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2016-10-18 22:34:46 -0700
commit8111a4bb9d7a308338e29e861e4c2c5ec6335f90 (patch)
treeaa20e6a0a30b6a856b1f300a495919e2a879c7cc /lib
parent0a3cc5e8e3a3206c527470f62ed4457681075e52 (diff)
downloadspack-8111a4bb9d7a308338e29e861e4c2c5ec6335f90.tar.gz
spack-8111a4bb9d7a308338e29e861e4c2c5ec6335f90.tar.bz2
spack-8111a4bb9d7a308338e29e861e4c2c5ec6335f90.tar.xz
spack-8111a4bb9d7a308338e29e861e4c2c5ec6335f90.zip
Don't cache truncated dag hash for spec (#2048)
If Spec.dag_hash was called for the first time with a 'length' specified, the cached hash was truncated. This ensures that the full hash is cached.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/spec.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
index 37a3cf4d7e..6950025502 100644
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -974,10 +974,10 @@ class Spec(object):
yaml_text = syaml.dump(
self.to_node_dict(), default_flow_style=True, width=maxint)
sha = hashlib.sha1(yaml_text)
- b32_hash = base64.b32encode(sha.digest()).lower()[:length]
+ b32_hash = base64.b32encode(sha.digest()).lower()
if self.concrete:
self._hash = b32_hash
- return b32_hash
+ return b32_hash[:length]
def dag_hash_bit_prefix(self, bits):
"""Get the first <bits> bits of the DAG hash as an integer type."""