From e0f9b0897be8e5524eaeef302249c90498d3218a Mon Sep 17 00:00:00 2001 From: Timo Teräs Date: Mon, 6 Oct 2014 16:30:09 +0300 Subject: 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. --- src/solver.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/solver.c b/src/solver.c index 59edb1c..d83bb6a 100644 --- a/src/solver.c +++ b/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) { struct apk_name **pname; - struct apk_package *pkg = name->ss.chosen.pkg, *opkg; + struct apk_package *pkg, *opkg; 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; + } + if (pkg->ss.in_changeset) return; pkg->ss.in_changeset = 1; pkg->name->ss.in_changeset = 1; -- cgit v1.2.3-70-g09d2