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:30:28 +0300 |
commit | a06eb18980789c30a086785da3d6dd4424c7b1c9 (patch) | |
tree | 979e01f480326b8acd76b53b13269d3d183eff07 /src | |
parent | 7250e5fa5bd996a29bf7c27db9f66b50f87e5341 (diff) | |
download | apk-tools-a06eb18980789c30a086785da3d6dd4424c7b1c9.tar.gz apk-tools-a06eb18980789c30a086785da3d6dd4424c7b1c9.tar.bz2 apk-tools-a06eb18980789c30a086785da3d6dd4424c7b1c9.tar.xz apk-tools-a06eb18980789c30a086785da3d6dd4424c7b1c9.zip |
del: fix --rdepends
fixes #10898
Diffstat (limited to 'src')
-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 e5c6aab..3d0e928 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; }; @@ -107,11 +108,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); } @@ -144,6 +149,7 @@ static int del_main(void *pctx, struct apk_database *db, struct apk_string_array 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; |