fork download
  1. % Input predicates, which represent the state of the system at one point:
  2. %
  3. % installed(Package, Root) - package Package is physically present in root Root.
  4. % is_prefix(yes/no) - whether this is Gentoo Prefix, i.e. everything happens inside the prefix
  5. % d_HDEPEND(Package, DependPackage) - Package has a HDEPEND on DependPackage
  6. % d_RDEPEND(Package, DependPackage) - ... has RDEPEND ...
  7. % d_DEPEND(Package, DependPackage)
  8. % d_PDEPEND(Package, DependPackage)
  9. % d_BADEPEND(Package, DependPackage)
  10. % d_IDEPEND(Package, DependPackage)
  11.  
  12. % Get "host root" (for HDEPENDs and IDEPENDs).
  13. % If this is Gentoo Prefix, produces Root.
  14. % Otherwise, produces '/'.
  15. host_root(Root, Root) :- is_prefix(yes).
  16. host_root(Root, '/') :- is_prefix(no).
  17.  
  18. % package Package is installed in root Root and has RDEPENDs satisfied
  19. installed_correctly(Package, Root) :-
  20. % must be physically installed
  21. installed(Package, Root),
  22. % all RDEPENDs must be installed correctly
  23. forall(d_RDEPEND(Package, RunDependPackage),
  24. installed_correctly(RunDependPackage, Root)).
  25.  
  26. % package Package is installed correctly and all PDEPENDs are satisfied
  27. installed_completely(Package, Root) :-
  28. % must be physically installed
  29. installed(Package, Root),
  30. % all RDEPENDs must be installed completely
  31. forall(d_RDEPEND(Package, RunDependPackage),
  32. installed_completely(RunDependPackage, Root)),
  33. % all PDEPENDs must be installed completely
  34. forall(d_PDEPEND(Package, PostDependPackage),
  35. installed_completely(PostDependPackage, Root)).
  36.  
  37. % package Package for root Root can be built right now
  38. can_be_built(Package, Root) :-
  39. % all HDEPENDs are satisfied
  40. host_root(Root, HostRoot),
  41. forall(d_HDEPEND(Package, HostDependPackage),
  42. installed_correctly(HostDependPackage, HostRoot)), % should this be installed_completely()?
  43. % all DEPENDs are satisfied
  44. forall(d_DEPEND(Package, DependPackage),
  45. can_be_built_against(DependPackage, Root)).
  46.  
  47. % package Package in root Root can be built against, i.e. successfully used
  48. % within a DEPEND.
  49. can_be_built_against(Package, Root) :-
  50. % must be installed correctly
  51. installed_correctly(Package, Root),
  52. % all its BADEPENDs must be able to be built against
  53. forall(d_BADEPEND(Package, BuildAgainstPackage),
  54. can_be_built_against(BuildAgainstPackage, Root)).
  55.  
  56. % package Package has install dependencies satisfied for
  57. % installing or removing from root Root
  58. install_deps_satisfied(Package, Root) :-
  59. host_root(Root, HostRoot),
  60. forall(d_IDEPEND(Package, InstallDependPackage),
  61. installed_correctly(InstallDependPackage, HostRoot)). % should this be installed_completely()?
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.pl:16: warning: singleton variables [Root] for host_root/2
/home/g3yHfK/gplcSwWnmb.o: In function `predicate(host_root/2)':
(.text+0x3e): undefined reference to `predicate(is_prefix/1)'
/home/g3yHfK/gplcSwWnmb.o: In function `Lpred1_1':
(.text+0x6b): undefined reference to `predicate(is_prefix/1)'
/home/g3yHfK/gplcSwWnmb.o: In function `predicate(installed_correctly/2)':
(.text+0xab): undefined reference to `predicate(installed/2)'
/home/g3yHfK/gplcSwWnmb.o: In function `predicate(installed_correctly/2)':
(.text+0x115): undefined reference to `predicate(forall/2)'
/home/g3yHfK/gplcSwWnmb.o: In function `predicate(installed_completely/2)':
(.text+0x15b): undefined reference to `predicate(installed/2)'
/home/g3yHfK/gplcSwWnmb.o: In function `predicate(installed_completely/2)':
(.text+0x1ca): undefined reference to `predicate(forall/2)'
/home/g3yHfK/gplcSwWnmb.o: In function `predicate(installed_completely/2)':
(.text+0x234): undefined reference to `predicate(forall/2)'
/home/g3yHfK/gplcSwWnmb.o: In function `predicate(can_be_built/2)':
(.text+0x2ef): undefined reference to `predicate(forall/2)'
/home/g3yHfK/gplcSwWnmb.o: In function `predicate(can_be_built/2)':
(.text+0x359): undefined reference to `predicate(forall/2)'
/home/g3yHfK/gplcSwWnmb.o: In function `predicate(can_be_built_against/2)':
(.text+0x405): undefined reference to `predicate(forall/2)'
/home/g3yHfK/gplcSwWnmb.o:(.text+0x4b4): more undefined references to `predicate(forall/2)' follow
collect2: ld returned 1 exit status
compilation failed
stdout

Standard output is empty