Cannot filter external specs using `reuse:from`
alalazo opened this issue · comments
Massimiliano Culpo commented
Steps to reproduce
Originally reported by @pranav-sivaraman on Slack.
The following environment fails to concretize:
spack:
specs:
- flap
view: true
concretizer:
unify: true
reuse:
from:
- type: external
include:
- "cmake"
packages:
cmake:
externals:
- spec: cmake@3.20.4
prefix: /usr
Error message
With the environment above active:
$ spack solve
==> Error: Spack concretizer internal error. Please submit a bug report and include the command, environment if applicable and the following error message.
flap is unsatisfiable
Information on your system
- Spack: 0.22.0.dev0 (05c1e7e)
- Python: 3.11.5
- Platform: linux-ubuntu20.04-icelake
- Concretizer: clingo
The error is due to a logical merge conflict between the reuse PR and the libc
PR. libc
providers are not implicitly included in the reuse filter, but they are implicitly added to the external configuration.
General information
- I have run
spack debug report
and reported the version of Spack/Python/Platform - I have searched the issues of this repo and believe this is not a duplicate
- I have run the failing commands in debug mode and reported the output
Massimiliano Culpo commented
This diff fixes the issue, and makes the external selected by default even if deprecated:
diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py
index 0d84c53970..3c8f385a29 100644
--- a/lib/spack/spack/solver/asp.py
+++ b/lib/spack/spack/solver/asp.py
@@ -1649,11 +1649,13 @@ def external_packages(self):
if isinstance(reuse_yaml, typing.Mapping):
default_include = reuse_yaml.get("include", [])
default_exclude = reuse_yaml.get("exclude", [])
+ libc_externals = list(all_libcs())
for source in reuse_yaml.get("from", []):
if source["type"] != "external":
continue
- include = source.get("include", default_include)
+ # Since libcs are implicit externals, we need to implicitly include them
+ include = source.get("include", default_include) + libc_externals
exclude = source.get("exclude", default_exclude)
spec_filters.append(
SpecFilter(
diff --git a/lib/spack/spack/solver/concretize.lp b/lib/spack/spack/solver/concretize.lp
index 85cc697a2d..60165338c6 100644
--- a/lib/spack/spack/solver/concretize.lp
+++ b/lib/spack/spack/solver/concretize.lp
@@ -1424,6 +1424,7 @@ opt_criterion(73, "deprecated versions used").
#minimize{
1@73+Priority,PackageNode
: attr("deprecated", PackageNode, _),
+ not external(PackageNode),
build_priority(PackageNode, Priority)
}.