summaryrefslogtreecommitdiff
path: root/src/fetch.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2017-02-27 14:56:06 +0200
committerTimo Teräs <timo.teras@iki.fi>2017-02-27 14:56:57 +0200
commit0fe3f3964b8b5accc1e79f5f8a7d848e8fc2cba8 (patch)
treef2ad11a8a6e5cef36d53745f780600a7d738b0cd /src/fetch.c
parent6542d4ca2c69c7275ce8fc4fe6df185595a97ed6 (diff)
downloadapk-tools-0fe3f3964b8b5accc1e79f5f8a7d848e8fc2cba8.tar.gz
apk-tools-0fe3f3964b8b5accc1e79f5f8a7d848e8fc2cba8.tar.bz2
apk-tools-0fe3f3964b8b5accc1e79f5f8a7d848e8fc2cba8.tar.xz
apk-tools-0fe3f3964b8b5accc1e79f5f8a7d848e8fc2cba8.zip
fetch: fix --recursive mode to work with pure virtual packages
The virtual package provider still needs to be explicitly given on command line.
Diffstat (limited to 'src/fetch.c')
-rw-r--r--src/fetch.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/fetch.c b/src/fetch.c
index bc63983..48848af 100644
--- a/src/fetch.c
+++ b/src/fetch.c
@@ -216,6 +216,11 @@ static void mark_error(struct fetch_ctx *ctx, const char *match, struct apk_name
ctx->errors++;
}
+static void mark_name_flags(struct apk_database *db, const char *match, struct apk_name *name, void *ctx)
+{
+ name->auto_select_virtual = 1;
+}
+
static void mark_name_recursive(struct apk_database *db, const char *match, struct apk_name *name, void *ctx)
{
struct apk_changeset changeset = {};
@@ -299,7 +304,7 @@ static int purge_package(void *pctx, int dirfd, const char *filename)
static int fetch_main(void *pctx, struct apk_database *db, struct apk_string_array *args)
{
struct fetch_ctx *ctx = (struct fetch_ctx *) pctx;
- void *mark = (ctx->flags & FETCH_RECURSIVE) ? mark_name_recursive : mark_name;
+ void *mark;
if (ctx->flags & FETCH_STDOUT) {
apk_flags &= ~APK_PROGRESS;
@@ -318,6 +323,12 @@ static int fetch_main(void *pctx, struct apk_database *db, struct apk_string_arr
ctx->db = db;
+ if (ctx->flags & FETCH_RECURSIVE) {
+ apk_name_foreach_matching(db, args, apk_foreach_genid(), mark_name_flags, ctx);
+ mark = mark_name_recursive;
+ } else {
+ mark = mark_name;
+ }
apk_name_foreach_matching(db, args, apk_foreach_genid(), mark, ctx);
if (!ctx->errors)
apk_hash_foreach(&db->available.packages, fetch_package, ctx);