solver, errors: fix few additional test cases and clean ups

cute-signatures
Timo Teräs 2013-06-13 21:58:54 +03:00
parent 2ff59b7c23
commit 59d15ab259
6 changed files with 25 additions and 25 deletions

View File

@ -470,8 +470,8 @@ 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, ps->match, pkg, print_dep, ps);
apk_pkg_foreach_reverse_dependency(pkg, ps->match, print_dep, ps);
apk_pkg_foreach_matching_dependency(NULL, ps->world, match, pkg, print_dep, ps);
apk_pkg_foreach_reverse_dependency(pkg, match, print_dep, ps);
label_end(ps);
}

View File

@ -496,25 +496,25 @@ static struct apk_db_file *apk_db_file_get(struct apk_database *db,
static void apk_db_pkg_rdepends(struct apk_database *db, struct apk_package *pkg)
{
int i, j;
struct apk_name *rname;
struct apk_name *rname, **rd;
struct apk_dependency *d;
for (i = 0; i < pkg->depends->num; i++) {
rname = pkg->depends->item[i].name;
for (j = 0; j < rname->rdepends->num; j++)
if (rname->rdepends->item[j] == pkg->name)
foreach_array_item(d, pkg->depends) {
rname = d->name;
foreach_array_item(rd, rname->rdepends)
if (*rd == pkg->name)
goto rdeps_done;
*apk_name_array_add(&rname->rdepends) = pkg->name;
rdeps_done: ;
}
rdeps_done:
for (i = 0; i < pkg->install_if->num; i++) {
rname = pkg->install_if->item[i].name;
for (j = 0; j < rname->rinstall_if->num; j++)
if (rname->rinstall_if->item[j] == pkg->name)
foreach_array_item(d, pkg->install_if) {
rname = d->name;
foreach_array_item(rd, rname->rinstall_if)
if (*rd == pkg->name)
goto riif_done;
*apk_name_array_add(&rname->rinstall_if) = pkg->name;
riif_done: ;
}
riif_done:
return;
}

View File

@ -401,7 +401,8 @@ int apk_dep_is_materialized_or_provided(struct apk_dependency *dep, struct apk_p
int apk_dep_analyze(struct apk_dependency *dep, struct apk_package *pkg)
{
int i;
struct apk_dependency *p;
struct apk_provider provider;
if (pkg == NULL)
return APK_DEP_IRRELEVANT;
@ -409,14 +410,11 @@ int apk_dep_analyze(struct apk_dependency *dep, struct apk_package *pkg)
if (dep->name == pkg->name)
return apk_dep_is_materialized(dep, pkg) ? APK_DEP_SATISFIES : APK_DEP_CONFLICTS;
for (i = 0; i < pkg->provides->num; i++) {
struct apk_provider p;
if (pkg->provides->item[i].name != dep->name)
foreach_array_item(p, pkg->provides) {
if (p->name != dep->name)
continue;
p = APK_PROVIDER_FROM_PROVIDES(pkg, &pkg->provides->item[i]);
return apk_dep_is_provided(dep, &p) ? APK_DEP_SATISFIES : APK_DEP_CONFLICTS;
provider = APK_PROVIDER_FROM_PROVIDES(pkg, p);
return apk_dep_is_provided(dep, &provider) ? APK_DEP_SATISFIES : APK_DEP_CONFLICTS;
}
return APK_DEP_IRRELEVANT;

View File

@ -5,4 +5,4 @@ add a d>1.5
ERROR: unsatisfiable constraints:
d-2.0:
breaks: b-1[d<2.0]
satisfies: world[d>1.5] c-1[d>1.0]
satisfies: world[d>1.5] a-3[d>1.5] c-1[d>1.0]

View File

@ -5,7 +5,7 @@ add a !b
ERROR: unsatisfiable constraints:
d-2.0:
breaks: b-1[d<2.0]
satisfies: c-1[d>1.0]
satisfies: a-3[d>1.5] c-1[d>1.0]
b-1:
breaks: world[!b]
satisfies: a-3[b]

View File

@ -3,4 +3,6 @@
add a>2
@EXPECT
ERROR: unsatisfiable constraints:
b-1: d<2.0
d-1.5:
breaks: a-3[d>1.5]
satisfies: b-1[d<2.0] c-1[d>1.0]