summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2020-12-22 23:50:50 -0800
committerTamara Dahlgren <dahlgren1@llnl.gov>2021-02-17 17:07:35 -0800
commit9bb03754436df9ec07c87eec82f242355fc5a793 (patch)
tree61732fedd7ca9737a2b8e01fcfc0596d6f5b9421 /lib
parent56acb5a0c7e504f4262b05610d826821ca4dea52 (diff)
downloadspack-9bb03754436df9ec07c87eec82f242355fc5a793.tar.gz
spack-9bb03754436df9ec07c87eec82f242355fc5a793.tar.bz2
spack-9bb03754436df9ec07c87eec82f242355fc5a793.tar.xz
spack-9bb03754436df9ec07c87eec82f242355fc5a793.zip
concretizer: more detailed section headers in concretize.lp
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/solver/concretize.lp120
1 files changed, 69 insertions, 51 deletions
diff --git a/lib/spack/spack/solver/concretize.lp b/lib/spack/spack/solver/concretize.lp
index c92f198be7..dde167d806 100644
--- a/lib/spack/spack/solver/concretize.lp
+++ b/lib/spack/spack/solver/concretize.lp
@@ -54,45 +54,11 @@ depends_on(Package, Dependency, Type)
virtual(Virtual),
not external(Package).
-% Equivalencies of the form:
-%
-% name(Arg1, Arg2, ...) :- attr("name", Arg1, Arg2, ...).
-% attr("name", Arg1, Arg2, ...) :- name(Arg1, Arg2, ...).
+%-----------------------------------------------------------------------------
+% Conditional dependencies
%
-% These allow us to easily define conditional dependency and conflict rules
-% without enumerating all spec attributes every time.
-node(Package) :- attr("node", Package).
-version(Package, Version) :- attr("version", Package, Version).
-version_satisfies(Package, Constraint) :- attr("version_satisfies", Package, Constraint).
-node_platform(Package, Platform) :- attr("node_platform", Package, Platform).
-node_os(Package, OS) :- attr("node_os", Package, OS).
-node_target(Package, Target) :- attr("node_target", Package, Target).
-node_target_satisfies(Package, Target) :- attr("node_target_satisfies", Package, Target).
-variant_value(Package, Variant, Value) :- attr("variant_value", Package, Variant, Value).
-variant_set(Package, Variant, Value) :- attr("variant_set", Package, Variant, Value).
-node_flag(Package, FlagType, Flag) :- attr("node_flag", Package, FlagType, Flag).
-node_compiler(Package, Compiler) :- attr("node_compiler", Package, Compiler).
-node_compiler_version(Package, Compiler, Version)
- :- attr("node_compiler_version", Package, Compiler, Version).
-node_compiler_version_satisfies(Package, Compiler, Version)
- :- attr("node_compiler_version_satisfies", Package, Compiler, Version).
-
-attr("node", Package) :- node(Package).
-attr("version", Package, Version) :- version(Package, Version).
-attr("version_satisfies", Package, Constraint) :- version_satisfies(Package, Constraint).
-attr("node_platform", Package, Platform) :- node_platform(Package, Platform).
-attr("node_os", Package, OS) :- node_os(Package, OS).
-attr("node_target", Package, Target) :- node_target(Package, Target).
-attr("node_target_satisfies", Package, Target) :- node_target_satisfies(Package, Target).
-attr("variant_value", Package, Variant, Value) :- variant_value(Package, Variant, Value).
-attr("variant_set", Package, Variant, Value) :- variant_set(Package, Variant, Value).
-attr("node_flag", Package, FlagType, Flag) :- node_flag(Package, FlagType, Flag).
-attr("node_compiler", Package, Compiler) :- node_compiler(Package, Compiler).
-attr("node_compiler_version", Package, Compiler, Version)
- :- node_compiler_version(Package, Compiler, Version).
-attr("node_compiler_version_satisfies", Package, Compiler, Version)
- :- node_compiler_version_satisfies(Package, Compiler, Version).
-
+% This takes care of `when=SPEC` in `depends_on("foo@1.0+bar", when="SPEC")`.
+%-----------------------------------------------------------------------------
% if any individual condition below is true, trigger the dependency.
dependency_conditions(Package, Dependency, Type) :-
dependency_conditions_hold(ID, Package, Dependency),
@@ -119,19 +85,12 @@ dependency_conditions_hold(ID, Parent, Dependency) :-
#defined required_dependency_condition/4.
#defined required_dependency_condition/5.
-% general rules for conflicts
-:- not external(Package) : conflict_condition(ID, "node", Package);
- attr(Name, Arg1) : conflict_condition(ID, Name, Arg1);
- attr(Name, Arg1, Arg2) : conflict_condition(ID, Name, Arg1, Arg2);
- attr(Name, Arg1, Arg2, Arg3) : conflict_condition(ID, Name, Arg1, Arg2, Arg3);
- conflict(ID, Package).
-
-#defined conflict/2.
-#defined conflict_condition/3.
-#defined conflict_condition/4.
-#defined conflict_condition/5.
-
-% Implications from matching a dependency condition
+%-----------------------------------------------------------------------------
+% Imposed dependencies
+%
+% This handles the `@1.0+bar` in `depends_on("foo@1.0+bar", when="SPEC")`.
+%-----------------------------------------------------------------------------
+% this rule instantiates every non-root node in the DAG
node(Dependency) :-
dependency_conditions_hold(ID, Package, Dependency),
depends_on(Package, Dependency).
@@ -149,6 +108,23 @@ attr(Name, Arg1, Arg2, Arg3) :-
#defined imposed_dependency_condition/4.
#defined imposed_dependency_condition/5.
+%-----------------------------------------------------------------------------
+% Conflicts
+%-----------------------------------------------------------------------------
+:- not external(Package) : conflict_condition(ID, "node", Package);
+ attr(Name, Arg1) : conflict_condition(ID, Name, Arg1);
+ attr(Name, Arg1, Arg2) : conflict_condition(ID, Name, Arg1, Arg2);
+ attr(Name, Arg1, Arg2, Arg3) : conflict_condition(ID, Name, Arg1, Arg2, Arg3);
+ conflict(ID, Package).
+
+#defined conflict/2.
+#defined conflict_condition/3.
+#defined conflict_condition/4.
+#defined conflict_condition/5.
+
+%-----------------------------------------------------------------------------
+% Virtual dependencies
+%-----------------------------------------------------------------------------
% if a virtual was required by some package, one provider is in the DAG
1 { node(Package) : provides_virtual(Package, Virtual) } 1
:- virtual_node(Virtual).
@@ -219,6 +195,48 @@ path(Parent, Child) :- depends_on(Parent, Child).
path(Parent, Descendant) :- path(Parent, A), depends_on(A, Descendant).
:- path(A, B), path(B, A).
+%-----------------------------------------------------------------------------
+% Spec Attributes
+%-----------------------------------------------------------------------------
+% Equivalencies of the form:
+%
+% name(Arg1, Arg2, ...) :- attr("name", Arg1, Arg2, ...).
+% attr("name", Arg1, Arg2, ...) :- name(Arg1, Arg2, ...).
+%
+% These allow us to easily define conditional dependency and conflict rules
+% without enumerating all spec attributes every time.
+node(Package) :- attr("node", Package).
+version(Package, Version) :- attr("version", Package, Version).
+version_satisfies(Package, Constraint) :- attr("version_satisfies", Package, Constraint).
+node_platform(Package, Platform) :- attr("node_platform", Package, Platform).
+node_os(Package, OS) :- attr("node_os", Package, OS).
+node_target(Package, Target) :- attr("node_target", Package, Target).
+node_target_satisfies(Package, Target) :- attr("node_target_satisfies", Package, Target).
+variant_value(Package, Variant, Value) :- attr("variant_value", Package, Variant, Value).
+variant_set(Package, Variant, Value) :- attr("variant_set", Package, Variant, Value).
+node_flag(Package, FlagType, Flag) :- attr("node_flag", Package, FlagType, Flag).
+node_compiler(Package, Compiler) :- attr("node_compiler", Package, Compiler).
+node_compiler_version(Package, Compiler, Version)
+ :- attr("node_compiler_version", Package, Compiler, Version).
+node_compiler_version_satisfies(Package, Compiler, Version)
+ :- attr("node_compiler_version_satisfies", Package, Compiler, Version).
+
+attr("node", Package) :- node(Package).
+attr("version", Package, Version) :- version(Package, Version).
+attr("version_satisfies", Package, Constraint) :- version_satisfies(Package, Constraint).
+attr("node_platform", Package, Platform) :- node_platform(Package, Platform).
+attr("node_os", Package, OS) :- node_os(Package, OS).
+attr("node_target", Package, Target) :- node_target(Package, Target).
+attr("node_target_satisfies", Package, Target) :- node_target_satisfies(Package, Target).
+attr("variant_value", Package, Variant, Value) :- variant_value(Package, Variant, Value).
+attr("variant_set", Package, Variant, Value) :- variant_set(Package, Variant, Value).
+attr("node_flag", Package, FlagType, Flag) :- node_flag(Package, FlagType, Flag).
+attr("node_compiler", Package, Compiler) :- node_compiler(Package, Compiler).
+attr("node_compiler_version", Package, Compiler, Version)
+ :- node_compiler_version(Package, Compiler, Version).
+attr("node_compiler_version_satisfies", Package, Compiler, Version)
+ :- node_compiler_version_satisfies(Package, Compiler, Version).
+
% do not warn if generated program contains none of these.
#defined depends_on/3.
#defined declared_dependency/3.