From 8654197c56785e1a573a8e595c1ca213dfa8d191 Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Thu, 25 Aug 2022 17:55:58 +0200 Subject: [PATCH] ASP-based solver: prevent the use of hashes that are not available (#32354) fixes #32348 --- lib/spack/spack/solver/concretize.lp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/spack/spack/solver/concretize.lp b/lib/spack/spack/solver/concretize.lp index 48cb0f1d36..9884530306 100644 --- a/lib/spack/spack/solver/concretize.lp +++ b/lib/spack/spack/solver/concretize.lp @@ -1059,6 +1059,11 @@ no_flags(Package, FlagType) % you can't choose an installed hash for a dev spec :- hash(Package, Hash), variant_value(Package, "dev_path", _). +% You can't install a hash, if it is not installed +:- hash(Package, Hash), not installed_hash(Package, Hash). +% This should be redundant given the constraint above +:- hash(Package, Hash1), hash(Package, Hash2), Hash1 != Hash2. + % if a hash is selected, we impose all the constraints that implies impose(Hash) :- hash(Package, Hash).