%rename("str") __str__;
#endif
const char *__str__() {
- int i;
- char *s = pool_tmpjoin($self->pool, 0, 0, 0);
- for (i = 0; i < $self->q.count; i += 2)
- s = pool_tmpappend($self->pool, s, " | ", solver_select2str($self->pool, $self->q.elements[i] & SOLVER_SELECTMASK, $self->q.elements[i + 1]));
- return *s ? s + 3 : s;
+ return pool_selection2str($self->pool, &$self->q, 0);
+ }
+ const char *__repr__() {
+ const char *str = pool_selection2str($self->pool, &$self->q, ~0);
+ return pool_tmpjoin($self->pool, "<Selection ", str, ">");
}
}
{
const char *s;
char *b;
+ select &= SOLVER_SELECTMASK;
if (select == SOLVER_SOLVABLE)
return pool_solvid2str(pool, what);
if (select == SOLVER_SOLVABLE_NAME)
break;
}
s = pool_tmpjoin(pool, strstart, solver_select2str(pool, select, what), strend);
- if ((how & flagmask & ~(SOLVER_SELECTMASK|SOLVER_JOBMASK)) == 0)
+ how &= flagmask;
+ if ((how & ~(SOLVER_SELECTMASK|SOLVER_JOBMASK)) == 0)
return s;
o = strlen(s);
s = pool_tmpappend(pool, s, " ", 0);
}
const char *
+pool_selection2str(Pool *pool, Queue *selection, Id flagmask)
+{
+ char *s;
+ const char *s2;
+ int i;
+ s = pool_tmpjoin(pool, 0, 0, 0);
+ for (i = 0; i < selection->count; i++)
+ {
+ Id how = selection->elements[i];
+ if (*s)
+ s = pool_tmpappend(pool, s, " | ", 0);
+ s2 = solver_select2str(pool, how & SOLVER_SELECTMASK, selection->elements[i + 1]);
+ s = pool_tmpappend(pool, s, s2, 0);
+ pool_freetmpspace(pool, s2);
+ how &= flagmask & SOLVER_SETMASK;
+ if (how)
+ {
+ int o = strlen(s);
+ s = pool_tmpappend(pool, s, " ", 0);
+ s = pool_tmpappend(pool, s, ",setev", 0);
+ if (how & SOLVER_SETEVR)
+ s = pool_tmpappend(pool, s, ",setevr", 0);
+ if (how & SOLVER_SETARCH)
+ s = pool_tmpappend(pool, s, ",setarch", 0);
+ if (how & SOLVER_SETVENDOR)
+ s = pool_tmpappend(pool, s, ",setvendor", 0);
+ if (how & SOLVER_SETREPO)
+ s = pool_tmpappend(pool, s, ",setrepo", 0);
+ if (how & SOLVER_NOAUTOSET)
+ s = pool_tmpappend(pool, s, ",noautoset", 0);
+ if (s[o + 1] != ',')
+ s = pool_tmpappend(pool, s, ",?", 0);
+ s[o + 1] = '[';
+ s = pool_tmpappend(pool, s, "]", 0);
+ }
+ }
+ return s;
+}
+
+const char *
solver_problemruleinfo2str(Solver *solv, SolverRuleinfo type, Id source, Id target, Id dep)
{
Pool *pool = solv->pool;
extern void transaction_print(Transaction *trans);
extern const char *solver_select2str(Pool *pool, Id select, Id what);
-extern const char *pool_job2str(Pool *pool, Id how, Id what, int withflags);
+extern const char *pool_job2str(Pool *pool, Id how, Id what, Id flagmask);
+extern const char *pool_selection2str(Pool *pool, Queue *selection, Id flagmask);
extern const char *solver_problemruleinfo2str(Solver *solv, SolverRuleinfo type, Id source, Id target, Id dep);
extern const char *solver_solutionelement2str(Solver *solv, Id p, Id rp);
extern const char *policy_illegal2str(Solver *solv, int illegal, Solvable *s, Solvable *rs);