summaryrefslogtreecommitdiff
path: root/src/fix.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2014-12-08 08:30:58 +0200
committerTimo Teräs <timo.teras@iki.fi>2014-12-08 08:31:41 +0200
commit02cd5a9c76cd676545c232bb567d7eb01e5bd6fd (patch)
treece05b50bff40784b36c310eee0916be229e640b2 /src/fix.c
parent6697ed5e86e64516ac56894d2f81c575ff72fd4f (diff)
downloadapk-tools-02cd5a9c76cd676545c232bb567d7eb01e5bd6fd.tar.gz
apk-tools-02cd5a9c76cd676545c232bb567d7eb01e5bd6fd.tar.bz2
apk-tools-02cd5a9c76cd676545c232bb567d7eb01e5bd6fd.tar.xz
apk-tools-02cd5a9c76cd676545c232bb567d7eb01e5bd6fd.zip
make del, fetch, fix and info return errors
In case all applet arguments are packages names (that is are not including wildcards), return error if they do not match to some package.
Diffstat (limited to 'src/fix.c')
-rw-r--r--src/fix.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/fix.c b/src/fix.c
index f6fd579..8951d64 100644
--- a/src/fix.c
+++ b/src/fix.c
@@ -20,6 +20,7 @@ struct fix_ctx {
unsigned short solver_flags;
int fix_depends : 1;
int fix_directory_permissions : 1;
+ int errors;
};
static int option_parse_applet(void *pctx, struct apk_db_options *dbopts, int optch, const char *optarg)
@@ -70,9 +71,15 @@ static void mark_fix(struct fix_ctx *ctx, struct apk_name *name)
apk_solver_set_name_flags(name, ctx->solver_flags, ctx->fix_depends ? ctx->solver_flags : 0);
}
-static void set_solver_flags(struct apk_database *db, const char *match, struct apk_name *name, void *ctx)
+static void set_solver_flags(struct apk_database *db, const char *match, struct apk_name *name, void *pctx)
{
- mark_fix(ctx, name);
+ struct fix_ctx *ctx = pctx;
+
+ if (!name) {
+ apk_error("Package '%s' not found", match);
+ ctx->errors++;
+ } else
+ mark_fix(ctx, name);
}
static int fix_main(void *pctx, struct apk_database *db, struct apk_string_array *args)
@@ -94,6 +101,8 @@ static int fix_main(void *pctx, struct apk_database *db, struct apk_string_array
} else
apk_name_foreach_matching(db, args, apk_foreach_genid(), set_solver_flags, ctx);
+ if (ctx->errors) return ctx->errors;
+
return apk_solver_commit(db, 0, db->world);
}