if (selection)
DEBUG(transaction->ctx, "Solving: %s\n", selection);
-RETRY:
- // Save time when we starting solving
- solving_start = clock();
+ for (;;) {
+ // Save time when we starting solving
+ solving_start = clock();
- // Solve the request and get the number of problems
- r = solver_solve(transaction->solver, &transaction->jobs);
+ // Solve the request and get the number of problems
+ r = solver_solve(transaction->solver, &transaction->jobs);
- // Save time when we finished solving
- solving_end = clock();
+ // Save time when we finished solving
+ solving_end = clock();
- DEBUG(transaction->ctx, "Solved request in %.4fms\n",
- (double)(solving_end - solving_start) * 1000 / CLOCKS_PER_SEC);
+ DEBUG(transaction->ctx, "Solved request in %.4fms\n",
+ (double)(solving_end - solving_start) * 1000 / CLOCKS_PER_SEC);
- switch (r) {
- // Solved!
- case 0:
- // Mark as solved
- solved = 1;
+ switch (r) {
+ // Solved!
+ case 0:
+ // Mark as solved
+ solved = 1;
- // Import the transaction
- r = pakfire_transaction_import_transaction(transaction);
- if (r)
- goto ERROR;
+ // Import the transaction
+ r = pakfire_transaction_import_transaction(transaction);
+ if (r)
+ goto ERROR;
- // Import userinstalled packages
- r = pakfire_transaction_import_userinstalled(transaction);
- if (r)
- goto ERROR;
+ // Import userinstalled packages
+ r = pakfire_transaction_import_userinstalled(transaction);
+ if (r)
+ goto ERROR;
- break;
+#ifdef ENABLE_DEBUG
+ // Print all decisions
+ solver_printdecisions(transaction->solver);
+#endif
- // Not Solved
- default:
+ goto SOLVED;
+
+ // Not Solved
+ default:
#ifdef ENABLE_DEBUG
- // Print all solutions
- solver_printallsolutions(transaction->solver);
+ // Print all solutions
+ solver_printallsolutions(transaction->solver);
#endif
- // Fetch the reason why we could not solve the request
- p = pakfire_transaction_get_problem_string(transaction, flags);
+ // Fetch the reason why we could not solve the request
+ p = pakfire_transaction_get_problem_string(transaction, flags);
- if (p) {
- DEBUG(transaction->ctx,
- "Could not solve request: %s\n%s\n", selection, p);
+ if (p) {
+ DEBUG(transaction->ctx,
+ "Could not solve request: %s\n%s\n", selection, p);
- // Return the problems
- if (problems)
- *problems = strdup(p);
- }
+ // Return the problems
+ if (problems)
+ *problems = strdup(p);
+ }
- // Ask the user to pick a solution
- r = pakfire_ctx_pick_solution(transaction->ctx, transaction->pakfire, transaction);
- switch (r) {
- case 0:
- goto RETRY;
+ // Ask the user to pick a solution
+ r = pakfire_ctx_pick_solution(transaction->ctx, transaction->pakfire, transaction);
+ switch (r) {
+ case 0:
+ continue;
- default:
- goto ERROR;
- }
- break;
+ default:
+ goto ERROR;
+ }
+ break;
+ }
}
-#ifdef ENABLE_DEBUG
- if (solved)
- solver_printdecisions(transaction->solver);
-#endif
-
+SOLVED:
// Return zero if solved, otherwise return non-zero
if (solved)
r = 0;