From 65d32db087e4c7aa4e4433109d0e040ef0435de7 Mon Sep 17 00:00:00 2001 From: psakiev Date: Thu, 25 Apr 2024 22:16:25 -0600 Subject: [PATCH] Preserve higher weight for CLI git ref versions Currently the concretizer fails if you reuse a git ref version that has already been installed but modify the spec at all. See #38484 for futher diagnosis The issue here is that since there is no established provenance for these versions the highest weight they are currently assigned is that of prior install. Re-use checks then fail because the weight of the version is identical to the solver. Ironically, these versions are given the highest weights possible when specified on the CLI for the first time. They should only appear in a DAG if they are an exact match or if the user specifies them at the CLI. Therefore it makes sense to preserve their higher ordering. Getting this right is critical to moving all branch based versions to a pinned git-ref in the future. --- lib/spack/spack/solver/asp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py index 2b86200a309..db9c2ec42e9 100644 --- a/lib/spack/spack/solver/asp.py +++ b/lib/spack/spack/solver/asp.py @@ -2000,7 +2000,7 @@ def define_ad_hoc_versions_from_specs( # best possible, so they're guaranteed to be used preferentially. version = s.versions.concrete - if version is None or any(v == version for v in self.possible_versions[s.name]): + if version is None or any((v == version and not isinstance(version, vn.GitVersion)) for v in self.possible_versions[s.name]): continue if require_checksum and not _is_checksummed_git_version(version):