% Input predicates
, which represent the state of the
system at one point
: %
% installed
( Package
, Root
) - package Package is physically present in root Root
. % d_HDEPEND( Package, DependPackage) - Package has a HDEPEND on DependPackage
% d_RDEPEND( Package, DependPackage) - ... has RDEPEND ...
% d_DEPEND( Package, DependPackage)
% d_PDEPEND( Package, DependPackage)
% d_BADEPEND( Package, DependPackage)
% d_IDEPEND( Package, DependPackage)
% package Package is installed in root Root
and has RDEPENDs satisfied
installed_correctly( Package, Root) :-
% must be physically installed
installed( Package, Root) ,
% all RDEPENDs must be installed correctly
forall( d_RDEPEND( Package, RunDependPackage) ,
installed_correctly( RunDependPackage, Root) ) .
% package Package is installed correctly
and all PDEPENDs are satisfied
installed_completely( Package, Root) :-
% must be physically installed
installed( Package, Root) ,
% all RDEPENDs must be installed completely
forall( d_RDEPEND( Package, RunDependPackage) ,
installed_completely( RunDependPackage, Root) ) ,
% all PDEPENDs must be installed completely
forall( d_PDEPEND( Package, PostDependPackage) ,
installed_completely( PostDependPackage, Root) ) .
% package Package
for root Root can be built right now
can_be_built( Package, Root) :-
% all HDEPENDs are satisfied
forall( d_HDEPEND( Package, HostDependPackage) ,
installed_correctly( HostDependPackage, '/' ) ) , % should this be installed_completely( ) ?
% all DEPENDs are satisfied
forall( d_DEPEND( Package, DependPackage) ,
can_be_built_against( DependPackage, Root) ) .
% package Package in root Root can be built against
, i
. e
. successfully used
% within a DEPEND.
can_be_built_against( Package, Root) :-
% must be installed correctly
installed_correctly( Package, Root) ,
% all its BADEPENDs must be able to be built against
forall( d_BADEPEND( Package, BuildAgainstPackage) ,
can_be_built_against( BuildAgainstPackage, Root) ) .
% package Package has install dependencies satisfied
for % installing or removing from root Root
install_deps_satisfied( Package, Root) :-
forall( d_IDEPEND( Package, InstallDependPackage) ,
installed_correctly( InstallDependPackage, '/' ) ) . % should this be installed_completely( ) ?
JSBJbnB1dCBwcmVkaWNhdGVzLCB3aGljaCByZXByZXNlbnQgdGhlIHN0YXRlIG9mIHRoZSBzeXN0ZW0gYXQ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