diff options
author | Timo Teräs <timo.teras@iki.fi> | 2014-12-08 08:30:58 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2014-12-08 08:31:41 +0200 |
commit | 02cd5a9c76cd676545c232bb567d7eb01e5bd6fd (patch) | |
tree | ce05b50bff40784b36c310eee0916be229e640b2 /src/del.c | |
parent | 6697ed5e86e64516ac56894d2f81c575ff72fd4f (diff) | |
download | apk-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/del.c')
-rw-r--r-- | src/del.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -18,6 +18,7 @@ struct del_ctx { int recursive_delete : 1; struct apk_dependency_array *world; + int errors; }; static int option_parse_applet(void *pctx, struct apk_db_options *dbopts, int optch, const char *optarg) @@ -109,6 +110,11 @@ static void delete_name(struct apk_database *db, const char *match, struct del_ctx *ctx = (struct del_ctx *) pctx; struct apk_package *pkg; + if (!name) { + ctx->errors++; + return; + } + pkg = apk_pkg_get_installed(name); if (pkg != NULL) delete_pkg(pkg, NULL, NULL, pctx); @@ -126,6 +132,8 @@ static int del_main(void *pctx, struct apk_database *db, struct apk_string_array apk_dependency_array_copy(&ctx->world, db->world); apk_name_foreach_matching(db, args, apk_foreach_genid(), delete_name, ctx); + if (ctx->errors) return ctx->errors; + r = apk_solver_solve(db, 0, ctx->world, &changeset); if (r == 0) { /* check for non-deleted package names */ |