00001 /* 00002 * Copyright (c) 2007, Novell Inc. 00003 * 00004 * This program is licensed under the BSD license, read LICENSE.BSD 00005 * for further information 00006 */ 00007 00008 /* 00009 * Generic policy interface for SAT solver 00010 * The policy* function can be "overloaded" by defining a callback in the solver struct. 00011 */ 00012 00013 #include "solver.h" 00014 00015 #define POLICY_MODE_CHOOSE 0 00016 #define POLICY_MODE_RECOMMEND 1 00017 #define POLICY_MODE_SUGGEST 2 00018 00019 /* This functions can be used for sorting solvables to a specific order like architecture, version. */ 00020 /* Solvables which does not fit to the system will be deleted from the list. */ 00021 extern void prune_best_arch_name_version(const Solver *solv, Pool *pool, Queue *plist); 00022 00023 extern void prune_to_best_arch(const Pool *pool, Queue *plist); 00024 extern void prune_to_best_version(Pool *pool, Queue *plist); 00025 00026 00027 /* The following default policies can be overloaded by the application by using callbacks which are 00028 * descibed in solver.h: 00029 * 00030 * Finding best candidate 00031 * 00032 * Callback definition: 00033 * void bestSolvable (Pool *pool, Queue *canditates) 00034 * candidates : List of canditates which has to be sorted by the function call 00035 * return candidates: Sorted list of the candidates(first is the best). 00036 * 00037 * Checking if two solvables has compatible architectures 00038 * 00039 * Callback definition: 00040 * int archCheck (Pool *pool, Solvable *solvable1, Solvable *solvable2); 00041 * 00042 * return 0 it the two solvables has compatible architectures 00043 * 00044 * Checking if two solvables has compatible vendors 00045 * 00046 * Callback definition: 00047 * int vendorCheck (Pool *pool, Solvable *solvable1, Solvable *solvable2); 00048 * 00049 * return 0 it the two solvables has compatible architectures 00050 * 00051 * Evaluate update candidate 00052 * 00053 * Callback definition: 00054 * void pdateCandidateCb (Pool *pool, Solvable *solvable, Queue *canditates) 00055 * solvable : for which updates should be search 00056 * candidates : List of candidates (This list depends on other 00057 * restrictions like architecture and vendor policies too) 00058 */ 00059 00060 #define POLICY_ILLEGAL_DOWNGRADE 1 00061 #define POLICY_ILLEGAL_ARCHCHANGE 2 00062 #define POLICY_ILLEGAL_VENDORCHANGE 4 00063 00064 extern void policy_filter_unwanted(Solver *solv, Queue *plist, int mode); 00065 extern int policy_illegal_archchange(Solver *solv, Solvable *s1, Solvable *s2); 00066 extern int policy_illegal_vendorchange(Solver *solv, Solvable *s1, Solvable *s2); 00067 extern int policy_is_illegal(Solver *solv, Solvable *s1, Solvable *s2, int ignore); 00068 extern void policy_findupdatepackages(Solver *solv, 00069 Solvable *s, 00070 Queue *qs, 00071 int allowall); /* do not regard policies for vendor,architecuture,... change */ 00072 00073 extern void policy_create_obsolete_index(Solver *solv); 00074