First new unit test passes
This commit is contained in:
parent
5a2182af3f
commit
c0e4d2e3cf
@ -2901,14 +2901,17 @@ def virtual_providers(self):
|
|||||||
def define_version_constraints(self):
|
def define_version_constraints(self):
|
||||||
"""Define what version_satisfies(...) means in ASP logic."""
|
"""Define what version_satisfies(...) means in ASP logic."""
|
||||||
# TODO(psakiev)
|
# TODO(psakiev)
|
||||||
|
for pkg_name, versions in sorted(self.possible_versions.items()):
|
||||||
|
for v in versions:
|
||||||
|
if v in self.git_commit_versions[pkg_name]:
|
||||||
|
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
|
||||||
# that satisfies it
|
# that satisfies it
|
||||||
for v in sorted(v for v in self.possible_versions[pkg_name] if v.satisfies(versions)):
|
for v in sorted(v for v in self.possible_versions[pkg_name] if v.satisfies(versions)):
|
||||||
self.gen.fact(fn.pkg_fact(pkg_name, fn.version_satisfies(versions, v)))
|
self.gen.fact(fn.pkg_fact(pkg_name, fn.version_satisfies(versions, v)))
|
||||||
if v in self.git_commit_versions[pkg_name]:
|
|
||||||
self.gen.fact(fn.pkg_fact(pkg_name, fn.version_needs_commit(v)))
|
|
||||||
|
|
||||||
self.gen.newline()
|
self.gen.newline()
|
||||||
|
|
||||||
def collect_virtual_constraints(self):
|
def collect_virtual_constraints(self):
|
||||||
|
@ -336,6 +336,7 @@ attr("node_version_satisfies", node(ID, Package), Constraint)
|
|||||||
pkg_fact(Package, version_satisfies(Constraint, Version)).
|
pkg_fact(Package, version_satisfies(Constraint, 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)
|
||||||
:- attr("version", node(ID, Package), Version),
|
:- attr("version", node(ID, Package), Version),
|
||||||
not pkg_fact(Package, version_needs_commit(Version)),
|
not pkg_fact(Package, version_needs_commit(Version)),
|
||||||
attr("variant_value", node(ID, Package), "commit", _).
|
attr("variant_value", node(ID, Package), "commit", _).
|
||||||
|
@ -2730,11 +2730,12 @@ def test_correct_external_is_selected_from_packages_yaml(self, mutable_config):
|
|||||||
|
|
||||||
def test_phil_add_git_based_version_must_exist_to_use_ref(self):
|
def test_phil_add_git_based_version_must_exist_to_use_ref(self):
|
||||||
s = spack.concretize.concretize_one(f"git-ref-package commit={'a' * 40}")
|
s = spack.concretize.concretize_one(f"git-ref-package commit={'a' * 40}")
|
||||||
assert s.satisifes("@main")
|
assert s.satisfies("@main")
|
||||||
|
|
||||||
#gmake should fail, only has sha256
|
#gmake should fail, only has sha256
|
||||||
with pytest.raises(AssertionError):
|
with pytest.raises(spack.error.UnsatisfiableSpecError) as e:
|
||||||
s = spack.concretize.concretize_one(f"gmake={'a' * 40}")
|
s = spack.concretize.concretize_one(f"gmake commit={'a' * 40}")
|
||||||
|
assert "Cannot use commit variant with" in e.value.message
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.usefixtures("mutable_config", "mock_packages", "do_not_check_runtimes_on_reuse")
|
@pytest.mark.usefixtures("mutable_config", "mock_packages", "do_not_check_runtimes_on_reuse")
|
||||||
|
Loading…
Reference in New Issue
Block a user