Write tests and stub out core changes

This commit is contained in:
Philip Sakievich 2025-03-21 17:02:38 -06:00 committed by psakiev
parent 0dcc164346
commit eda744718e
2 changed files with 6 additions and 0 deletions

View File

@ -2688,6 +2688,8 @@ def define_package_versions_and_validate_preferences(
if pkg_name not in packages_yaml or "version" not in packages_yaml[pkg_name]: if pkg_name not in packages_yaml or "version" not in packages_yaml[pkg_name]:
continue continue
# TODO(psakiev) Need facts about versions
# - requires_commit (associated with tag or branch)
version_defs: List[GitOrStandardVersion] = [] version_defs: List[GitOrStandardVersion] = []
for vstr in packages_yaml[pkg_name]["version"]: for vstr in packages_yaml[pkg_name]["version"]:
@ -3114,6 +3116,7 @@ def setup(
specs = tuple(specs) # ensure compatible types to add specs = tuple(specs) # ensure compatible types to add
self.gen.h1("Reusable concrete specs") self.gen.h1("Reusable concrete specs")
#TODO(psakiev) need fact spec has commit
self.define_concrete_input_specs(specs, self.pkgs) self.define_concrete_input_specs(specs, self.pkgs)
if reuse: if reuse:
self.gen.fact(fn.optimize_for_reuse()) self.gen.fact(fn.optimize_for_reuse())
@ -4187,6 +4190,7 @@ def execute_explicit_splices(self):
def _specs_with_commits(spec): def _specs_with_commits(spec):
spec.package.resolve_binary_provenance() spec.package.resolve_binary_provenance()
# TODO(psakiev) assert commit is associated with ref
# method above is in charge of assigning the commit variant # method above is in charge of assigning the commit variant
has_commit_var = "commit" in spec.variants has_commit_var = "commit" in spec.variants

View File

@ -257,6 +257,8 @@ pkg_fact(Package, version_declared(Version)) :- pkg_fact(Package, version_declar
{ attr("version", node(ID, Package), Version) : pkg_fact(Package, version_declared(Version)) } { attr("version", node(ID, Package), Version) : pkg_fact(Package, version_declared(Version)) }
:- attr("node", node(ID, Package)). :- attr("node", node(ID, Package)).
% TODO(psakiev) need rule if spec has commit version must need commit
% A virtual package may or may not have a version, but never has more than one % A virtual package may or may not have a version, but never has more than one
error(100, "Cannot select a single version for virtual '{0}'", Virtual) error(100, "Cannot select a single version for virtual '{0}'", Virtual)
:- attr("virtual_node", node(ID, Virtual)), :- attr("virtual_node", node(ID, Virtual)),