Merge pull request #253 from LLNL/bugfix/244-uninstall-errors
Bugfix/244 uninstall errors
This commit is contained in:
commit
df5dc1c9bb
@ -54,7 +54,9 @@ def extensions(parser, args):
|
|||||||
if not args.spec:
|
if not args.spec:
|
||||||
tty.die("extensions requires a package spec.")
|
tty.die("extensions requires a package spec.")
|
||||||
|
|
||||||
|
#
|
||||||
# Checks
|
# Checks
|
||||||
|
#
|
||||||
spec = spack.cmd.parse_specs(args.spec)
|
spec = spack.cmd.parse_specs(args.spec)
|
||||||
if len(spec) > 1:
|
if len(spec) > 1:
|
||||||
tty.die("Can only list extensions for one package.")
|
tty.die("Can only list extensions for one package.")
|
||||||
@ -70,7 +72,9 @@ def extensions(parser, args):
|
|||||||
if not args.mode:
|
if not args.mode:
|
||||||
args.mode = 'short'
|
args.mode = 'short'
|
||||||
|
|
||||||
|
#
|
||||||
# List package names of extensions
|
# List package names of extensions
|
||||||
|
#
|
||||||
extensions = spack.db.extensions_for(spec)
|
extensions = spack.db.extensions_for(spec)
|
||||||
if not extensions:
|
if not extensions:
|
||||||
tty.msg("%s has no extensions." % spec.cshort_spec)
|
tty.msg("%s has no extensions." % spec.cshort_spec)
|
||||||
@ -79,7 +83,9 @@ def extensions(parser, args):
|
|||||||
tty.msg("%d extensions:" % len(extensions))
|
tty.msg("%d extensions:" % len(extensions))
|
||||||
colify(ext.name for ext in extensions)
|
colify(ext.name for ext in extensions)
|
||||||
|
|
||||||
|
#
|
||||||
# List specs of installed extensions.
|
# List specs of installed extensions.
|
||||||
|
#
|
||||||
installed = [s.spec for s in spack.installed_db.installed_extensions_for(spec)]
|
installed = [s.spec for s in spack.installed_db.installed_extensions_for(spec)]
|
||||||
print
|
print
|
||||||
if not installed:
|
if not installed:
|
||||||
@ -88,7 +94,9 @@ def extensions(parser, args):
|
|||||||
tty.msg("%d installed:" % len(installed))
|
tty.msg("%d installed:" % len(installed))
|
||||||
spack.cmd.find.display_specs(installed, mode=args.mode)
|
spack.cmd.find.display_specs(installed, mode=args.mode)
|
||||||
|
|
||||||
|
#
|
||||||
# List specs of activated extensions.
|
# List specs of activated extensions.
|
||||||
|
#
|
||||||
activated = spack.install_layout.extension_map(spec)
|
activated = spack.install_layout.extension_map(spec)
|
||||||
print
|
print
|
||||||
if not activated:
|
if not activated:
|
||||||
|
@ -42,9 +42,9 @@ def setup_parser(subparser):
|
|||||||
help="Remove regardless of whether other packages depend on this one.")
|
help="Remove regardless of whether other packages depend on this one.")
|
||||||
subparser.add_argument(
|
subparser.add_argument(
|
||||||
'-a', '--all', action='store_true', dest='all',
|
'-a', '--all', action='store_true', dest='all',
|
||||||
help="USE CAREFULLY. Remove ALL installed packages that match each supplied spec. " +
|
help="USE CAREFULLY. Remove ALL installed packages that match each " +
|
||||||
"i.e., if you say uninstall libelf, ALL versions of libelf are uninstalled. " +
|
"supplied spec. i.e., if you say uninstall libelf, ALL versions of " +
|
||||||
"This is both useful and dangerous, like rm -r.")
|
"libelf are uninstalled. This is both useful and dangerous, like rm -r.")
|
||||||
subparser.add_argument(
|
subparser.add_argument(
|
||||||
'packages', nargs=argparse.REMAINDER, help="specs of packages to uninstall")
|
'packages', nargs=argparse.REMAINDER, help="specs of packages to uninstall")
|
||||||
|
|
||||||
@ -81,7 +81,8 @@ def uninstall(parser, args):
|
|||||||
pkgs.append(s.package)
|
pkgs.append(s.package)
|
||||||
|
|
||||||
except spack.packages.UnknownPackageError, e:
|
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)
|
spack.Package(s).do_uninstall(force=True)
|
||||||
|
|
||||||
# Sort packages to be uninstalled by the number of installed dependents
|
# Sort packages to be uninstalled by the number of installed dependents
|
||||||
|
@ -54,6 +54,7 @@
|
|||||||
from spack.version import Version
|
from spack.version import Version
|
||||||
from spack.spec import Spec
|
from spack.spec import Spec
|
||||||
from spack.error import SpackError
|
from spack.error import SpackError
|
||||||
|
from spack.packages import UnknownPackageError
|
||||||
|
|
||||||
# DB goes in this directory underneath the root
|
# DB goes in this directory underneath the root
|
||||||
_db_dirname = '.spack-db'
|
_db_dirname = '.spack-db'
|
||||||
|
@ -27,9 +27,7 @@
|
|||||||
|
|
||||||
|
|
||||||
def pre_uninstall(pkg):
|
def pre_uninstall(pkg):
|
||||||
# Need to do this b/c uninstall does not automatically do it.
|
assert(pkg.spec.concrete)
|
||||||
# TODO: store full graph info in stored .spec file.
|
|
||||||
pkg.spec.normalize()
|
|
||||||
|
|
||||||
if pkg.is_extension:
|
if pkg.is_extension:
|
||||||
if pkg.activated:
|
if pkg.activated:
|
||||||
|
@ -487,9 +487,15 @@ def extendee_spec(self):
|
|||||||
if name == dep.name:
|
if name == dep.name:
|
||||||
return dep
|
return dep
|
||||||
|
|
||||||
# Otherwise return the spec from the extends() directive
|
# if the spec is concrete already, then it extends something
|
||||||
spec, kwargs = self.extendees[name]
|
# that is an *optional* dependency, and the dep isn't there.
|
||||||
return spec
|
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
|
@property
|
||||||
@ -497,18 +503,28 @@ def extendee_args(self):
|
|||||||
"""Spec of the extendee of this package, or None if it is not an extension."""
|
"""Spec of the extendee of this package, or None if it is not an extension."""
|
||||||
if not self.extendees:
|
if not self.extendees:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
# TODO: allow multiple extendees.
|
||||||
name = next(iter(self.extendees))
|
name = next(iter(self.extendees))
|
||||||
return self.extendees[name][1]
|
return self.extendees[name][1]
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_extension(self):
|
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):
|
def extends(self, spec):
|
||||||
return (spec.name in self.extendees and
|
if not spec.name in self.extendees:
|
||||||
spec.satisfies(self.extendees[spec.name][0]))
|
return False
|
||||||
|
s = self.extendee_spec
|
||||||
|
return s and s.satisfies(spec)
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
Loading…
Reference in New Issue
Block a user