Skip to content
Snippets Groups Projects
Commit f1c5e64c authored by Todd Gamblin's avatar Todd Gamblin
Browse files

Partial fix for SPACK-48.

- Try to accommodate packages that have grown dependencies better.
- This will only get fully fixed when optional dependencies are supported
  and some extra functionality is added to the spec syntax.
parent 2f900686
Branches
Tags
No related merge requests found
......@@ -72,13 +72,12 @@ def uninstall(parser, args):
for s in matching_specs:
try:
# should work if package is known to spack
pkgs.append(spack.db.get(s))
pkgs.append(s.package)
except spack.packages.UnknownPackageError, e:
# 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
# This ensures we do things in the right order
def num_installed_deps(pkg):
......
......@@ -157,19 +157,24 @@ def read_spec(self, path):
# Specs from files are assumed normal and concrete
spec = Spec(spec_file.read().replace('\n', ''))
# If we do not have a package on hand for this spec, we know
# it is concrete, and we *assume* that it is normal. This
# prevents us from trying to fetch a non-existing package, and
# allows best effort for commands like spack find.
if not spack.db.exists(spec.name):
spec._normal = True
spec._concrete = True
else:
spec.normalize()
if not spec.concrete:
tty.warn("Spec read from installed package is not concrete:",
path, spec)
if all(spack.db.exists(s.name) for s in spec.traverse()):
copy = spec.copy()
copy.normalize()
if copy.concrete:
return copy # These are specs spack still understands.
# If we get here, either the spec is no longer in spack, or
# something about its dependencies has changed. So we need to
# just assume the read spec is correct. We'll lose graph
# information if we do this, but this is just for best effort
# for commands like uninstall and find. Currently Spack
# doesn't do anything that needs the graph info after install.
# TODO: store specs with full connectivity information, so
# that we don't have to normalize or reconstruct based on
# changing dependencies in the Spack tree.
spec._normal = True
spec._concrete = True
return spec
......
......@@ -74,7 +74,8 @@ def get(self, spec, **kwargs):
if not spec in self.instances:
package_class = self.get_class_for_package_name(spec.name)
try:
self.instances[spec.copy()] = package_class(spec)
copy = spec.copy()
self.instances[copy] = package_class(copy)
except Exception, e:
raise FailedConstructorError(spec.name, e)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment