summaryrefslogtreecommitdiff
path: root/src/app_del.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2021-03-19 12:05:20 +0200
committerTimo Teräs <timo.teras@iki.fi>2021-03-19 12:32:22 +0200
commitff0ea8265f0621995b94b69416e2a1709f1cbec6 (patch)
tree95166423efb2dc97d166c845304e6498b6aca7ed /src/app_del.c
parent358c3172ef57b7e7616cbaaad582cab908097694 (diff)
downloadapk-tools-ff0ea8265f0621995b94b69416e2a1709f1cbec6.tar.gz
apk-tools-ff0ea8265f0621995b94b69416e2a1709f1cbec6.tar.bz2
apk-tools-ff0ea8265f0621995b94b69416e2a1709f1cbec6.tar.xz
apk-tools-ff0ea8265f0621995b94b69416e2a1709f1cbec6.zip
del: report correctly package's provides names
The code assumed that when package is in world, it would be there by it's primary name. The code is now updated to properly print the package names that are actually present in world. fixes #10718
Diffstat (limited to 'src/app_del.c')
-rw-r--r--src/app_del.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/src/app_del.c b/src/app_del.c
index aa7ab4f..c8a9e36 100644
--- a/src/app_del.c
+++ b/src/app_del.c
@@ -50,6 +50,11 @@ struct not_deleted_ctx {
int header;
};
+static inline int name_in_world(struct apk_name *n)
+{
+ return n->state_int == 1;
+}
+
static void print_not_deleted_pkg(struct apk_package *pkg0, struct apk_dependency *dep0,
struct apk_package *pkg, void *pctx)
{
@@ -57,18 +62,22 @@ static void print_not_deleted_pkg(struct apk_package *pkg0, struct apk_dependenc
struct apk_dependency *d;
struct apk_provider *p;
- if (pkg0->name != ctx->name) {
- if (!ctx->header) {
- apk_message("World updated, but the following packages are not removed due to:");
- ctx->header = 1;
- }
- if (!ctx->indent.indent) {
- ctx->indent.x = printf(" %s:", ctx->name->name);
- ctx->indent.indent = ctx->indent.x + 1;
- }
+ if (!ctx->header) {
+ apk_message("World updated, but the following packages are not removed due to:");
+ ctx->header = 1;
+ }
+ if (!ctx->indent.indent) {
+ ctx->indent.x = printf(" %s:", ctx->name->name);
+ ctx->indent.indent = ctx->indent.x + 1;
+ }
+ if (name_in_world(pkg0->name)) {
apk_print_indented(&ctx->indent, APK_BLOB_STR(pkg0->name->name));
}
+ foreach_array_item(d, pkg0->provides) {
+ if (!name_in_world(d->name)) continue;
+ apk_print_indented(&ctx->indent, APK_BLOB_STR(d->name->name));
+ }
apk_pkg_foreach_reverse_dependency(pkg0, ctx->matches, print_not_deleted_pkg, pctx);
foreach_array_item(d, pkg0->install_if) {
@@ -133,6 +142,7 @@ static int del_main(void *pctx, struct apk_database *db, struct apk_string_array
struct not_deleted_ctx ndctx = {};
struct apk_changeset changeset = {};
struct apk_change *change;
+ struct apk_dependency *d;
int r = 0;
apk_dependency_array_copy(&ctx->world, db->world);
@@ -145,6 +155,8 @@ static int del_main(void *pctx, struct apk_database *db, struct apk_string_array
foreach_array_item(change, changeset.changes)
if (change->new_pkg != NULL)
change->new_pkg->marked = 1;
+ foreach_array_item(d, ctx->world)
+ d->name->state_int = 1;
apk_name_foreach_matching(
db, args,
apk_foreach_genid() | APK_FOREACH_MARKED | APK_DEP_SATISFIES,