Commit bcd0d45a authored by Timo Teräs's avatar Timo Teräs

fetch: reimplement -R after solver changes

parent 17918f67
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "apk_database.h" #include "apk_database.h"
#include "apk_io.h" #include "apk_io.h"
#include "apk_print.h" #include "apk_print.h"
#include "apk_solver.h"
#define FETCH_RECURSIVE 1 #define FETCH_RECURSIVE 1
#define FETCH_STDOUT 2 #define FETCH_STDOUT 2
...@@ -179,33 +180,26 @@ static int fetch_main(void *ctx, struct apk_database *db, int argc, char **argv) ...@@ -179,33 +180,26 @@ static int fetch_main(void *ctx, struct apk_database *db, int argc, char **argv)
.result_mask = APK_DEPMASK_REQUIRE, .result_mask = APK_DEPMASK_REQUIRE,
}; };
#if 0
if (fctx->flags & FETCH_RECURSIVE) { if (fctx->flags & FETCH_RECURSIVE) {
struct apk_state *state; struct apk_dependency_array *world;
struct apk_change *change; struct apk_changeset changeset = {};
state = apk_state_new(db); apk_dependency_array_init(&world);
if (state == NULL) *apk_dependency_array_add(&world) = dep;
goto err; r = apk_solver_solve(db, 0, world, NULL, &changeset);
apk_dependency_array_free(&world);
r = apk_state_lock_dependency(state, &dep);
if (r != 0) { if (r != 0) {
apk_state_unref(state); apk_error("Unable to install '%s'", argv[i]);
apk_error("Unable to install '%s'",
dep.name->name);
goto err; goto err;
} }
list_for_each_entry(change, &state->change_list_head, change_list) { for (j = 0; j < changeset.changes->num; j++) {
struct apk_change *change = &changeset.changes->item[j];
r = fetch_package(fctx, db, change->newpkg); r = fetch_package(fctx, db, change->newpkg);
if (r != 0) if (r != 0)
goto err; goto err;
} }
} else {
apk_state_unref(state);
} else
#endif
{
struct apk_package *pkg = NULL; struct apk_package *pkg = NULL;
for (j = 0; j < dep.name->pkgs->num; j++) for (j = 0; j < dep.name->pkgs->num; j++)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment