/*
- * prune queue, only keep solvables of kind
- *
- */
-
-static void
-prune_to_kind(Pool *pool, Queue *plist, solvable_kind kind)
-{
- int i, j;
- Solvable *s;
-
- /* prune to highest priority */
- for (i = j = 0; i < plist->count; i++)
- {
- s = pool->solvables + plist->elements[i];
- if (s->kind == kind)
- plist->elements[j++] = plist->elements[i];
- }
- plist->count = j;
-}
-
-
-/*
* prune to repository with highest priority
*
*/
policy_filter_unwanted(Solver *solv, Queue *plist, Id inst, int mode)
{
Pool *pool = solv->pool;
- if (plist->count > 1 && solv->limittokind)
- prune_to_kind(pool, plist, solv->limittokind-1);
if (plist->count > 1 && mode != POLICY_MODE_SUGGEST)
prune_to_highest_prio(pool, plist);
if (plist->count > 1 && mode == POLICY_MODE_CHOOSE)
#define SOLVABLE_BLOCK 255
/*
- * solvable_kind -> string prefix
- *
- */
-
-static const char *kindprefix_data[] = {
- NULL, NULL, NULL, NULL, NULL,
- "prod:",
- "patch:",
- "source:",
- "pattern:",
- "nosource"
-};
-
-const char *
-kind_prefix( solvable_kind kind )
-{
- if (kind >= _KIND_MAX)
- return NULL;
- return kindprefix_data[kind];
-}
-
-
-/*
* list of string constants, so we can do pointer/Id instead of string comparison
* index into array matches ID_xxx constants in pool.h
*/
#define SOLV_VERSION_3 3
#define SOLV_VERSION_4 4
#define SOLV_VERSION_5 5
-#define SOLV_VERSION_6 6 /* solvable.kind added */
#define SOLV_FLAG_PACKEDSIZES 1
#define SOLV_FLAG_VERTICAL 2
case SOLV_VERSION_3:
case SOLV_VERSION_4:
case SOLV_VERSION_5:
- case SOLV_VERSION_6:
break;
default:
pool_debug(pool, SAT_ERROR, "unsupported SOLV version\n");
did = read_id(&data, numid + numrel);
if (idmap)
did = idmap[did];
- if (id == SOLVABLE_NAME) {
+ if (id == SOLVABLE_NAME)
s->name = did;
- if (s->name) {
- /* Yeah, thats ugly. Better store kind as u8 in .solv files */
- const char *name = id2str(pool, s->name);
- const char *colon = strchr(name, ':');
- if (colon)
- s->kind = colon - name + 1;
- }
- }
else if (id == SOLVABLE_ARCH)
s->arch = did;
else if (id == SOLVABLE_EVR)
struct _Repo;
-typedef enum {
- KIND_PACKAGE = 0,
- KIND_PRODUCT = 5, /* strlen("prod:") */
- KIND_PATCH = 6, /* strlen("patch:") */
- KIND_SOURCE = 7, /* strlen("source:") */
- KIND_PATTERN = 8, /* strlen("pattern:") */
- KIND_NOSOURCE = 9, /* strlen("nosource:") */
- _KIND_MAX
-} solvable_kind;
-
-extern const char *kind_prefix( solvable_kind kind );
-
typedef struct _Solvable {
- unsigned int kind; /* one of KIND_xxx */
Id name;
Id arch;
Id evr; /* epoch:version-release */
solv->rules = sat_extend_resize(solv->rules, solv->nrules, sizeof(Rule), RULES_BLOCK);
memset(solv->rules, 0, sizeof(Rule));
- /* cannot be zero by default since zero corresponds to KIND_PACKAGE
- * so we initialize it with _KIND_MAX to denote 'all kinds'
- * if the application sets this to a specific KIND_, the value is
- * incremented by 1 at solver start to make 'if (limittokind)' checks easy
- *
- * A sure candidate for a more clever implementation
- */
-
- solv->limittokind = _KIND_MAX;
-
return solv;
}
Queue q;
Solvable *s;
- if (solv->limittokind != _KIND_MAX) /* if application wants to limit, make it non-zero */
- solv->limittokind += 1;
- else
- solv->limittokind = 0;
-
/* create whatprovides if not already there */
if (!pool->whatprovides)
pool_createwhatprovides(pool);
int allowvirtualconflicts; /* false: conflicts on package name, true: conflicts on package provides */
int noupdateprovide; /* true: update packages needs not to provide old package */
int dosplitprovides; /* true: consider legacy split provides */
- solvable_kind limittokind;
/* Callbacks for defining the bahaviour of the SAT solver */