summaryrefslogtreecommitdiff
path: root/src/solver.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2011-09-09 19:41:19 +0300
committerTimo Teräs <timo.teras@iki.fi>2011-09-09 19:41:19 +0300
commit4bf13c3d9a58d4f1685401c3569abb40c5649ca3 (patch)
treecc25666871634eb421fc3b7c54cac18c4ba2a084 /src/solver.c
parent31e4f588940354625947f283d2e70a473e78c5ac (diff)
downloadapk-tools-4bf13c3d9a58d4f1685401c3569abb40c5649ca3.tar.gz
apk-tools-4bf13c3d9a58d4f1685401c3569abb40c5649ca3.tar.bz2
apk-tools-4bf13c3d9a58d4f1685401c3569abb40c5649ca3.tar.xz
apk-tools-4bf13c3d9a58d4f1685401c3569abb40c5649ca3.zip
del: fix recursive deletion and messages (after solver merge)
Deduce the world dependencies to remove locally, and same for the additional messages about packages not deleted.
Diffstat (limited to 'src/solver.c')
-rw-r--r--src/solver.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/solver.c b/src/solver.c
index 72eb3e1..75575c2 100644
--- a/src/solver.c
+++ b/src/solver.c
@@ -974,14 +974,17 @@ static int cmp_upgrade(struct apk_change *change)
return 0;
}
-static int commit_changeset(struct apk_database *db,
- struct apk_changeset *changeset,
- struct apk_dependency_array *world)
+int apk_solver_commit_changeset(struct apk_database *db,
+ struct apk_changeset *changeset,
+ struct apk_dependency_array *world)
{
struct progress prog;
struct apk_change *change;
int i, r = 0, size_diff = 0;
+ if (changeset->changes == NULL)
+ goto all_done;
+
/* Count what needs to be done */
memset(&prog, 0, sizeof(prog));
for (i = 0; i < changeset->changes->num; i++) {
@@ -1044,6 +1047,7 @@ static int commit_changeset(struct apk_database *db,
apk_db_run_triggers(db);
+all_done:
apk_dependency_array_copy(&db->world, world);
apk_db_write_config(db);
@@ -1085,10 +1089,10 @@ static void print_dep_errors(char *label, struct apk_dependency_array *deps)
printf("\n");
}
-static void print_errors(struct apk_database *db,
- struct apk_package_array *solution,
- struct apk_dependency_array *world,
- int unsatisfiable)
+void apk_solver_print_errors(struct apk_database *db,
+ struct apk_package_array *solution,
+ struct apk_dependency_array *world,
+ int unsatisfiable)
{
int i;
@@ -1120,16 +1124,13 @@ int apk_solver_commit(struct apk_database *db,
if (r < 0)
return r;
- if (changeset.changes == NULL)
- apk_change_array_init(&changeset.changes);
-
if (r == 0 || (apk_flags & APK_FORCE)) {
/* Success -- or forced installation of bad graph */
- commit_changeset(db, &changeset, world);
+ apk_solver_commit_changeset(db, &changeset, world);
r = 0;
} else {
/* Failure -- print errors */
- print_errors(db, solution, world, r);
+ apk_solver_print_errors(db, solution, world, r);
}
apk_package_array_free(&solution);