From f85329e792a3a4c4dbafed27ab1331177b1ac9a5 Mon Sep 17 00:00:00 2001 From: Philip Sakievich Date: Thu, 3 Apr 2025 22:44:08 -0600 Subject: [PATCH] Ideas for facts that will close the loop --- lib/spack/spack/solver/asp.py | 5 ++++- lib/spack/spack/solver/concretize.lp | 4 ++++ lib/spack/spack/test/cmd/find.py | 2 +- lib/spack/spack/test/concretization/core.py | 6 +++--- lib/spack/spack/test/packages.py | 9 +++++++++ lib/spack/spack/test/versions.py | 2 +- 6 files changed, 22 insertions(+), 6 deletions(-) diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py index 25653c9f86b..bb7635f3b0a 100644 --- a/lib/spack/spack/solver/asp.py +++ b/lib/spack/spack/solver/asp.py @@ -3125,7 +3125,6 @@ def setup( version = max(versions.keys()) spec.versions = spack.version.VersionList([version]) - self.gen = ProblemInstanceBuilder() compiler_parser = CompilerParser(configuration=spack.config.CONFIG).with_input_specs(specs) @@ -3203,6 +3202,10 @@ def setup( allow_deprecated=allow_deprecated, require_checksum=checksummed ) + self.gen.h1("Infinity Versions") + for i, v in enumerate(spack.version.infinity_versions): + self.gen.fact(fn.infinity_version(v, i)) + self.gen.h1("Package Constraints") for pkg in sorted(self.pkgs): self.gen.h2("Package rules: %s" % pkg) diff --git a/lib/spack/spack/solver/concretize.lp b/lib/spack/spack/solver/concretize.lp index 70db459dd84..fde2274cf97 100644 --- a/lib/spack/spack/solver/concretize.lp +++ b/lib/spack/spack/solver/concretize.lp @@ -356,6 +356,10 @@ error(10, "Commit '{0}' must match package.py value '{1}' for '{2}@={3}'", Vsha, Vsha == Psha, VersionA != VersionB. +% rule that says if a spec has a commit choose the max version that can accept a commit + +% rule that says if a constraint is on a commit and a version matches that commit then the constraint is on the version + #defined version_satisfies/3. #defined deprecated_versions_not_allowed/0. #defined deprecated_version/2. diff --git a/lib/spack/spack/test/cmd/find.py b/lib/spack/spack/test/cmd/find.py index 7e1bc66aead..7ec7425ff30 100644 --- a/lib/spack/spack/test/cmd/find.py +++ b/lib/spack/spack/test/cmd/find.py @@ -617,7 +617,7 @@ def _nresults(_qresult): @pytest.mark.usefixtures("install_mockery", "mock_fetch", "mutable_mock_env_path") -def test_find_based_on_commit_sha(mock_git_version_info, monkeypatch): +def test_phil_find_based_on_commit_sha(mock_git_version_info, monkeypatch): repo_path, filename, commits = mock_git_version_info file_url = pathlib.Path(repo_path).as_uri() diff --git a/lib/spack/spack/test/concretization/core.py b/lib/spack/spack/test/concretization/core.py index dab7a332162..85cb14179a5 100644 --- a/lib/spack/spack/test/concretization/core.py +++ b/lib/spack/spack/test/concretization/core.py @@ -2729,13 +2729,13 @@ def test_correct_external_is_selected_from_packages_yaml(self, mutable_config): assert s.satisfies("%clang") assert s.prefix == "/tmp/prefix2" - def test_git_based_version_must_exist_to_use_ref(self): + def test_phil_git_based_version_must_exist_to_use_ref(self): # gmake should fail, only has sha256 with pytest.raises(spack.error.UnsatisfiableSpecError) as e: spack.concretize.concretize_one(f"gmake commit={'a' * 40}") assert "Cannot use commit variant with" in e.value.message - def test_commit_variant_in_absence_of_version_selects_max_infinity_version(self): + def test_phil_commit_variant_in_absence_of_version_selects_max_infinity_version(self): spec = spack.concretize.concretize_one(f"git-ref-package commit={'a' * 40}") assert spec.satisfies("@develop") @@ -3315,7 +3315,7 @@ def test_phil_spec_with_commit_interacts_with_lookup(mock_git_version_info, monk @pytest.mark.usefixtures("mutable_config", "mock_packages", "do_not_check_runtimes_on_reuse") @pytest.mark.parametrize("version_str", [f"git.{'a' * 40}=main", "git.2.1.5=main"]) -def test_relationship_git_versions_and_commit_variant(version_str): +def test_phil_relationship_git_versions_and_commit_variant(version_str): """ Confirm that GitVersions auto assign and poopulate the commit variant correctly """ diff --git a/lib/spack/spack/test/packages.py b/lib/spack/spack/test/packages.py index f90e977c818..70f23427f2f 100644 --- a/lib/spack/spack/test/packages.py +++ b/lib/spack/spack/test/packages.py @@ -348,6 +348,15 @@ def test_phil_package_condtional_variants_may_depend_on_commit(mock_packages, co assert conditional_variant assert conditional_variant.value +""" +Issues: +- version has commit Version("foo", commit=) +- version needs commit Version("master", branch=) +- cli default +- contraints/overridding current selection +- constraints/changing current selection +""" + def test_phil_commit_variant_finds_matches_for_commit_versions(mock_packages, config): """ diff --git a/lib/spack/spack/test/versions.py b/lib/spack/spack/test/versions.py index 8689763f5b9..4d94dda1f29 100644 --- a/lib/spack/spack/test/versions.py +++ b/lib/spack/spack/test/versions.py @@ -815,7 +815,7 @@ def test_version_list_with_range_and_concrete_version_is_not_concrete(): "git_ref, std_version", (("foo", "develop"), ("a" * 40, "develop"), ("a" * 40, None), ("v1.2.0", "1.2.0")), ) -def test_git_versions_store_ref_requests(git_ref, std_version): +def test_phil_git_versions_store_ref_requests(git_ref, std_version): """ User requested ref's should be known on creation Commit and standard version may not be known until concretization