From ac0c7457c26dd4424ec6282293f3ebbcc1e63886 Mon Sep 17 00:00:00 2001 From: Timo Teräs Date: Fri, 14 Jun 2013 21:37:38 +0300 Subject: errors: detect self-conflicts properly and add the provided version information to the conflicts. fixes the final test case that was broken. hooray. --- src/commit.c | 10 ++++++---- test/provides5.test | 4 ++-- test/provides7.test | 5 +++++ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/commit.c b/src/commit.c index b8bf1a7..c0996f2 100644 --- a/src/commit.c +++ b/src/commit.c @@ -430,6 +430,7 @@ static void print_conflicts(struct print_state *ps, struct apk_package *pkg) { struct apk_provider *p; struct apk_dependency *d; + char tmp[256]; foreach_array_item(p, pkg->name->providers) { if (p->pkg == pkg || !p->pkg->marked) @@ -439,14 +440,15 @@ static void print_conflicts(struct print_state *ps, struct apk_package *pkg) } foreach_array_item(d, pkg->provides) { foreach_array_item(p, d->name->providers) { - if (p->pkg == pkg || !p->pkg->marked) + if (!p->pkg->marked) + continue; + if (p->pkg == pkg && p->version == d->version) continue; label_start(ps, "conflicts:"); apk_print_indented_fmt( - &ps->i, - PKG_VER_FMT "[%s]", + &ps->i, PKG_VER_FMT "[%s]", PKG_VER_PRINTF(p->pkg), - d->name->name); + apk_dep_snprintf(tmp, sizeof(tmp), d)); } } label_end(ps); diff --git a/test/provides5.test b/test/provides5.test index fc21ae2..adcb91a 100644 --- a/test/provides5.test +++ b/test/provides5.test @@ -4,8 +4,8 @@ add server-a server-b @EXPECT ERROR: unsatisfiable constraints: server-a-1: - conflicts: server-b-1[theservice] + conflicts: server-b-1[theservice=1] satisfies: world[server-a] server-b-1: - conflicts: server-a-1[theservice] + conflicts: server-a-1[theservice=2] satisfies: world[server-b] diff --git a/test/provides7.test b/test/provides7.test index a7ac5ed..b654819 100644 --- a/test/provides7.test +++ b/test/provides7.test @@ -2,3 +2,8 @@ --test-repo provides.repo add selfconflicting @EXPECT +ERROR: unsatisfiable constraints: + selfconflicting-1: + conflicts: selfconflicting-1[selfprovided=2] + selfconflicting-1[selfprovided=3] + satisfies: world[selfconflicting] -- cgit v1.2.3-70-g09d2