summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGregory Lee <lee218@llnl.gov>2015-12-19 08:06:36 -0800
committerGregory Lee <lee218@llnl.gov>2015-12-19 08:06:36 -0800
commitdf5dc1c9bb29a56cc1cf6b4bce903b8d4f40b52e (patch)
treebd29d63205e63697cecb5f098894b7ba7810a302 /lib
parenta62f590653d1f69eb82ae65a53567f5415883a5b (diff)
parent52e3364efa4fa18d392316371e7164bf3899a638 (diff)
downloadspack-df5dc1c9bb29a56cc1cf6b4bce903b8d4f40b52e.tar.gz
spack-df5dc1c9bb29a56cc1cf6b4bce903b8d4f40b52e.tar.bz2
spack-df5dc1c9bb29a56cc1cf6b4bce903b8d4f40b52e.tar.xz
spack-df5dc1c9bb29a56cc1cf6b4bce903b8d4f40b52e.zip
Merge pull request #253 from LLNL/bugfix/244-uninstall-errors
Bugfix/244 uninstall errors
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/cmd/extensions.py8
-rw-r--r--lib/spack/spack/cmd/uninstall.py9
-rw-r--r--lib/spack/spack/database.py1
-rw-r--r--lib/spack/spack/hooks/extensions.py4
-rw-r--r--lib/spack/spack/package.py28
5 files changed, 37 insertions, 13 deletions
diff --git a/lib/spack/spack/cmd/extensions.py b/lib/spack/spack/cmd/extensions.py
index c2cf288877..2ce6f406ca 100644
--- a/lib/spack/spack/cmd/extensions.py
+++ b/lib/spack/spack/cmd/extensions.py
@@ -54,7 +54,9 @@ def extensions(parser, args):
if not args.spec:
tty.die("extensions requires a package spec.")
+ #
# Checks
+ #
spec = spack.cmd.parse_specs(args.spec)
if len(spec) > 1:
tty.die("Can only list extensions for one package.")
@@ -70,7 +72,9 @@ def extensions(parser, args):
if not args.mode:
args.mode = 'short'
+ #
# List package names of extensions
+ #
extensions = spack.db.extensions_for(spec)
if not extensions:
tty.msg("%s has no extensions." % spec.cshort_spec)
@@ -79,7 +83,9 @@ def extensions(parser, args):
tty.msg("%d extensions:" % len(extensions))
colify(ext.name for ext in extensions)
+ #
# List specs of installed extensions.
+ #
installed = [s.spec for s in spack.installed_db.installed_extensions_for(spec)]
print
if not installed:
@@ -88,7 +94,9 @@ def extensions(parser, args):
tty.msg("%d installed:" % len(installed))
spack.cmd.find.display_specs(installed, mode=args.mode)
+ #
# List specs of activated extensions.
+ #
activated = spack.install_layout.extension_map(spec)
print
if not activated:
diff --git a/lib/spack/spack/cmd/uninstall.py b/lib/spack/spack/cmd/uninstall.py
index 191d9d88e8..03873bb5f8 100644
--- a/lib/spack/spack/cmd/uninstall.py
+++ b/lib/spack/spack/cmd/uninstall.py
@@ -42,9 +42,9 @@ def setup_parser(subparser):
help="Remove regardless of whether other packages depend on this one.")
subparser.add_argument(
'-a', '--all', action='store_true', dest='all',
- help="USE CAREFULLY. Remove ALL installed packages that match each supplied spec. " +
- "i.e., if you say uninstall libelf, ALL versions of libelf are uninstalled. " +
- "This is both useful and dangerous, like rm -r.")
+ help="USE CAREFULLY. Remove ALL installed packages that match each " +
+ "supplied spec. i.e., if you say uninstall libelf, ALL versions of " +
+ "libelf are uninstalled. This is both useful and dangerous, like rm -r.")
subparser.add_argument(
'packages', nargs=argparse.REMAINDER, help="specs of packages to uninstall")
@@ -81,7 +81,8 @@ def uninstall(parser, args):
pkgs.append(s.package)
except spack.packages.UnknownPackageError, e:
- # The package.py file has gone away -- but still want to uninstall.
+ # The package.py file has gone away -- but still want to
+ # uninstall.
spack.Package(s).do_uninstall(force=True)
# Sort packages to be uninstalled by the number of installed dependents
diff --git a/lib/spack/spack/database.py b/lib/spack/spack/database.py
index bf54055a24..a6f1cc5077 100644
--- a/lib/spack/spack/database.py
+++ b/lib/spack/spack/database.py
@@ -54,6 +54,7 @@ import spack.spec
from spack.version import Version
from spack.spec import Spec
from spack.error import SpackError
+from spack.packages import UnknownPackageError
# DB goes in this directory underneath the root
_db_dirname = '.spack-db'
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