#include "repo.h"
#include "util.h"
-struct _TransactionElement {
+struct s_TransactionElement {
Id p; /* solvable id */
Id edges; /* pointer into edges data */
Id mark;
};
-struct _TransactionOrderdata {
- struct _TransactionElement *tes;
+struct s_TransactionOrderdata {
+ struct s_TransactionElement *tes;
int ntes;
Id *invedgedata;
int ninvedgedata;
#define TYPE_REQ_P (1<<2)
#define TYPE_PREREQ_P (1<<3)
-#define TYPE_REC (1<<4)
+#define TYPE_SUG (1<<4)
+#define TYPE_REC (1<<5)
-#define TYPE_REQ (1<<5)
-#define TYPE_PREREQ (1<<6)
+#define TYPE_REQ (1<<6)
+#define TYPE_PREREQ (1<<7)
#define TYPE_CYCLETAIL (1<<16)
#define TYPE_CYCLEHEAD (1<<17)
void
transaction_clone_orderdata(Transaction *trans, Transaction *srctrans)
{
- struct _TransactionOrderdata *od = srctrans->orderdata;
+ struct s_TransactionOrderdata *od = srctrans->orderdata;
if (!od)
return;
trans->orderdata = solv_calloc(1, sizeof(*trans->orderdata));
{
if (trans->orderdata)
{
- struct _TransactionOrderdata *od = trans->orderdata;
+ struct s_TransactionOrderdata *od = trans->orderdata;
od->tes = solv_free(od->tes);
od->invedgedata = solv_free(od->invedgedata);
if (od->cycles)
struct orderdata {
Transaction *trans;
- struct _TransactionElement *tes;
+ struct s_TransactionElement *tes;
int ntes;
Id *edgedata;
int nedgedata;
addteedge(struct orderdata *od, int from, int to, int type)
{
int i;
- struct _TransactionElement *te;
+ struct s_TransactionElement *te;
if (from == to)
return 0;
Transaction *trans = od->trans;
Pool *pool = trans->pool;
Solvable *s;
- struct _TransactionElement *te;
+ struct s_TransactionElement *te;
int i;
/* printf("addedge %d %d type %d\n", from, to, type); */
{
Transaction *trans = od->trans;
Pool *pool = trans->pool;
- Id req, *reqp, con, *conp, rec, *recp;
Id p, p2, pp2;
int i, j, pre, numins;
Repo *installed = pool->installed;
queue_init(&depq);
if (s->requires)
{
+ Id req, *reqp;
reqp = s->repo->idarraydata + s->requires;
pre = TYPE_REQ;
while ((req = *reqp++) != 0)
}
if (s->conflicts)
{
+ Id con, *conp;
conp = s->repo->idarraydata + s->conflicts;
while ((con = *conp++) != 0)
{
}
if (s->recommends && s->repo != installed)
{
+ Id rec, *recp;
recp = s->repo->idarraydata + s->recommends;
while ((rec = *recp++) != 0)
{
}
}
}
+ if (s->suggests && s->repo != installed)
+ {
+ Id sug, *sugp;
+ sugp = s->repo->idarraydata + s->suggests;
+ while ((sug = *sugp++) != 0)
+ {
+ queue_empty(&depq);
+ FOR_PROVIDES(p2, pp2, sug)
+ {
+ s2 = pool->solvables + p2;
+ if (p2 == p)
+ {
+ depq.count = 0; /* self provides */
+ break;
+ }
+ if (s2->repo == installed && !MAPTST(&trans->transactsmap, p2))
+ continue;
+ if (s2->repo != installed && !MAPTST(&trans->transactsmap, p2))
+ continue; /* package stays uninstalled */
+ if (s2->repo != installed)
+ queue_pushunique(&depq, p2);
+ }
+ for (i = 0; i < depq.count; i++)
+ {
+ p2 = depq.elements[i];
+ if (pool->solvables[p2].repo != installed)
+ {
+#if 0
+ printf("add suggests inst->inst edge (%s -> %s -> %s)\n", pool_solvid2str(pool, p), pool_dep2str(pool, sug), pool_solvid2str(pool, p2));
+#endif
+ addedge(od, p, p2, TYPE_SUG);
+ }
+ }
+ }
+ }
if (s->repo == installed && solvable_lookup_idarray(s, SOLVABLE_TRIGGERS, &depq) && depq.count)
{
/* we're getting deinstalled/updated. Try to do this before our
Pool *pool = od->trans->pool;
Id ddegmin, ddegmax, ddeg;
int k, l;
- struct _TransactionElement *te;
+ struct s_TransactionElement *te;
l = 0;
ddegmin = ddegmax = 0;
POOL_DEBUG(SOLV_DEBUG_STATS, "\n");
}
+#if 0
static inline void
dump_tes(struct orderdata *od)
{
Pool *pool = od->trans->pool;
int i, j;
Queue obsq;
- struct _TransactionElement *te, *te2;
+ struct s_TransactionElement *te, *te2;
queue_init(&obsq);
for (i = 1, te = od->tes + i; i < od->ntes; i++, te++)
}
}
}
+#endif
static void
reachable(struct orderdata *od, Id i)
{
- struct _TransactionElement *te = od->tes + i;
+ struct s_TransactionElement *te = od->tes + i;
int j, k;
if (te->mark != 0)
Transaction *trans = od->trans;
Pool *pool = trans->pool;
#endif
- struct _TransactionElement *te;
+ struct s_TransactionElement *te;
int i, j, k, tail;
int head;
Solvable *s;
int i, j, k, numte, numedge;
struct orderdata od;
- struct _TransactionElement *te;
+ struct s_TransactionElement *te;
Queue todo, obsq, samerepoq, uninstq;
int cycstart, cycel;
Id *cycle;
/* free old data if present */
if (trans->orderdata)
{
- struct _TransactionOrderdata *od = trans->orderdata;
+ struct s_TransactionOrderdata *od = trans->orderdata;
od->tes = solv_free(od->tes);
od->invedgedata = solv_free(od->invedgedata);
trans->orderdata = solv_free(trans->orderdata);
#if 0
printf("do %s [%d]\n", pool_solvid2str(pool, te->p), temedianr[i]);
#endif
- s = pool->solvables + te->p;
for (j = te->edges; od.invedgedata[j]; j++)
{
- struct _TransactionElement *te2 = od.tes + od.invedgedata[j];
+ struct s_TransactionElement *te2 = od.tes + od.invedgedata[j];
assert(te2->mark > 0);
if (--te2->mark == 0)
{
if ((flags & (SOLVER_TRANSACTION_KEEP_ORDERDATA | SOLVER_TRANSACTION_KEEP_ORDERCYCLES)) != 0)
{
- struct _TransactionOrderdata *tod;
+ struct s_TransactionOrderdata *tod;
trans->orderdata = tod = solv_calloc(1, sizeof(*trans->orderdata));
if ((flags & SOLVER_TRANSACTION_KEEP_ORDERCYCLES) != 0)
{
transaction_order_add_choices(Transaction *trans, Id chosen, Queue *choices)
{
int i, j;
- struct _TransactionOrderdata *od = trans->orderdata;
- struct _TransactionElement *te;
+ struct s_TransactionOrderdata *od = trans->orderdata;
+ struct s_TransactionElement *te;
if (!od)
return choices->count;
void
transaction_order_get_cycleids(Transaction *trans, Queue *q, int minseverity)
{
- struct _TransactionOrderdata *od = trans->orderdata;
+ struct s_TransactionOrderdata *od = trans->orderdata;
Queue *cq;
int i, cid, ncycles;
int
transaction_order_get_cycle(Transaction *trans, Id cid, Queue *q)
{
- struct _TransactionOrderdata *od = trans->orderdata;
+ struct s_TransactionOrderdata *od = trans->orderdata;
Queue *cq;
int cmin, cmax, severity;
int ncycles;