diff options
author | Timo Teräs <timo.teras@iki.fi> | 2014-10-06 16:30:09 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2014-10-06 16:30:09 +0300 |
commit | e0f9b0897be8e5524eaeef302249c90498d3218a (patch) | |
tree | f03e9a8cc201c267ffa2152a78b71638438b84c9 /src/solver.c | |
parent | f2d9a1440546da4fc9302a93370039b3a12c77ce (diff) | |
download | apk-tools-e0f9b0897be8e5524eaeef302249c90498d3218a.tar.gz apk-tools-e0f9b0897be8e5524eaeef302249c90498d3218a.tar.bz2 apk-tools-e0f9b0897be8e5524eaeef302249c90498d3218a.tar.xz apk-tools-e0f9b0897be8e5524eaeef302249c90498d3218a.zip |
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.
Diffstat (limited to 'src/solver.c')
-rw-r--r-- | src/solver.c | 13 |
1 files changed, 11 insertions, 2 deletions
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; |