summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2015-12-18 22:24:35 -0800
committerTodd Gamblin <tgamblin@llnl.gov>2015-12-18 22:24:35 -0800
commit52e3364efa4fa18d392316371e7164bf3899a638 (patch)
tree23d4c01a678171ab8ff49f310b8946387b15bfd3 /lib
parentb7e926eef6a248ec6f67cf30bdb2ce7dea09b8a2 (diff)
downloadspack-52e3364efa4fa18d392316371e7164bf3899a638.tar.gz
spack-52e3364efa4fa18d392316371e7164bf3899a638.tar.bz2
spack-52e3364efa4fa18d392316371e7164bf3899a638.tar.xz
spack-52e3364efa4fa18d392316371e7164bf3899a638.zip
Fix #244: errors on uninstall
- Extension logic didn't take conditional deps into account. - Extension methods now check for whether the extnesion is in the extendee map AND whether the dependency is actually present in the spec yet.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/hooks/extensions.py4
-rw-r--r--lib/spack/spack/package.py28
2 files changed, 23 insertions, 9 deletions
diff --git a/lib/spack/spack/hooks/extensions.py b/lib/spack/spack/hooks/extensions.py
index b4847d697f..627184cabd 100644
--- a/lib/spack/spack/hooks/extensions.py
+++ b/lib/spack/spack/hooks/extensions.py
@@ -27,9 +27,7 @@ import spack
def pre_uninstall(pkg):
- # Need to do this b/c uninstall does not automatically do it.
- # TODO: store full graph info in stored .spec file.
- pkg.spec.normalize()
+ assert(pkg.spec.concrete)
if pkg.is_extension:
if pkg.activated:
diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py
index daba5cd352..4d75726e06 100644
--- a/lib/spack/spack/package.py
+++ b/lib/spack/spack/package.py
@@ -487,9 +487,15 @@ class Package(object):
if name == dep.name:
return dep
- # Otherwise return the spec from the extends() directive
- spec, kwargs = self.extendees[name]
- return spec
+ # if the spec is concrete already, then it extends something
+ # that is an *optional* dependency, and the dep isn't there.
+ if self.spec._concrete:
+ return None
+ else:
+ # If it's not concrete, then return the spec from the
+ # extends() directive since that is all we know so far.
+ spec, kwargs = self.extendees[name]
+ return spec
@property
@@ -497,18 +503,28 @@ class Package(object):
"""Spec of the extendee of this package, or None if it is not an extension."""
if not self.extendees:
return None
+
+ # TODO: allow multiple extendees.
name = next(iter(self.extendees))
return self.extendees[name][1]
@property
def is_extension(self):
- return len(self.extendees) > 0
+ # if it is concrete, it's only an extension if it actually
+ # dependes on the extendee.
+ if self.spec._concrete:
+ return self.extendee_spec is not None
+ else:
+ # If not, then it's an extension if it *could* be an extension
+ return bool(self.extendees)
def extends(self, spec):
- return (spec.name in self.extendees and
- spec.satisfies(self.extendees[spec.name][0]))
+ if not spec.name in self.extendees:
+ return False
+ s = self.extendee_spec
+ return s and s.satisfies(spec)
@property