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): ...@@ -72,13 +72,12 @@ def uninstall(parser, args):
for s in matching_specs: for s in matching_specs:
try: try:
# should work if package is known to spack # should work if package is known to spack
pkgs.append(spack.db.get(s)) 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
# This ensures we do things in the right order # This ensures we do things in the right order
def num_installed_deps(pkg): def num_installed_deps(pkg):
......
...@@ -157,19 +157,24 @@ def read_spec(self, path): ...@@ -157,19 +157,24 @@ def read_spec(self, path):
# Specs from files are assumed normal and concrete # Specs from files are assumed normal and concrete
spec = Spec(spec_file.read().replace('\n', '')) spec = Spec(spec_file.read().replace('\n', ''))
# If we do not have a package on hand for this spec, we know if all(spack.db.exists(s.name) for s in spec.traverse()):
# it is concrete, and we *assume* that it is normal. This copy = spec.copy()
# prevents us from trying to fetch a non-existing package, and copy.normalize()
# allows best effort for commands like spack find. if copy.concrete:
if not spack.db.exists(spec.name): return copy # These are specs spack still understands.
spec._normal = True
spec._concrete = True # If we get here, either the spec is no longer in spack, or
else: # something about its dependencies has changed. So we need to
spec.normalize() # just assume the read spec is correct. We'll lose graph
if not spec.concrete: # information if we do this, but this is just for best effort
tty.warn("Spec read from installed package is not concrete:", # for commands like uninstall and find. Currently Spack
path, spec) # 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 return spec
......
...@@ -74,7 +74,8 @@ def get(self, spec, **kwargs): ...@@ -74,7 +74,8 @@ def get(self, spec, **kwargs):
if not spec in self.instances: if not spec in self.instances:
package_class = self.get_class_for_package_name(spec.name) package_class = self.get_class_for_package_name(spec.name)
try: try:
self.instances[spec.copy()] = package_class(spec) copy = spec.copy()
self.instances[copy] = package_class(copy)
except Exception, e: except Exception, e:
raise FailedConstructorError(spec.name, 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