10 #include "solverdebug.h"
12 #include "repo_rpmdb.h"
13 #include "pool_fileconflicts.h"
16 iterate_handle(Pool *pool, Id p, void *cbdata)
18 Solvable *s = pool->solvables + p;
23 rpm_byrpmdbid(0, 0, (void **)cbdata);
26 if (!s->repo->rpmdbid)
28 rpmdbid = s->repo->rpmdbid[p - s->repo->start];
31 return rpm_byrpmdbid(rpmdbid, 0, (void **)cbdata);
34 int main(int argc, char **argv)
41 Queue todo, conflicts;
45 pool_setdebuglevel(pool, 1);
46 installed = repo_create(pool, "@System");
47 pool_set_installed(pool, installed);
48 if (repo_add_rpmdb(installed, 0, 0))
50 fprintf(stderr, "findfileconflicts: %s\n", pool_errstr(pool));
54 queue_init(&conflicts);
55 FOR_REPO_SOLVABLES(installed, p, s)
57 pool_findfileconflicts(pool, &todo, 0, &conflicts, &iterate_handle, (void *)&state);
59 for (i = 0; i < conflicts.count; i += 5)
60 printf("%s: %s[%s] %s[%s]\n", pool_id2str(pool, conflicts.elements[i]), pool_solvid2str(pool, conflicts.elements[i + 1]), pool_id2str(pool, conflicts.elements[i + 2]), pool_solvid2str(pool, conflicts.elements[i + 3]), pool_id2str(pool, conflicts.elements[i + 4]));
67 pool_add_fileconflicts_deps(pool, &conflicts);
68 pool_addfileprovides(pool);
69 pool_createwhatprovides(pool);
70 pool_setdebuglevel(pool, 0);
71 Solver *solv = solver_create(pool);
72 queue_push2(&job, SOLVER_VERIFY|SOLVER_SOLVABLE_ALL, 0);
74 solver_set_flag(solv, SOLVER_FLAG_ALLOW_UNINSTALL, 1);
76 problemcnt = solver_solve(solv, &job);
78 solver_printallsolutions(solv);
81 Transaction *trans = solver_create_transaction(solv);
82 transaction_print(trans);
83 transaction_free(trans);
88 queue_free(&conflicts);