diff options
-rw-r--r-- | src/apk_package.h | 1 | ||||
-rw-r--r-- | src/commit.c | 18 | ||||
-rw-r--r-- | src/package.c | 12 |
3 files changed, 20 insertions, 11 deletions
diff --git a/src/apk_package.h b/src/apk_package.h index 1b0e2cf..ab7ab02 100644 --- a/src/apk_package.h +++ b/src/apk_package.h @@ -43,6 +43,7 @@ struct apk_provider; #define APK_FOREACH_INSTALLED 0x10 #define APK_FOREACH_MARKED 0x20 #define APK_FOREACH_NULL_MATCHES_ALL 0x40 +#define APK_FOREACH_DEP 0x80 #define APK_FOREACH_GENID_MASK 0xffffff00 struct apk_sign_ctx { diff --git a/src/commit.c b/src/commit.c index 4b9ea11..deb38de 100644 --- a/src/commit.c +++ b/src/commit.c @@ -401,6 +401,7 @@ static void print_conflicts(struct print_state *ps, struct apk_package *pkg) struct apk_provider *p; struct apk_dependency *d; char tmp[256]; + int once; foreach_array_item(p, pkg->name->providers) { if (p->pkg == pkg || !p->pkg->marked) @@ -409,11 +410,17 @@ static void print_conflicts(struct print_state *ps, struct apk_package *pkg) apk_print_indented_fmt(&ps->i, PKG_VER_FMT, PKG_VER_PRINTF(p->pkg)); } foreach_array_item(d, pkg->provides) { + once = 1; foreach_array_item(p, d->name->providers) { if (!p->pkg->marked) continue; - if (p->pkg == pkg && p->version == d->version) + if (d->version == &apk_null_blob && + p->version == &apk_null_blob) continue; + if (once && p->pkg == pkg) { + once = 0; + continue; + } label_start(ps, "conflicts:"); apk_print_indented_fmt( &ps->i, PKG_VER_FMT "[%s]", @@ -442,8 +449,9 @@ static void print_dep(struct apk_package *pkg0, struct apk_dependency *d0, struc static void print_deps(struct print_state *ps, struct apk_package *pkg, int match) { ps->match = match; - apk_pkg_foreach_matching_dependency(NULL, ps->world, match, pkg, print_dep, ps); - apk_pkg_foreach_reverse_dependency(pkg, match, print_dep, ps); + match |= APK_FOREACH_MARKED | APK_FOREACH_DEP; + apk_pkg_foreach_matching_dependency(NULL, ps->world, match|apk_foreach_genid(), pkg, print_dep, ps); + apk_pkg_foreach_reverse_dependency(pkg, match|apk_foreach_genid(), print_dep, ps); label_end(ps); } @@ -456,9 +464,9 @@ static void analyze_package(struct print_state *ps, struct apk_package *pkg, uns print_pinning_errors(ps, pkg, tag); print_conflicts(ps, pkg); - print_deps(ps, pkg, APK_DEP_CONFLICTS | APK_FOREACH_MARKED); + print_deps(ps, pkg, APK_DEP_CONFLICTS); if (ps->label == NULL) - print_deps(ps, pkg, APK_DEP_SATISFIES | APK_FOREACH_MARKED); + print_deps(ps, pkg, APK_DEP_SATISFIES); } static void analyze_name(struct print_state *ps, struct apk_name *name) diff --git a/src/package.c b/src/package.c index 32b218a..d6eff07 100644 --- a/src/package.c +++ b/src/package.c @@ -1171,6 +1171,7 @@ void apk_pkg_foreach_matching_dependency( void *ctx) { unsigned int genid = match & APK_FOREACH_GENID_MASK; + unsigned int one_dep_only = genid && !(match & APK_FOREACH_DEP); struct apk_dependency *d; if (pkg && genid) { @@ -1182,8 +1183,7 @@ void apk_pkg_foreach_matching_dependency( foreach_array_item(d, deps) { if (apk_dep_analyze(d, mpkg) & match) { cb(pkg, d, mpkg, ctx); - if (genid) - break; + if (one_dep_only) break; } } } @@ -1195,9 +1195,10 @@ static void foreach_reverse_dependency( void cb(struct apk_package *pkg0, struct apk_dependency *dep0, struct apk_package *pkg, void *ctx), void *ctx) { - unsigned int installed = match & APK_FOREACH_INSTALLED; - unsigned int marked = match & APK_FOREACH_MARKED; unsigned int genid = match & APK_FOREACH_GENID_MASK; + unsigned int marked = match & APK_FOREACH_MARKED; + unsigned int installed = match & APK_FOREACH_INSTALLED; + unsigned int one_dep_only = genid && !(match & APK_FOREACH_DEP); struct apk_name **pname0, *name0; struct apk_provider *p0; struct apk_package *pkg0; @@ -1219,8 +1220,7 @@ static void foreach_reverse_dependency( foreach_array_item(d0, pkg0->depends) { if (apk_dep_analyze(d0, pkg) & match) { cb(pkg0, d0, pkg, ctx); - if (genid) - break; + if (one_dep_only) break; } } } |