summaryrefslogtreecommitdiff
path: root/src/fetch.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fetch.c')
-rw-r--r--src/fetch.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/src/fetch.c b/src/fetch.c
index 6f54d19..a9f2031 100644
--- a/src/fetch.c
+++ b/src/fetch.c
@@ -20,6 +20,7 @@
#include "apk_database.h"
#include "apk_io.h"
#include "apk_print.h"
+#include "apk_solver.h"
#define FETCH_RECURSIVE 1
#define FETCH_STDOUT 2
@@ -179,33 +180,26 @@ static int fetch_main(void *ctx, struct apk_database *db, int argc, char **argv)
.result_mask = APK_DEPMASK_REQUIRE,
};
-#if 0
if (fctx->flags & FETCH_RECURSIVE) {
- struct apk_state *state;
- struct apk_change *change;
+ struct apk_dependency_array *world;
+ struct apk_changeset changeset = {};
- state = apk_state_new(db);
- if (state == NULL)
- goto err;
-
- r = apk_state_lock_dependency(state, &dep);
+ apk_dependency_array_init(&world);
+ *apk_dependency_array_add(&world) = dep;
+ r = apk_solver_solve(db, 0, world, NULL, &changeset);
+ apk_dependency_array_free(&world);
if (r != 0) {
- apk_state_unref(state);
- apk_error("Unable to install '%s'",
- dep.name->name);
+ apk_error("Unable to install '%s'", argv[i]);
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);
if (r != 0)
goto err;
}
-
- apk_state_unref(state);
- } else
-#endif
- {
+ } else {
struct apk_package *pkg = NULL;
for (j = 0; j < dep.name->pkgs->num; j++)