pkg_depends.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /* pkg_depends.h - the opkg package management system
  2. Steven M. Ayer
  3. Copyright (C) 2002 Compaq Computer Corporation
  4. This program is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU General Public License as
  6. published by the Free Software Foundation; either version 2, or (at
  7. your option) any later version.
  8. This program is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. General Public License for more details.
  12. */
  13. #ifndef PKG_DEPENDS_H
  14. #define PKG_DEPENDS_H
  15. #include "pkg.h"
  16. #include "pkg_hash.h"
  17. enum depend_type {
  18. UNSPEC,
  19. PREDEPEND,
  20. DEPEND,
  21. CONFLICTS,
  22. GREEDY_DEPEND,
  23. RECOMMEND,
  24. SUGGEST
  25. };
  26. typedef enum depend_type depend_type_t;
  27. enum version_constraint {
  28. NONE,
  29. EARLIER,
  30. EARLIER_EQUAL,
  31. EQUAL,
  32. LATER_EQUAL,
  33. LATER
  34. };
  35. typedef enum version_constraint version_constraint_t;
  36. struct depend {
  37. version_constraint_t constraint;
  38. char *version;
  39. abstract_pkg_t *pkg;
  40. };
  41. typedef struct depend depend_t;
  42. struct compound_depend {
  43. depend_type_t type;
  44. int possibility_count;
  45. struct depend **possibilities;
  46. };
  47. typedef struct compound_depend compound_depend_t;
  48. void buildProvides(abstract_pkg_t * ab_pkg, pkg_t * pkg);
  49. void buildConflicts(pkg_t * pkg);
  50. void buildReplaces(abstract_pkg_t * ab_pkg, pkg_t * pkg);
  51. void buildDepends(pkg_t * pkg);
  52. void parse_deplist(pkg_t *pkg, enum depend_type type, char *list);
  53. abstract_pkg_t **init_providelist(pkg_t *pkg, int *count);
  54. void parse_providelist(pkg_t *pkg, char *list);
  55. /**
  56. * pkg_replaces returns 1 if pkg->replaces contains one of replacee's provides and 0
  57. * otherwise.
  58. */
  59. int pkg_replaces(pkg_t * pkg, pkg_t * replacee);
  60. /**
  61. * pkg_conflicts_abstract returns 1 if pkg->conflicts contains conflictee provides and 0
  62. * otherwise.
  63. */
  64. int pkg_conflicts_abstract(pkg_t * pkg, abstract_pkg_t * conflicts);
  65. /**
  66. * pkg_conflicts returns 1 if pkg->conflicts contains one of conflictee's provides and 0
  67. * otherwise.
  68. */
  69. int pkg_conflicts(pkg_t * pkg, pkg_t * conflicts);
  70. char *pkg_depend_str(pkg_t * pkg, int index);
  71. void buildDependedUponBy(pkg_t * pkg, abstract_pkg_t * ab_pkg);
  72. int version_constraints_satisfied(depend_t * depends, pkg_t * pkg);
  73. int pkg_hash_fetch_unsatisfied_dependencies(pkg_t * pkg, pkg_vec_t * depends,
  74. char ***unresolved);
  75. pkg_vec_t *pkg_hash_fetch_conflicts(pkg_t * pkg);
  76. int pkg_dependence_satisfiable(depend_t * depend);
  77. int pkg_dependence_satisfied(depend_t * depend);
  78. const char *constraint_to_str(enum version_constraint c);
  79. compound_depend_t *pkg_get_depends(pkg_t *pkg, enum depend_type type);
  80. #endif