diff options
author | Michael Schroeder <mls@suse.de> | 2012-10-29 12:54:39 +0100 |
---|---|---|
committer | Michael Schroeder <mls@suse.de> | 2012-10-29 12:54:39 +0100 |
commit | 7a3604d6574bc943e568ad518ed8d4b8f59d1b7e (patch) | |
tree | 2dab9448127bc25f0e1f3418595b244da18f0011 /src/solverdebug.c | |
parent | 3a813744404dc0f0041003a7d18f451c82e64a11 (diff) | |
download | libsolv-7a3604d6574bc943e568ad518ed8d4b8f59d1b7e.tar.gz libsolv-7a3604d6574bc943e568ad518ed8d4b8f59d1b7e.tar.bz2 libsolv-7a3604d6574bc943e568ad518ed8d4b8f59d1b7e.zip |
add pool_selection2str() and use it in the bindings
Diffstat (limited to 'src/solverdebug.c')
-rw-r--r-- | src/solverdebug.c | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/src/solverdebug.c b/src/solverdebug.c index 3c4af96..130e04f 100644 --- a/src/solverdebug.c +++ b/src/solverdebug.c @@ -801,6 +801,7 @@ solver_select2str(Pool *pool, Id select, Id what) { const char *s; char *b; + select &= SOLVER_SELECTMASK; if (select == SOLVER_SOLVABLE) return pool_solvid2str(pool, what); if (select == SOLVER_SOLVABLE_NAME) @@ -897,7 +898,8 @@ pool_job2str(Pool *pool, Id how, Id what, Id flagmask) 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); @@ -926,6 +928,46 @@ pool_job2str(Pool *pool, Id how, Id what, Id flagmask) } 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; |