| |
| |
| |
| |
| |
| |
|
|
| |
| |
| |
| |
|
|
| #ifndef LIBSOLV_SOLVER_H |
| #define LIBSOLV_SOLVER_H |
|
|
| #include "pooltypes.h" |
| #include "pool.h" |
| #include "repo.h" |
| #include "queue.h" |
| #include "bitmap.h" |
| #include "transaction.h" |
| #include "rules.h" |
| #include "problems.h" |
|
|
| #ifdef __cplusplus |
| extern "C" { |
| #endif |
|
|
| struct s_Solver { |
| Pool *pool; |
| Queue job; |
|
|
| int (*solution_callback)(struct s_Solver *solv, void *data); |
| void *solution_callback_data; |
|
|
| int pooljobcnt; |
|
|
| #ifdef LIBSOLV_INTERNAL |
| Repo *installed; |
|
|
| |
| |
| |
| |
| Rule *rules; |
| Id nrules; |
| Id lastpkgrule; |
|
|
| Queue ruleassertions; |
|
|
| |
|
|
| Id pkgrules_end; |
|
|
| Id featurerules; |
| Id featurerules_end; |
|
|
| Id updaterules; |
| Id updaterules_end; |
|
|
| Id jobrules; |
| Id jobrules_end; |
|
|
| Id infarchrules; |
| Id infarchrules_end; |
|
|
| Id duprules; |
| Id duprules_end; |
|
|
| Id bestrules; |
| Id bestrules_up; |
| Id bestrules_end; |
| Id *bestrules_info; |
|
|
| Id yumobsrules; |
| Id yumobsrules_end; |
| Id *yumobsrules_info; |
|
|
| Id blackrules; |
| Id blackrules_end; |
|
|
| Id strictrepopriorules; |
| Id strictrepopriorules_end; |
|
|
| Id choicerules; |
| Id choicerules_end; |
| Id *choicerules_info; |
|
|
| Id recommendsrules; |
| Id recommendsrules_end; |
| Id *recommendsrules_info; |
|
|
| Id learntrules; |
|
|
| Map noupdate; |
| |
| Map multiversion; |
|
|
| Map updatemap; |
| int updatemap_all; |
|
|
| Map bestupdatemap; |
| int bestupdatemap_all; |
|
|
| Map fixmap; |
| int fixmap_all; |
|
|
| Queue weakruleq; |
| Map weakrulemap; |
|
|
| Id *watches; |
| |
| |
| |
| |
|
|
| Queue ruletojob; |
|
|
| |
| Queue decisionq; |
| Queue decisionq_why; |
| Queue decisionq_reason; |
|
|
| Id *decisionmap; |
| |
| |
| |
|
|
| |
| Queue learnt_why; |
| Queue learnt_pool; |
|
|
| Queue branches; |
| int propagate_index; |
|
|
| Queue problems; |
| Queue solutions; |
|
|
| Queue orphaned; |
|
|
| int stats_learned; |
| int stats_unsolvable; |
|
|
| Map recommendsmap; |
| Map suggestsmap; |
| int recommends_index; |
| Queue *recommendscplxq; |
| Queue *suggestscplxq; |
|
|
| Id *obsoletes; |
| Id *obsoletes_data; |
| Id *specialupdaters; |
|
|
| |
| |
| |
|
|
| int allowdowngrade; |
| int allownamechange; |
| int allowarchchange; |
| int allowvendorchange; |
| int allowuninstall; |
| int noupdateprovide; |
| int needupdateprovide; |
| int dosplitprovides; |
| int dontinstallrecommended; |
| int addalreadyrecommended; |
| int dontshowinstalledrecommended; |
|
|
| int noinfarchcheck; |
| int keepexplicitobsoletes; |
| int bestobeypolicy; |
| int noautotarget; |
| int focus_installed; |
| int focus_best; |
| int focus_new; |
| int do_yum_obsoletes; |
| int urpmreorder; |
| int strongrecommends; |
| int install_also_updates; |
| int only_namespace_recommended; |
| int strict_repo_priority; |
|
|
| int process_orphans; |
| Map dupmap; |
| Map dupinvolvedmap; |
| int dupinvolvedmap_all; |
| int dup_allowdowngrade; |
| int dup_allownamechange; |
| int dup_allowarchchange; |
| int dup_allowvendorchange; |
|
|
| Map droporphanedmap; |
| int droporphanedmap_all; |
|
|
| Map cleandepsmap; |
|
|
| Queue *ruleinfoq; |
|
|
| Queue *cleandeps_updatepkgs; |
| Queue *cleandeps_mistakes; |
|
|
| Queue *update_targets; |
|
|
| Queue *installsuppdepq; |
|
|
| Queue addedmap_deduceq; |
| Id *instbuddy; |
| int keep_orphans; |
| int break_orphans; |
| Queue *brokenorphanrules; |
|
|
| Map allowuninstallmap; |
| int allowuninstall_all; |
|
|
| Map excludefromweakmap; |
|
|
| Id *favormap; |
| int havedisfavored; |
|
|
| int installedpos; |
| int do_extra_reordering; |
|
|
| Queue *recommendsruleq; |
| #endif |
| }; |
|
|
| typedef struct s_Solver Solver; |
|
|
| |
| |
| |
|
|
| #define SOLVER_SOLVABLE 0x01 |
| #define SOLVER_SOLVABLE_NAME 0x02 |
| #define SOLVER_SOLVABLE_PROVIDES 0x03 |
| #define SOLVER_SOLVABLE_ONE_OF 0x04 |
| #define SOLVER_SOLVABLE_REPO 0x05 |
| #define SOLVER_SOLVABLE_ALL 0x06 |
|
|
| #define SOLVER_SELECTMASK 0xff |
|
|
| #define SOLVER_NOOP 0x0000 |
| #define SOLVER_INSTALL 0x0100 |
| #define SOLVER_ERASE 0x0200 |
| #define SOLVER_UPDATE 0x0300 |
| #define SOLVER_WEAKENDEPS 0x0400 |
| #define SOLVER_MULTIVERSION 0x0500 |
| #define SOLVER_LOCK 0x0600 |
| #define SOLVER_DISTUPGRADE 0x0700 |
| #define SOLVER_VERIFY 0x0800 |
| #define SOLVER_DROP_ORPHANED 0x0900 |
| #define SOLVER_USERINSTALLED 0x0a00 |
| #define SOLVER_ALLOWUNINSTALL 0x0b00 |
| #define SOLVER_FAVOR 0x0c00 |
| #define SOLVER_DISFAVOR 0x0d00 |
| #define SOLVER_BLACKLIST 0x0e00 |
| #define SOLVER_EXCLUDEFROMWEAK 0x1000 |
|
|
| #define SOLVER_JOBMASK 0xff00 |
|
|
| #define SOLVER_WEAK 0x010000 |
| #define SOLVER_ESSENTIAL 0x020000 |
| #define SOLVER_CLEANDEPS 0x040000 |
| |
| |
| #define SOLVER_ORUPDATE 0x080000 |
| |
| |
| |
| |
| #define SOLVER_FORCEBEST 0x100000 |
| |
| |
| |
| |
| |
| #define SOLVER_TARGETED 0x200000 |
| |
| |
| #define SOLVER_NOTBYUSER 0x400000 |
|
|
| #define SOLVER_SETEV 0x01000000 |
| #define SOLVER_SETEVR 0x02000000 |
| #define SOLVER_SETARCH 0x04000000 |
| #define SOLVER_SETVENDOR 0x08000000 |
| #define SOLVER_SETREPO 0x10000000 |
| #define SOLVER_NOAUTOSET 0x20000000 |
| #define SOLVER_SETNAME 0x40000000 |
|
|
| #define SOLVER_SETMASK 0x7f000000 |
|
|
| |
| #define SOLVER_NOOBSOLETES SOLVER_MULTIVERSION |
|
|
| #define SOLVER_REASON_UNRELATED 0 |
| #define SOLVER_REASON_UNIT_RULE 1 |
| #define SOLVER_REASON_KEEP_INSTALLED 2 |
| #define SOLVER_REASON_RESOLVE_JOB 3 |
| #define SOLVER_REASON_UPDATE_INSTALLED 4 |
| #define SOLVER_REASON_CLEANDEPS_ERASE 5 |
| #define SOLVER_REASON_RESOLVE 6 |
| #define SOLVER_REASON_WEAKDEP 7 |
| #define SOLVER_REASON_RESOLVE_ORPHAN 8 |
|
|
| #define SOLVER_REASON_RECOMMENDED 16 |
| #define SOLVER_REASON_SUPPLEMENTED 17 |
|
|
| #define SOLVER_REASON_UNSOLVABLE 18 |
| #define SOLVER_REASON_PREMISE 19 |
|
|
|
|
| #define SOLVER_FLAG_ALLOW_DOWNGRADE 1 |
| #define SOLVER_FLAG_ALLOW_ARCHCHANGE 2 |
| #define SOLVER_FLAG_ALLOW_VENDORCHANGE 3 |
| #define SOLVER_FLAG_ALLOW_UNINSTALL 4 |
| #define SOLVER_FLAG_NO_UPDATEPROVIDE 5 |
| #define SOLVER_FLAG_SPLITPROVIDES 6 |
| #define SOLVER_FLAG_IGNORE_RECOMMENDED 7 |
| #define SOLVER_FLAG_ADD_ALREADY_RECOMMENDED 8 |
| #define SOLVER_FLAG_NO_INFARCHCHECK 9 |
| #define SOLVER_FLAG_ALLOW_NAMECHANGE 10 |
| #define SOLVER_FLAG_KEEP_EXPLICIT_OBSOLETES 11 |
| #define SOLVER_FLAG_BEST_OBEY_POLICY 12 |
| #define SOLVER_FLAG_NO_AUTOTARGET 13 |
| #define SOLVER_FLAG_DUP_ALLOW_DOWNGRADE 14 |
| #define SOLVER_FLAG_DUP_ALLOW_ARCHCHANGE 15 |
| #define SOLVER_FLAG_DUP_ALLOW_VENDORCHANGE 16 |
| #define SOLVER_FLAG_DUP_ALLOW_NAMECHANGE 17 |
| #define SOLVER_FLAG_KEEP_ORPHANS 18 |
| #define SOLVER_FLAG_BREAK_ORPHANS 19 |
| #define SOLVER_FLAG_FOCUS_INSTALLED 20 |
| #define SOLVER_FLAG_YUM_OBSOLETES 21 |
| #define SOLVER_FLAG_NEED_UPDATEPROVIDE 22 |
| #define SOLVER_FLAG_URPM_REORDER 23 |
| #define SOLVER_FLAG_FOCUS_BEST 24 |
| #define SOLVER_FLAG_STRONG_RECOMMENDS 25 |
| #define SOLVER_FLAG_INSTALL_ALSO_UPDATES 26 |
| #define SOLVER_FLAG_ONLY_NAMESPACE_RECOMMENDED 27 |
| #define SOLVER_FLAG_STRICT_REPO_PRIORITY 28 |
| #define SOLVER_FLAG_FOCUS_NEW 29 |
|
|
| #define GET_USERINSTALLED_NAMES (1 << 0) |
| #define GET_USERINSTALLED_INVERTED (1 << 1) |
| #define GET_USERINSTALLED_NAMEARCH (1 << 2) |
|
|
| #define SOLVER_ALTERNATIVE_TYPE_RULE 1 |
| #define SOLVER_ALTERNATIVE_TYPE_RECOMMENDS 2 |
| #define SOLVER_ALTERNATIVE_TYPE_SUGGESTS 3 |
|
|
| |
| #define SOLVER_DECISIONLIST_SOLVABLE (1 << 1) |
| #define SOLVER_DECISIONLIST_PROBLEM (1 << 2) |
| #define SOLVER_DECISIONLIST_LEARNTRULE (1 << 3) |
| #define SOLVER_DECISIONLIST_WITHINFO (1 << 8) |
| #define SOLVER_DECISIONLIST_SORTED (1 << 9) |
| #define SOLVER_DECISIONLIST_MERGEDINFO (1 << 10) |
|
|
| #define SOLVER_DECISIONLIST_TYPEMASK (0xff) |
|
|
| extern Solver *solver_create(Pool *pool); |
| extern void solver_free(Solver *solv); |
| extern int solver_solve(Solver *solv, Queue *job); |
| extern Transaction *solver_create_transaction(Solver *solv); |
| extern int solver_set_flag(Solver *solv, int flag, int value); |
| extern int solver_get_flag(Solver *solv, int flag); |
|
|
| extern int solver_get_decisionlevel(Solver *solv, Id p); |
| extern void solver_get_decisionqueue(Solver *solv, Queue *decisionq); |
| extern int solver_get_lastdecisionblocklevel(Solver *solv); |
| extern void solver_get_decisionblock(Solver *solv, int level, Queue *decisionq); |
|
|
| extern void solver_get_orphaned(Solver *solv, Queue *orphanedq); |
| extern void solver_get_recommendations(Solver *solv, Queue *recommendationsq, Queue *suggestionsq, int noselected); |
| extern void solver_get_unneeded(Solver *solv, Queue *unneededq, int filtered); |
| extern void solver_get_userinstalled(Solver *solv, Queue *q, int flags); |
| extern void pool_add_userinstalled_jobs(Pool *pool, Queue *q, Queue *job, int flags); |
| extern void solver_get_cleandeps(Solver *solv, Queue *cleandepsq); |
|
|
| extern int solver_describe_decision(Solver *solv, Id p, Id *infop); |
|
|
| extern void solver_get_decisionlist(Solver *solv, Id p, int flags, Queue *decisionlistq); |
| extern void solver_get_decisionlist_multiple(Solver *solv, Queue *pq, int flags, Queue *decisionlistq); |
| extern void solver_get_learnt(Solver *solv, Id id, int flags, Queue *q); |
| extern void solver_decisionlist_solvables(Solver *solv, Queue *decisionlistq, int pos, Queue *q); |
| extern int solver_decisionlist_merged(Solver *solv, Queue *decisionlistq, int pos); |
|
|
| extern int solver_alternatives_count(Solver *solv); |
| extern int solver_get_alternative(Solver *solv, Id alternative, Id *idp, Id *fromp, Id *chosenp, Queue *choices, int *levelp); |
| extern int solver_alternativeinfo(Solver *solv, int type, Id id, Id from, Id *fromp, Id *top, Id *depp); |
|
|
| extern void solver_calculate_multiversionmap(Pool *pool, Queue *job, Map *multiversionmap); |
| extern void solver_calculate_noobsmap(Pool *pool, Queue *job, Map *multiversionmap); |
| extern void solver_create_state_maps(Solver *solv, Map *installedmap, Map *conflictsmap); |
|
|
| extern void solver_calc_duchanges(Solver *solv, DUChanges *mps, int nmps); |
| extern int solver_calc_installsizechange(Solver *solv); |
|
|
| extern void pool_job2solvables(Pool *pool, Queue *pkgs, Id how, Id what); |
| extern int pool_isemptyupdatejob(Pool *pool, Id how, Id what); |
|
|
| |
| extern int solver_calc_decisioninfo_bits(Solver *solv, Id decision, int type, Id from, Id to, Id dep); |
| extern int solver_merge_decisioninfo_bits(Solver *solv, int state1, int type1, Id from1, Id to1, Id dep1, int state2, int type2, Id from2, Id to2, Id dep2); |
|
|
| extern const char *solver_select2str(Pool *pool, Id select, Id what); |
| extern const char *pool_job2str(Pool *pool, Id how, Id what, Id flagmask); |
| extern const char *solver_alternative2str(Solver *solv, int type, Id id, Id from); |
| extern const char *solver_reason2str(Solver *solv, int reason); |
| extern const char *solver_decisionreason2str(Solver *solv, Id decision, int reason, Id info); |
| extern const char *solver_decisioninfo2str(Solver *solv, int bits, int type, Id from, Id to, Id dep); |
|
|
|
|
| |
| extern void solver_describe_weakdep_decision(Solver *solv, Id p, Queue *whyq); |
|
|
| |
| #define FOR_RULELITERALS(l, pp, r) \ |
| for (pp = r->d < 0 ? -r->d - 1 : r->d, \ |
| l = r->p; l; l = (pp <= 0 ? (pp-- ? 0 : r->w2) : \ |
| pool->whatprovidesdata[pp++])) |
|
|
|
|
|
|
|
|
| |
| |
|
|
| |
| #define FOR_JOB_SELECT(p, pp, select, what) \ |
| if (select == SOLVER_SOLVABLE_REPO || select == SOLVER_SOLVABLE_ALL) \ |
| p = pp = 0; \ |
| else for (pp = (select == SOLVER_SOLVABLE ? 0 : \ |
| select == SOLVER_SOLVABLE_ONE_OF ? what : \ |
| pool_whatprovides(pool, what)), \ |
| p = (select == SOLVER_SOLVABLE ? what : pool->whatprovidesdata[pp++]); \ |
| p ; p = pool->whatprovidesdata[pp++]) \ |
| if (select == SOLVER_SOLVABLE_NAME && \ |
| pool_match_nevr(pool, pool->solvables + p, what) == 0) \ |
| continue; \ |
| else |
|
|
| |
| extern void solver_trivial_installable(Solver *solv, Queue *pkgs, Queue *res); |
|
|
| #ifdef __cplusplus |
| } |
| #endif |
|
|
| #endif |
|
|