From 02cd5a9c76cd676545c232bb567d7eb01e5bd6fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Ter=C3=A4s?= Date: Mon, 8 Dec 2014 08:30:58 +0200 Subject: 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. --- src/fix.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/fix.c') 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); } -- cgit v1.2.3