summaryrefslogtreecommitdiff
path: root/src/del.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2019-12-29 19:33:44 +0200
committerTimo Teräs <timo.teras@iki.fi>2019-12-29 19:40:24 +0200
commit90fc52e2b8e3396ad600439b20840ee717e44419 (patch)
tree8f10ee0b1f2fb333c042ef51d3f842cb68856a56 /src/del.c
parent7af5384db77b6fd37309f64f0049f6726f92fccc (diff)
downloadapk-tools-90fc52e2b8e3396ad600439b20840ee717e44419.tar.gz
apk-tools-90fc52e2b8e3396ad600439b20840ee717e44419.tar.bz2
apk-tools-90fc52e2b8e3396ad600439b20840ee717e44419.tar.xz
apk-tools-90fc52e2b8e3396ad600439b20840ee717e44419.zip
del: report non-matching names and install-if rule non-deletion
Diffstat (limited to 'src/del.c')
-rw-r--r--src/del.c33
1 files changed, 21 insertions, 12 deletions
diff --git a/src/del.c b/src/del.c
index 8e149ab..a67bc23 100644
--- a/src/del.c
+++ b/src/del.c
@@ -58,22 +58,30 @@ static void print_not_deleted_pkg(struct apk_package *pkg0, struct apk_dependenc
struct apk_package *pkg, void *pctx)
{
struct not_deleted_ctx *ctx = (struct not_deleted_ctx *) pctx;
+ struct apk_dependency *d;
+ struct apk_provider *p;
- if (pkg0->name == ctx->name)
- goto no_print;
-
- 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 (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;
+ }
+
+ apk_print_indented(&ctx->indent, APK_BLOB_STR(pkg0->name->name));
}
- apk_print_indented(&ctx->indent, APK_BLOB_STR(pkg0->name->name));
-no_print:
apk_pkg_foreach_reverse_dependency(pkg0, ctx->matches, print_not_deleted_pkg, pctx);
+ foreach_array_item(d, pkg0->install_if) {
+ foreach_array_item(p, d->name->providers) {
+ if (!p->pkg->marked) continue;
+ if (apk_pkg_match_genid(p->pkg, ctx->matches)) continue;
+ print_not_deleted_pkg(p->pkg, NULL, NULL, pctx);
+ }
+ }
}
static void print_not_deleted_name(struct apk_database *db, const char *match,
@@ -111,6 +119,7 @@ static void delete_name(struct apk_database *db, const char *match,
struct apk_package *pkg;
if (!name) {
+ apk_error("No such package: %s", match);
ctx->errors++;
return;
}