solver: enforce conflicts during upgrades and new pkg installs
This makes sure any conflicted packages will be removed first. Useful if we know there are conflicting files, and want to avoid adding potentially harmful replaces line. Add a test case for this too.cute-signatures
parent
f2d9a14405
commit
e0f9b0897b
13
src/solver.c
13
src/solver.c
|
@ -762,11 +762,20 @@ static void cset_check_removal_by_iif(struct apk_solver_state *ss, struct apk_na
|
||||||
static void cset_gen_name_change(struct apk_solver_state *ss, struct apk_name *name)
|
static void cset_gen_name_change(struct apk_solver_state *ss, struct apk_name *name)
|
||||||
{
|
{
|
||||||
struct apk_name **pname;
|
struct apk_name **pname;
|
||||||
struct apk_package *pkg = name->ss.chosen.pkg, *opkg;
|
struct apk_package *pkg, *opkg;
|
||||||
struct apk_dependency *d;
|
struct apk_dependency *d;
|
||||||
|
|
||||||
if (pkg == NULL || pkg->ss.in_changeset)
|
if (name->ss.in_changeset) return;
|
||||||
|
|
||||||
|
pkg = name->ss.chosen.pkg;
|
||||||
|
if (pkg == NULL) {
|
||||||
|
/* Package removal */
|
||||||
|
opkg = name->ss.installed_pkg;
|
||||||
|
if (opkg) cset_gen_name_remove(ss, opkg);
|
||||||
|
name->ss.in_changeset = 1;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
if (pkg->ss.in_changeset) return;
|
||||||
|
|
||||||
pkg->ss.in_changeset = 1;
|
pkg->ss.in_changeset = 1;
|
||||||
pkg->name->ss.in_changeset = 1;
|
pkg->name->ss.in_changeset = 1;
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
C:Q1EyN5AdpAOBJWKMR89pp/C66o+OE=
|
||||||
|
P:libold
|
||||||
|
V:1
|
||||||
|
S:1
|
||||||
|
I:1
|
||||||
|
|
||||||
|
C:Q1eVpkasfqZAukAXFYbgwt4xAEEEe=
|
||||||
|
P:app
|
||||||
|
V:1
|
||||||
|
S:1
|
||||||
|
I:1
|
||||||
|
D:libold
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
C:Q1EyN5AdpAOBJWKMR89pp/C66o+OE=
|
||||||
|
P:libold
|
||||||
|
V:1
|
||||||
|
S:1
|
||||||
|
I:1
|
||||||
|
|
||||||
|
C:Q1EyN5AdpAOBJWKMR89pp/C66o+FE=
|
||||||
|
P:libnew
|
||||||
|
V:1
|
||||||
|
S:1
|
||||||
|
I:1
|
||||||
|
D:!libold
|
||||||
|
|
||||||
|
C:Q1eVpkasfqZAukAXFYbgwt4xAEEEe=
|
||||||
|
P:app
|
||||||
|
V:1
|
||||||
|
S:1
|
||||||
|
I:1
|
||||||
|
D:libold
|
||||||
|
|
||||||
|
C:Q1EyN5AdpAOBJWKMR89pp/C77FFFF=
|
||||||
|
P:app
|
||||||
|
V:2
|
||||||
|
S:1
|
||||||
|
I:1
|
||||||
|
D:libnew
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
@ARGS
|
||||||
|
--test-repo upgrade.repo
|
||||||
|
--test-instdb upgrade.installed
|
||||||
|
--test-world app
|
||||||
|
upgrade
|
||||||
|
@EXPECT
|
||||||
|
(1/3) Purging libold (1)
|
||||||
|
(2/3) Installing libnew (1)
|
||||||
|
(3/3) Upgrading app (1 -> 2)
|
||||||
|
OK: 0 MiB in 2 packages
|
Loading…
Reference in New Issue