summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2015-12-11 02:16:24 -0800
committerTodd Gamblin <tgamblin@llnl.gov>2015-12-11 02:17:17 -0800
commit7526a89463c6f4c61cd4ae725fc096e14fc063f3 (patch)
treedc5109a32cac0b4f0da25ab24b8368d1d1e1eba2
parent3163d016db3849c3c9e801c1cdb9e6e907afa313 (diff)
downloadspack-7526a89463c6f4c61cd4ae725fc096e14fc063f3.tar.gz
spack-7526a89463c6f4c61cd4ae725fc096e14fc063f3.tar.bz2
spack-7526a89463c6f4c61cd4ae725fc096e14fc063f3.tar.xz
spack-7526a89463c6f4c61cd4ae725fc096e14fc063f3.zip
Fix #217: Make package cache use DAG hash instead of sorted deps.
- Gets rid of last vestige of old-style specs. - Uses new hashing for lookup
-rw-r--r--lib/spack/spack/packages.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/spack/spack/packages.py b/lib/spack/spack/packages.py
index f6f4cbf025..9d87c3a94b 100644
--- a/lib/spack/spack/packages.py
+++ b/lib/spack/spack/packages.py
@@ -67,27 +67,28 @@ class PackageDB(object):
if spec.virtual:
raise UnknownPackageError(spec.name)
+ dhash = spec.dag_hash()
if kwargs.get('new', False):
- if spec in self.instances:
- del self.instances[spec]
+ if dhash in self.instances:
+ del self.instances[dhash]
- if not spec in self.instances:
+ if not dhash in self.instances:
package_class = self.get_class_for_package_name(spec.name)
try:
- copy = spec.copy()
- self.instances[copy] = package_class(copy)
+ copy = spec.copy() # defensive copy. Package owns its spec.
+ self.instances[dhash] = package_class(copy)
except Exception, e:
if spack.debug:
sys.excepthook(*sys.exc_info())
raise FailedConstructorError(spec.name, e)
- return self.instances[spec]
+ return self.instances[dhash]
@_autospec
def delete(self, spec):
"""Force a package to be recreated."""
- del self.instances[spec]
+ del self.instances[spec.dag_hash()]
def purge(self):