diff options
author | Timo Teräs <timo.teras@iki.fi> | 2023-05-10 16:24:49 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2023-05-10 16:29:58 +0300 |
commit | f360cacea6f112ff1a515eea01e9cfaabd605b89 (patch) | |
tree | fdedffe8dd7452d031a114ff38a1813a9e2db935 | |
parent | 94436f2680a886d2ab7e09097fc8c6aa03ea93a7 (diff) | |
download | apk-tools-f360cacea6f112ff1a515eea01e9cfaabd605b89.tar.gz apk-tools-f360cacea6f112ff1a515eea01e9cfaabd605b89.tar.bz2 apk-tools-f360cacea6f112ff1a515eea01e9cfaabd605b89.tar.xz apk-tools-f360cacea6f112ff1a515eea01e9cfaabd605b89.zip |
del: fix --rdepends
fixes #10898
-rw-r--r-- | src/app_del.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/app_del.c b/src/app_del.c index 2a09ca6..5304c30 100644 --- a/src/app_del.c +++ b/src/app_del.c @@ -16,6 +16,7 @@ struct del_ctx { int recursive_delete : 1; struct apk_dependency_array *world; + unsigned int genid; int errors; }; @@ -110,11 +111,15 @@ static void delete_pkg(struct apk_package *pkg0, struct apk_dependency *dep0, struct apk_package *pkg, void *pctx) { struct del_ctx *ctx = (struct del_ctx *) pctx; + struct apk_dependency *d; apk_deps_del(&ctx->world, pkg0->name); + foreach_array_item(d, pkg0->provides) + apk_deps_del(&ctx->world, d->name); + if (ctx->recursive_delete) apk_pkg_foreach_reverse_dependency( - pkg0, APK_FOREACH_INSTALLED | APK_DEP_SATISFIES, + pkg0, ctx->genid | APK_FOREACH_INSTALLED | APK_DEP_SATISFIES, delete_pkg, pctx); } @@ -149,6 +154,7 @@ static int del_main(void *pctx, struct apk_ctx *ac, struct apk_string_array *arg struct apk_dependency *d; int r = 0; + ctx->genid = apk_foreach_genid(); apk_dependency_array_copy(&ctx->world, db->world); if (args->num) apk_db_foreach_matching_name(db, args, delete_name, ctx); if (ctx->errors) return ctx->errors; |