From: Michael Schroeder Date: Tue, 7 Apr 2015 14:31:10 +0000 (+0200) Subject: Add SOLVER_FLAG_NEED_UPDATEPROVIDE X-Git-Tag: 0.6.11~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5688bb84ee8d4a7e95ef178700bd30f81d36525b;p=thirdparty%2Flibsolv.git Add SOLVER_FLAG_NEED_UPDATEPROVIDE This flag makes the solver only consider packages providing the old package name as update candidates. --- diff --git a/bindings/solv.i b/bindings/solv.i index 50f0b507..40307964 100644 --- a/bindings/solv.i +++ b/bindings/solv.i @@ -2801,6 +2801,7 @@ rb_eval_string( static const int SOLVER_FLAG_BREAK_ORPHANS = SOLVER_FLAG_BREAK_ORPHANS; static const int SOLVER_FLAG_FOCUS_INSTALLED = SOLVER_FLAG_FOCUS_INSTALLED; static const int SOLVER_FLAG_YUM_OBSOLETES = SOLVER_FLAG_YUM_OBSOLETES; + static const int SOLVER_FLAG_NEED_UPDATEPROVIDE = SOLVER_FLAG_NEED_UPDATEPROVIDE; static const int SOLVER_REASON_UNRELATED = SOLVER_REASON_UNRELATED; static const int SOLVER_REASON_UNIT_RULE = SOLVER_REASON_UNIT_RULE; diff --git a/ext/testcase.c b/ext/testcase.c index 14202525..d1c76bed 100644 --- a/ext/testcase.c +++ b/ext/testcase.c @@ -109,6 +109,7 @@ static struct solverflags2str { { SOLVER_FLAG_BREAK_ORPHANS, "breakorphans", 0 }, { SOLVER_FLAG_FOCUS_INSTALLED, "focusinstalled", 0 }, { SOLVER_FLAG_YUM_OBSOLETES, "yumobsoletes", 0 }, + { SOLVER_FLAG_NEED_UPDATEPROVIDE, "needupdateprovide", 0 }, { 0, 0, 0 } }; diff --git a/src/policy.c b/src/policy.c index afdfafd3..773b829a 100644 --- a/src/policy.c +++ b/src/policy.c @@ -1360,7 +1360,7 @@ policy_findupdatepackages(Solver *solv, Solvable *s, Queue *qs, int allow_all) } else if (!allownamechange) continue; - else if (!solv->noupdateprovide && ps->obsoletes) /* provides/obsoletes combination ? */ + else if ((!solv->noupdateprovide || solv->needupdateprovide) && ps->obsoletes) /* provides/obsoletes combination ? */ { /* check if package ps obsoletes installed package s */ /* implicitobsoleteusescolors is somewhat wrong here, but we nevertheless @@ -1400,7 +1400,7 @@ policy_findupdatepackages(Solver *solv, Solvable *s, Queue *qs, int allow_all) return; /* if we have found some valid candidates and noupdateprovide is not set, we're done. otherwise we fallback to all obsoletes */ - if (!solv->noupdateprovide && haveprovobs) + if (solv->needupdateprovide || (!solv->noupdateprovide && haveprovobs)) return; if (solv->obsoletes && solv->obsoletes[n - solv->installed->start]) { diff --git a/src/solver.c b/src/solver.c index 6077f515..53b4bc81 100644 --- a/src/solver.c +++ b/src/solver.c @@ -1764,6 +1764,8 @@ solver_get_flag(Solver *solv, int flag) return solv->focus_installed; case SOLVER_FLAG_YUM_OBSOLETES: return solv->do_yum_obsoletes; + case SOLVER_FLAG_NEED_UPDATEPROVIDE: + return solv->needupdateprovide; default: break; } @@ -1839,6 +1841,9 @@ solver_set_flag(Solver *solv, int flag, int value) case SOLVER_FLAG_YUM_OBSOLETES: solv->do_yum_obsoletes = value; break; + case SOLVER_FLAG_NEED_UPDATEPROVIDE: + solv->needupdateprovide = value; + break; default: break; } diff --git a/src/solver.h b/src/solver.h index c555f16d..1a47ae01 100644 --- a/src/solver.h +++ b/src/solver.h @@ -155,6 +155,7 @@ struct _Solver { int allowvendorchange; /* allow to change vendor of installed solvables */ int allowuninstall; /* allow removal of installed solvables */ int noupdateprovide; /* true: update packages needs not to provide old package */ + int needupdateprovide; /* true: update packages must provide old package */ int dosplitprovides; /* true: consider legacy split provides */ int dontinstallrecommended; /* true: do not install recommended packages */ int addalreadyrecommended; /* true: also install recommended packages that were already recommended by the installed packages */ @@ -295,6 +296,7 @@ typedef struct _Solver Solver; #define SOLVER_FLAG_BREAK_ORPHANS 19 #define SOLVER_FLAG_FOCUS_INSTALLED 20 #define SOLVER_FLAG_YUM_OBSOLETES 21 +#define SOLVER_FLAG_NEED_UPDATEPROVIDE 22 #define GET_USERINSTALLED_NAMES (1 << 0) /* package names instead of ids */ #define GET_USERINSTALLED_INVERTED (1 << 1) /* autoinstalled */