commit: self-conflict error and satisfies printing

- self-conflicts when the exact same version of a name is provided
  twice is now properly detected and diagnozed
- don't print redundant satisfies diagnostic
cute-signatures
Timo Teräs 2015-12-10 14:30:57 +02:00
parent 8a41fd98a4
commit 2a066169bd
3 changed files with 20 additions and 11 deletions

View File

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

View File

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

View File

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