Rework concretizer rules still not passing
This commit is contained in:
parent
f61001d94d
commit
b5456c0fa7
@ -1012,7 +1012,7 @@ def needs_commit(cls, version) -> bool:
|
|||||||
|
|
||||||
ver_attrs = cls.versions.get(version)
|
ver_attrs = cls.versions.get(version)
|
||||||
if ver_attrs:
|
if ver_attrs:
|
||||||
return bool(ver_attrs.get("tag") or ver_attrs.get("branch"))
|
return bool(ver_attrs.get("commit") or ver_attrs.get("tag") or ver_attrs.get("branch"))
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -1596,9 +1596,11 @@ def key_fn(version):
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
if pkg.needs_commit(declared_version.version):
|
|
||||||
commit = pkg.version_or_package_attr("commit", declared_version.version, "")
|
for v in self.possible_versions[pkg.name]:
|
||||||
self.git_commit_versions[pkg.name][declared_version.version] = commit
|
if pkg.needs_commit(v):
|
||||||
|
commit = pkg.version_or_package_attr("commit", v, "")
|
||||||
|
self.git_commit_versions[pkg.name][v] = commit
|
||||||
|
|
||||||
# Declare deprecated versions for this package, if any
|
# Declare deprecated versions for this package, if any
|
||||||
deprecated = self.deprecated_versions[pkg.name]
|
deprecated = self.deprecated_versions[pkg.name]
|
||||||
@ -2908,10 +2910,11 @@ def define_version_constraints(self):
|
|||||||
for v in versions:
|
for v in versions:
|
||||||
if v in self.git_commit_versions[pkg_name]:
|
if v in self.git_commit_versions[pkg_name]:
|
||||||
sha = self.git_commit_versions[pkg_name].get(v)
|
sha = self.git_commit_versions[pkg_name].get(v)
|
||||||
self.gen.fact(fn.pkg_fact(pkg_name, fn.version_needs_commit(v)))
|
|
||||||
if sha:
|
if sha:
|
||||||
self.gen.fact(fn.pkg_fact(pkg_name, fn.version_has_commit(v, sha)))
|
self.gen.fact(fn.pkg_fact(pkg_name, fn.version_has_commit(v, sha)))
|
||||||
self.gen.newline()
|
else:
|
||||||
|
self.gen.fact(fn.pkg_fact(pkg_name, fn.version_needs_commit(v)))
|
||||||
|
self.gen.newline()
|
||||||
|
|
||||||
for pkg_name, versions in sorted(self.version_constraints):
|
for pkg_name, versions in sorted(self.version_constraints):
|
||||||
# generate facts for each package constraint and the version
|
# generate facts for each package constraint and the version
|
||||||
@ -3109,8 +3112,18 @@ def setup(
|
|||||||
commit = spec.variants.get("commit")
|
commit = spec.variants.get("commit")
|
||||||
version = spec.versions.concrete_range_as_version
|
version = spec.versions.concrete_range_as_version
|
||||||
if not version and commit:
|
if not version and commit:
|
||||||
version = max(spack.repo.PATH.get_pkg_class(spec.fullname).versions.keys())
|
# look for a matching commit in versions otherwise default to max infinity version
|
||||||
spec.versions = spack.version.VersionList([version])
|
versions = spack.repo.PATH.get_pkg_class(spec.fullname).versions
|
||||||
|
match = None
|
||||||
|
for v, data in versions.items():
|
||||||
|
if data.get("commit") == commit.value[0]:
|
||||||
|
match = v
|
||||||
|
break
|
||||||
|
if match:
|
||||||
|
spec.versions = spack.version.VersionList([match])
|
||||||
|
else:
|
||||||
|
version = max(versions.keys())
|
||||||
|
spec.versions = spack.version.VersionList([version])
|
||||||
|
|
||||||
|
|
||||||
self.gen = ProblemInstanceBuilder()
|
self.gen = ProblemInstanceBuilder()
|
||||||
|
@ -333,20 +333,26 @@ attr("node_version_satisfies", node(ID, Package), Constraint)
|
|||||||
:- attr("version", node(ID, Package), Version),
|
:- attr("version", node(ID, Package), Version),
|
||||||
pkg_fact(Package, version_satisfies(Constraint, Version)).
|
pkg_fact(Package, version_satisfies(Constraint, Version)).
|
||||||
|
|
||||||
|
% if a version needs a commit or has one it can use the commit variant
|
||||||
|
can_accept_commit(Package, Version) :- pkg_fact(Package, version_needs_commit(Version)).
|
||||||
|
can_accept_commit(Package, Version) :- pkg_fact(Package, version_has_commit(Version, _)).
|
||||||
|
|
||||||
% Specs with a commit variant can't use versions that don't need commits
|
% Specs with a commit variant can't use versions that don't need commits
|
||||||
error(10, "Cannot use commit variant with '{0}@{1}'", Package, Version)
|
error(10, "Cannot use commit variant with '{0}@={1}'", Package, Version)
|
||||||
:- attr("version", node(ID, Package), Version),
|
:- attr("version", node(ID, Package), Version),
|
||||||
not pkg_fact(Package, version_needs_commit(Version)),
|
not can_accept_commit(Package, Version),
|
||||||
attr("variant_value", node(ID, Package), "commit", _).
|
attr("variant_value", node(ID, Package), "commit", _).
|
||||||
|
|
||||||
% Versions with commits require a matching commit variant
|
error(10, "Commit '{0}' must match package.py value '{1}' for '{2}@={3}'", Vsha, Psha, Package, Version)
|
||||||
:- attr("version", node(ID, Packate), Version),
|
:- attr("version", node(ID, Package), Version),
|
||||||
pkg_fact(Package, version_has_commit(Version, Sha)),
|
attr("variant_value", node(ID, Package), "commit", Vsha),
|
||||||
not attr("variant_value", node(ID, Package), "commit", Sha).
|
pkg_fact(Package, version_has_commit(Version, Psha)),
|
||||||
|
Vsha != Psha.
|
||||||
|
|
||||||
#defined version_satisfies/3.
|
#defined version_satisfies/3.
|
||||||
#defined deprecated_versions_not_allowed/0.
|
#defined deprecated_versions_not_allowed/0.
|
||||||
#defined deprecated_version/2.
|
#defined deprecated_version/2.
|
||||||
|
#defined can_accept_commit/2.
|
||||||
|
|
||||||
%-----------------------------------------------------------------------------
|
%-----------------------------------------------------------------------------
|
||||||
% Spec conditions and imposed constraints
|
% Spec conditions and imposed constraints
|
||||||
|
@ -2673,7 +2673,7 @@ def name_and_dependency_types(s: str) -> Tuple[str, dt.DepFlag]:
|
|||||||
return name, depflag
|
return name, depflag
|
||||||
|
|
||||||
def spec_and_dependency_types(
|
def spec_and_dependency_types(
|
||||||
s: Union[Spec, Tuple[Spec, str]],
|
s: Union[Spec, Tuple[Spec, str]]
|
||||||
) -> Tuple[Spec, dt.DepFlag]:
|
) -> Tuple[Spec, dt.DepFlag]:
|
||||||
"""Given a non-string key in the literal, extracts the spec
|
"""Given a non-string key in the literal, extracts the spec
|
||||||
and its dependency types.
|
and its dependency types.
|
||||||
|
Loading…
Reference in New Issue
Block a user