del: report non-matching names and install-if rule non-deletion
parent
7af5384db7
commit
90fc52e2b8
|
@ -193,6 +193,7 @@ int apk_pkg_write_index_entry(struct apk_package *pkg, struct apk_ostream *os);
|
||||||
int apk_pkg_version_compare(struct apk_package *a, struct apk_package *b);
|
int apk_pkg_version_compare(struct apk_package *a, struct apk_package *b);
|
||||||
|
|
||||||
unsigned int apk_foreach_genid(void);
|
unsigned int apk_foreach_genid(void);
|
||||||
|
int apk_pkg_match_genid(struct apk_package *pkg, unsigned int match);
|
||||||
void apk_pkg_foreach_matching_dependency(
|
void apk_pkg_foreach_matching_dependency(
|
||||||
struct apk_package *pkg, struct apk_dependency_array *deps,
|
struct apk_package *pkg, struct apk_dependency_array *deps,
|
||||||
unsigned int match, struct apk_package *mpkg,
|
unsigned int match, struct apk_package *mpkg,
|
||||||
|
|
17
src/del.c
17
src/del.c
|
@ -58,10 +58,10 @@ static void print_not_deleted_pkg(struct apk_package *pkg0, struct apk_dependenc
|
||||||
struct apk_package *pkg, void *pctx)
|
struct apk_package *pkg, void *pctx)
|
||||||
{
|
{
|
||||||
struct not_deleted_ctx *ctx = (struct not_deleted_ctx *) pctx;
|
struct not_deleted_ctx *ctx = (struct not_deleted_ctx *) pctx;
|
||||||
|
struct apk_dependency *d;
|
||||||
|
struct apk_provider *p;
|
||||||
|
|
||||||
if (pkg0->name == ctx->name)
|
if (pkg0->name != ctx->name) {
|
||||||
goto no_print;
|
|
||||||
|
|
||||||
if (!ctx->header) {
|
if (!ctx->header) {
|
||||||
apk_message("World updated, but the following packages are not removed due to:");
|
apk_message("World updated, but the following packages are not removed due to:");
|
||||||
ctx->header = 1;
|
ctx->header = 1;
|
||||||
|
@ -72,8 +72,16 @@ static void print_not_deleted_pkg(struct apk_package *pkg0, struct apk_dependenc
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
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,
|
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;
|
struct apk_package *pkg;
|
||||||
|
|
||||||
if (!name) {
|
if (!name) {
|
||||||
|
apk_error("No such package: %s", match);
|
||||||
ctx->errors++;
|
ctx->errors++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1168,21 +1168,27 @@ unsigned int apk_foreach_genid(void)
|
||||||
return foreach_genid;
|
return foreach_genid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int apk_pkg_match_genid(struct apk_package *pkg, unsigned int match)
|
||||||
|
{
|
||||||
|
unsigned int genid = match & APK_FOREACH_GENID_MASK;
|
||||||
|
if (pkg && genid) {
|
||||||
|
if (pkg->foreach_genid >= genid)
|
||||||
|
return 1;
|
||||||
|
pkg->foreach_genid = genid;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void apk_pkg_foreach_matching_dependency(
|
void apk_pkg_foreach_matching_dependency(
|
||||||
struct apk_package *pkg, struct apk_dependency_array *deps,
|
struct apk_package *pkg, struct apk_dependency_array *deps,
|
||||||
unsigned int match, struct apk_package *mpkg,
|
unsigned int match, struct apk_package *mpkg,
|
||||||
void cb(struct apk_package *pkg0, struct apk_dependency *dep0, struct apk_package *pkg, void *ctx),
|
void cb(struct apk_package *pkg0, struct apk_dependency *dep0, struct apk_package *pkg, void *ctx),
|
||||||
void *ctx)
|
void *ctx)
|
||||||
{
|
{
|
||||||
unsigned int genid = match & APK_FOREACH_GENID_MASK;
|
unsigned int one_dep_only = (match & APK_FOREACH_GENID_MASK) && !(match & APK_FOREACH_DEP);
|
||||||
unsigned int one_dep_only = genid && !(match & APK_FOREACH_DEP);
|
|
||||||
struct apk_dependency *d;
|
struct apk_dependency *d;
|
||||||
|
|
||||||
if (pkg && genid) {
|
if (apk_pkg_match_genid(pkg, match)) return;
|
||||||
if (pkg->foreach_genid >= genid)
|
|
||||||
return;
|
|
||||||
pkg->foreach_genid = genid;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach_array_item(d, deps) {
|
foreach_array_item(d, deps) {
|
||||||
if (apk_dep_analyze(d, mpkg) & match) {
|
if (apk_dep_analyze(d, mpkg) & match) {
|
||||||
|
@ -1199,10 +1205,9 @@ static void foreach_reverse_dependency(
|
||||||
void cb(struct apk_package *pkg0, struct apk_dependency *dep0, struct apk_package *pkg, void *ctx),
|
void cb(struct apk_package *pkg0, struct apk_dependency *dep0, struct apk_package *pkg, void *ctx),
|
||||||
void *ctx)
|
void *ctx)
|
||||||
{
|
{
|
||||||
unsigned int genid = match & APK_FOREACH_GENID_MASK;
|
|
||||||
unsigned int marked = match & APK_FOREACH_MARKED;
|
unsigned int marked = match & APK_FOREACH_MARKED;
|
||||||
unsigned int installed = match & APK_FOREACH_INSTALLED;
|
unsigned int installed = match & APK_FOREACH_INSTALLED;
|
||||||
unsigned int one_dep_only = genid && !(match & APK_FOREACH_DEP);
|
unsigned int one_dep_only = (match & APK_FOREACH_GENID_MASK) && !(match & APK_FOREACH_DEP);
|
||||||
struct apk_name **pname0, *name0;
|
struct apk_name **pname0, *name0;
|
||||||
struct apk_provider *p0;
|
struct apk_provider *p0;
|
||||||
struct apk_package *pkg0;
|
struct apk_package *pkg0;
|
||||||
|
@ -1212,15 +1217,9 @@ static void foreach_reverse_dependency(
|
||||||
name0 = *pname0;
|
name0 = *pname0;
|
||||||
foreach_array_item(p0, name0->providers) {
|
foreach_array_item(p0, name0->providers) {
|
||||||
pkg0 = p0->pkg;
|
pkg0 = p0->pkg;
|
||||||
if (installed && pkg0->ipkg == NULL)
|
if (installed && pkg0->ipkg == NULL) continue;
|
||||||
continue;
|
if (marked && !pkg0->marked) continue;
|
||||||
if (marked && !pkg0->marked)
|
if (apk_pkg_match_genid(pkg0, match)) continue;
|
||||||
continue;
|
|
||||||
if (genid) {
|
|
||||||
if (pkg0->foreach_genid >= genid)
|
|
||||||
continue;
|
|
||||||
pkg0->foreach_genid = genid;
|
|
||||||
}
|
|
||||||
foreach_array_item(d0, pkg0->depends) {
|
foreach_array_item(d0, pkg0->depends) {
|
||||||
if (apk_dep_analyze(d0, pkg) & match) {
|
if (apk_dep_analyze(d0, pkg) & match) {
|
||||||
cb(pkg0, d0, pkg, ctx);
|
cb(pkg0, d0, pkg, ctx);
|
||||||
|
|
Loading…
Reference in New Issue