diff options
author | Michael Schroeder <mls@suse.de> | 2013-02-04 17:41:31 +0100 |
---|---|---|
committer | Michael Schroeder <mls@suse.de> | 2013-02-04 17:41:31 +0100 |
commit | 460454535325e5b00c78f9f30afa3bc67e3f6038 (patch) | |
tree | 211fbf9b5bb6b3a2a4e17ede8784edfdea5a7291 /examples/solv.c | |
parent | 2bd102f701f4f018a2971c9e058538280785f24d (diff) | |
download | libsolv-460454535325e5b00c78f9f30afa3bc67e3f6038.tar.gz libsolv-460454535325e5b00c78f9f30afa3bc67e3f6038.tar.bz2 libsolv-460454535325e5b00c78f9f30afa3bc67e3f6038.zip |
reuse solver in examples
Diffstat (limited to 'examples/solv.c')
-rw-r--r-- | examples/solv.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/examples/solv.c b/examples/solv.c index 0ef5daa..4daa572 100644 --- a/examples/solv.c +++ b/examples/solv.c @@ -2833,17 +2833,17 @@ main(int argc, char **argv) #if defined(ENABLE_RPMDB) && (defined(SUSE) || defined(FEDORA)) rerunsolver: #endif + solv = solver_create(pool); + solver_set_flag(solv, SOLVER_FLAG_SPLITPROVIDES, 1); + if (mainmode == MODE_ERASE) + solver_set_flag(solv, SOLVER_FLAG_ALLOW_UNINSTALL, 1); /* don't nag */ + solver_set_flag(solv, SOLVER_FLAG_BEST_OBEY_POLICY, 1); + for (;;) { Id problem, solution; int pcnt, scnt; - solv = solver_create(pool); - solver_set_flag(solv, SOLVER_FLAG_SPLITPROVIDES, 1); - if (mainmode == MODE_ERASE) - solver_set_flag(solv, SOLVER_FLAG_ALLOW_UNINSTALL, 1); /* don't nag */ - solver_set_flag(solv, SOLVER_FLAG_BEST_OBEY_POLICY, 1); - if (!solver_solve(solv, &job)) break; pcnt = solver_problem_count(solv); @@ -2894,8 +2894,6 @@ rerunsolver: continue; solver_take_solution(solv, problem, take, &job); } - solver_free(solv); - solv = 0; } trans = solver_create_transaction(solv); @@ -3149,8 +3147,8 @@ rerunsolver: fclose(newpkgsfps[i]); newpkgsfps = solv_free(newpkgsfps); solver_free(solv); + solv = 0; pool_add_fileconflicts_deps(pool, &conflicts); - pool_createwhatprovides(pool); /* Hmm... */ goto rerunsolver; } } |