diff options
-rw-r--r-- | src/apk_database.h | 1 | ||||
-rw-r--r-- | src/solver.c | 4 | ||||
-rw-r--r-- | test/basic17.installed | 13 | ||||
-rw-r--r-- | test/basic17.repo | 26 | ||||
-rw-r--r-- | test/basic17.test | 9 | ||||
-rw-r--r-- | test/basic18.test | 9 |
6 files changed, 62 insertions, 0 deletions
diff --git a/src/apk_database.h b/src/apk_database.h index 917ee35..1947df0 100644 --- a/src/apk_database.h +++ b/src/apk_database.h @@ -101,6 +101,7 @@ struct apk_name { unsigned is_dependency : 1; unsigned auto_select_virtual: 1; unsigned priority : 2; + unsigned solver_flags_set : 1; unsigned int foreach_genid; union { struct apk_solver_name_state ss; diff --git a/src/solver.c b/src/solver.c index 2548de7..8021df2 100644 --- a/src/solver.c +++ b/src/solver.c @@ -51,6 +51,7 @@ void apk_solver_set_name_flags(struct apk_name *name, { struct apk_provider *p; + name->solver_flags_set = 1; foreach_array_item(p, name->providers) { struct apk_package *pkg = p->pkg; dbg_printf("marking '" PKG_VER_FMT "' = 0x%04x / 0x%04x\n", @@ -1030,6 +1031,9 @@ static int compare_name_dequeue(const struct apk_name *a, const struct apk_name { int r; + r = !!(a->solver_flags_set) - !!(b->solver_flags_set); + if (r) return -r; + r = (int)a->priority - (int)b->priority; if (r) return r; diff --git a/test/basic17.installed b/test/basic17.installed new file mode 100644 index 0000000..ce66f47 --- /dev/null +++ b/test/basic17.installed @@ -0,0 +1,13 @@ +C:Q1EyN5AdpAOBJWKMR89pp/C66o+OE= +P:a +V:1 +S:1 +I:1 +D:b=1 + +C:Q1C4uoV7SdMdDhYg4OCVmI71D8HIA= +P:b +V:1 +S:1 +I:1 + diff --git a/test/basic17.repo b/test/basic17.repo new file mode 100644 index 0000000..cac8d9e --- /dev/null +++ b/test/basic17.repo @@ -0,0 +1,26 @@ +C:Q1EyN5AdpAOBJWKMR89pp/C66o+OE= +P:a +V:1 +S:1 +I:1 +D:b=1 + +C:Q1eVpkasfqZAukAXFYbgwt4xAMZWU= +P:a +V:2 +S:1 +I:1 +D:b=2 + +C:Q1C4uoV7SdMdDhYg4OCVmI71D8HIA= +P:b +V:1 +S:1 +I:1 + +C:Q1hdUpqRv5mYgJEqW52UmVsvmyysE= +P:b +V:2 +S:1 +I:1 + diff --git a/test/basic17.test b/test/basic17.test new file mode 100644 index 0000000..3d0b7fc --- /dev/null +++ b/test/basic17.test @@ -0,0 +1,9 @@ +@ARGS +--test-repo basic17.repo +--test-instdb basic17.installed +--test-world b +add --upgrade a +@EXPECT +(1/2) Upgrading b (1 -> 2) +(2/2) Upgrading a (1 -> 2) +OK: 0 MiB in 2 packages diff --git a/test/basic18.test b/test/basic18.test new file mode 100644 index 0000000..ff8d6b8 --- /dev/null +++ b/test/basic18.test @@ -0,0 +1,9 @@ +@ARGS +--test-repo basic17.repo +--test-instdb basic17.installed +--test-world a +add --latest b +@EXPECT +(1/2) Upgrading b (1 -> 2) +(2/2) Upgrading a (1 -> 2) +OK: 0 MiB in 2 packages |