From 2c4f6bb5031636ccb87c340efd0ad6d24912cab0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Ter=C3=A4s?= Date: Mon, 19 May 2014 08:49:55 +0300 Subject: [PATCH] del: allow deletion of world dependency when it is not installed this happens e.g. after tmpfs boot when not all packages where available: the dependency is in world, but not installed. --- src/del.c | 3 +++ test/basic15.test | 7 +++++++ 2 files changed, 10 insertions(+) create mode 100644 test/basic15.test diff --git a/src/del.c b/src/del.c index 3aef4f7..8cfdfcf 100644 --- a/src/del.c +++ b/src/del.c @@ -95,11 +95,14 @@ static void delete_pkg(struct apk_package *pkg0, struct apk_dependency *dep0, static void delete_name(struct apk_database *db, const char *match, struct apk_name *name, void *pctx) { + struct del_ctx *ctx = (struct del_ctx *) pctx; struct apk_package *pkg; pkg = apk_pkg_get_installed(name); if (pkg != NULL) delete_pkg(pkg, NULL, NULL, pctx); + else + apk_deps_del(&ctx->world, name); } static int del_main(void *pctx, struct apk_database *db, struct apk_string_array *args) diff --git a/test/basic15.test b/test/basic15.test new file mode 100644 index 0000000..382416c --- /dev/null +++ b/test/basic15.test @@ -0,0 +1,7 @@ +@ARGS +--test-repo basic.repo +--test-instdb basic.installed +--test-world "a b c" +del c +@EXPECT +OK: 0 MiB in 2 packages