Skip to content

Commit

Permalink
updating model with help from @tgamblin
Browse files Browse the repository at this point in the history
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
  • Loading branch information
vsoch committed Apr 24, 2021
1 parent 214935c commit 80aa823
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 51 deletions.
20 changes: 19 additions & 1 deletion lib/spack/spack/solver/logic/concretize.lp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ version_satisfies(Package, Constraint)
#defined preferred_version_declared/3.
#defined version_satisfies/3.


%-----------------------------------------------------------------------------
% Spec conditions and imposed constraints
%
Expand Down Expand Up @@ -97,7 +98,6 @@ do_not_impose(ID) :-
% They're only triggered if the associated dependnecy condition holds.
depends_on(Package, Dependency, Type)
:- dependency_holds(Package, Dependency, Type),
dependency_checks_hold(Package, Dependency, Type),
not virtual(Dependency).

% every root must be a node
Expand All @@ -123,6 +123,24 @@ path(Parent, Descendant) :- path(Parent, A), depends_on(A, Descendant).
#defined dependency_type/2.
#defined dependency_condition/3.

%-----------------------------------------------------------------------------
% ABI Compatibility
%-----------------------------------------------------------------------------

% compatibility is defined as the absence of any incompatibilities
compatible(Package, Dependency) :-
node(Package),
node(Dependency),
version(Package, V1),
version(Dependency, V2),
not incompatible(Package, V1, Dependency, V2).

#defined incompatible/4.

% Do not admit models with ABI-incompatible dependencies
:- depends_on(Package, Dependency), not compatible(Package, Dependency).


%-----------------------------------------------------------------------------
% Conflicts
%-----------------------------------------------------------------------------
Expand Down
63 changes: 13 additions & 50 deletions lib/spack/spack/solver/logic/symbols.lp
Original file line number Diff line number Diff line change
Expand Up @@ -76,69 +76,32 @@ defined_symbol(Package, Version, Symbol)
:- defined_symbol(Package, Version, Symbol, _, _).


% This is the main "entry" function from concretize.lp
% dependency checks hold if
dependency_checks_hold(Package, Dependency, Type)

% the dependency holds and
:- dependency_holds(Package, Dependency, Type),

% there are no check failures
not check_failure(Package, Dependency, Type).


% the dependency checks fail
check_failure(Package, Dependency, Type)
% a package and dependency are linkable if
linkable(Package, Dependency)

% if both the package and dependency are nodes
% The package and dependency are nodes in the graph
:- node(Package),
node(Dependency),

% they have set versions
version(Package, Version),
version(Dependency, DependencyVersion),

% and the symbols for those versions don't match
not mismatch(Package, Version, Dependency, DependencyVersion, Type),

% type is unsafe if we don't add this.
Type == "link".

% And the dependency holds
dependency_holds(Package, Dependency, _).


% There is a mismatch for a package and dependency if:
mismatch(Package, Version, Dependency, DependencyVersion, Type)
% A package and dependency are incompatible if:
incompatible(Package, V1, Dependency, V2)

% they are linkable
:- linkable(Package, Dependency),

% The package and dependency each have their own version
version(Package, Version),
version(Dependency, DependencyVersion),
version(Package, V1),
version(Dependency, V2),

% The package has an undefined symbol
undefined_symbol(Package, Version, Symbol),
undefined_symbol(Package, V1, Symbol),

% the package depends on the dependency
depends_on(Package, Dependency, Type),
depends_on(Package, Dependency),

% and the symbol is not defined for the dependency
not defined_symbol(Dependency, DependencyVersion, Symbol).


% a package and dependency are linkable if
linkable(Package, Dependency)

% The package and dependency are nodes in the graph
:- node(Package),
node(Dependency),

% And the dependency holds
dependency_holds(Package, Dependency, _).

% transitive
% I don't know how we can have two versions here?
defined_symbol(Package, Version, Symbol)
:- depends_on(Package, Dependency, Type), defined_symbol(Dependency, Version, Symbol).

:- depends_on(Package, Dependency, _),
not dependency_checks_hold(Package, Dependency, _).
not defined_symbol(Dependency, V2, Symbol).

0 comments on commit 80aa823

Please sign in to comment.