summaryrefslogtreecommitdiff
path: root/src/fetch.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2011-09-16 14:09:41 +0300
committerTimo Teräs <timo.teras@iki.fi>2011-09-16 14:09:41 +0300
commitbcd0d45a49c89fd809f0a028012196f5a9527c99 (patch)
treef7aa6651f191c4aee3c2d03eb10d08cdd38a6f98 /src/fetch.c
parent17918f676590530a06ffd72c2ad5047194de18af (diff)
downloadapk-tools-bcd0d45a49c89fd809f0a028012196f5a9527c99.tar.gz
apk-tools-bcd0d45a49c89fd809f0a028012196f5a9527c99.tar.bz2
apk-tools-bcd0d45a49c89fd809f0a028012196f5a9527c99.tar.xz
apk-tools-bcd0d45a49c89fd809f0a028012196f5a9527c99.zip
fetch: reimplement -R after solver changes
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++)