summaryrefslogtreecommitdiff
path: root/src/del.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2013-06-11 14:06:06 +0300
committerTimo Teräs <timo.teras@iki.fi>2013-06-13 18:22:00 +0300
commitb8c44536ca911418fee1c9ab4eecbb913a1ca852 (patch)
treea89e68b12f4d3daf089c475beeb71c53ffb8cc3a /src/del.c
parentf292a858677ae0e1af8910ffbd4b338f4b36c18b (diff)
downloadapk-tools-b8c44536ca911418fee1c9ab4eecbb913a1ca852.tar.gz
apk-tools-b8c44536ca911418fee1c9ab4eecbb913a1ca852.tar.bz2
apk-tools-b8c44536ca911418fee1c9ab4eecbb913a1ca852.tar.xz
apk-tools-b8c44536ca911418fee1c9ab4eecbb913a1ca852.zip
solver: rewrite as deductive solver -- core features
Implementing basic dependency handling, install_if and awareness of pinning.
Diffstat (limited to 'src/del.c')
-rw-r--r--src/del.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/del.c b/src/del.c
index 7ffbf58..ed5f63e 100644
--- a/src/del.c
+++ b/src/del.c
@@ -143,7 +143,6 @@ static int del_main(void *pctx, struct apk_database *db, int argc, char **argv)
struct del_ctx *ctx = (struct del_ctx *) pctx;
struct apk_name **name;
struct apk_changeset changeset = {};
- struct apk_solution_array *solution = NULL;
struct not_deleted_ctx ndctx = {};
int i, j, r = 0;
@@ -159,11 +158,13 @@ static int del_main(void *pctx, struct apk_database *db, int argc, char **argv)
delete_from_world, ctx);
}
- r = apk_solver_solve(db, 0, ctx->world, &solution, &changeset);
+ r = apk_solver_solve(db, 0, ctx->world, &changeset);
if (r == 0 || (apk_flags & APK_FORCE)) {
/* check for non-deleted package names */
- for (i = 0; i < solution->num; i++) {
- struct apk_package *pkg = solution->item[i].pkg;
+ for (i = 0; i < changeset.changes->num; i++) {
+ struct apk_package *pkg = changeset.changes->item[i].new_pkg;
+ if (pkg == NULL)
+ continue;
pkg->name->state_ptr = pkg;
for (j = 0; j < pkg->provides->num; j++)
pkg->provides->item[j].name->state_ptr = pkg;
@@ -183,9 +184,8 @@ static int del_main(void *pctx, struct apk_database *db, int argc, char **argv)
apk_solver_commit_changeset(db, &changeset, ctx->world);
r = 0;
} else {
- apk_solver_print_errors(db, solution, ctx->world, r);
+ apk_solver_print_errors(db, &changeset, ctx->world);
}
- apk_solution_array_free(&solution);
apk_dependency_array_free(&ctx->world);
return r;