Skip to content

Commit

Permalink
ASP-based solver: discard unknown packages from reuse
Browse files Browse the repository at this point in the history
This is an add-on to spack#28259 that cover for the case of
a single package.py being removed from a repository,
rather than an entire custom repository being removed.
  • Loading branch information
alalazo committed Apr 28, 2022
1 parent 8b85b33 commit 2ac8647
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/spack/spack/solver/asp.py
Original file line number Diff line number Diff line change
Expand Up @@ -1661,8 +1661,8 @@ def _facts_from_concrete_spec(self, spec, possible):
if spec.name in possible and h not in self.seen_hashes:
try:
# Only consider installed packages for repo we know
spack.repo.path.repo_for_pkg(spec)
except spack.repo.UnknownNamespaceError:
spack.repo.path.get(spec)
except (spack.repo.UnknownNamespaceError, spack.repo.UnknownPackageError):
return

# this indicates that there is a spec like this installed
Expand Down Expand Up @@ -2053,6 +2053,8 @@ def build_specs(self, function_tuples):
# namespace assignment is done after the fact, as it is not
# currently part of the solve
for spec in self._specs.values():
if spec.namespace:
continue
repo = spack.repo.path.repo_for_pkg(spec)
spec.namespace = repo.namespace

Expand All @@ -2062,7 +2064,7 @@ def build_specs(self, function_tuples):
# inject patches -- note that we' can't use set() to unique the
# roots here, because the specs aren't complete, and the hash
# function will loop forever.
roots = [spec.root for spec in self._specs.values()]
roots = [spec.root for spec in self._specs.values() if not spec.root.installed]
roots = dict((id(r), r) for r in roots)
for root in roots.values():
spack.spec.Spec.inject_patches_variant(root)
Expand Down

0 comments on commit 2ac8647

Please sign in to comment.