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.
cute-signatures
Timo Teräs 2014-05-19 08:49:55 +03:00
parent 1e36692a8a
commit 2c4f6bb503
2 changed files with 10 additions and 0 deletions

View File

@ -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)

7
test/basic15.test Normal file
View File

@ -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