diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2020-11-27 14:49:28 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2020-11-27 14:49:28 +0900 |
commit | 2792a56227313bb9f16bd70604e79f47e9650885 (patch) | |
tree | 85754605f94cb80db83190caa787a8fbff433daa /src | |
parent | e0e41666c5a48c53ab30c943f2b0964a3600eadd (diff) | |
download | libsolv-2792a56227313bb9f16bd70604e79f47e9650885.tar.gz libsolv-2792a56227313bb9f16bd70604e79f47e9650885.tar.bz2 libsolv-2792a56227313bb9f16bd70604e79f47e9650885.zip |
Imported Upstream version 0.7.14upstream/0.7.14
Diffstat (limited to 'src')
-rw-r--r-- | src/policy.c | 17 | ||||
-rw-r--r-- | src/problems.c | 25 | ||||
-rw-r--r-- | src/rules.c | 14 |
3 files changed, 42 insertions, 14 deletions
diff --git a/src/policy.c b/src/policy.c index fe8d55e..6551cbf 100644 --- a/src/policy.c +++ b/src/policy.c @@ -833,6 +833,7 @@ move_installed_to_front(Pool *pool, Queue *plist) } } +#ifdef ENABLE_CONDA static int pool_buildversioncmp(Pool *pool, Solvable *s1, Solvable *s2) { @@ -858,6 +859,7 @@ pool_buildflavorcmp(Pool *pool, Solvable *s1, Solvable *s2) return 0; return pool_evrcmp_str(pool, f1 ? f1 : "" , f2 ? f2 : "", EVRCMP_COMPARE); } +#endif /* * prune_to_best_version @@ -906,10 +908,17 @@ prune_to_best_version(Pool *pool, Queue *plist) if (r == 0 && has_package_link(pool, s)) r = pool_link_evrcmp(pool, best, s); #endif - if (r == 0 && pool->disttype == DISTTYPE_CONDA) - r = pool_buildversioncmp(pool, best, s); - if (r == 0 && pool->disttype == DISTTYPE_CONDA) - r = pool_buildflavorcmp(pool, best, s); +#ifdef ENABLE_CONDA + if (pool->disttype == DISTTYPE_CONDA) + { + if (r == 0) + r = (best->repo ? best->repo->subpriority : 0) - (s->repo ? s->repo->subpriority : 0); + if (r == 0) + r = pool_buildversioncmp(pool, best, s); + if (r == 0) + r = pool_buildflavorcmp(pool, best, s); + } +#endif if (r < 0) best = s; } diff --git a/src/problems.c b/src/problems.c index 63165f3..a6b9394 100644 --- a/src/problems.c +++ b/src/problems.c @@ -1068,10 +1068,10 @@ solver_take_solution(Solver *solv, Id problem, Id solution, Queue *job) */ static void -findproblemrule_internal(Solver *solv, Id idx, Id *reqrp, Id *conrp, Id *sysrp, Id *jobrp, Map *rseen) +findproblemrule_internal(Solver *solv, Id idx, Id *reqrp, Id *conrp, Id *sysrp, Id *jobrp, Id *blkrp, Map *rseen) { Id rid, d; - Id lreqr, lconr, lsysr, ljobr; + Id lreqr, lconr, lsysr, ljobr, lblkr; Rule *r; Id jobassert = 0; int i, reqset = 0; /* 0: unset, 1: installed, 2: jobassert, 3: assert */ @@ -1093,7 +1093,7 @@ findproblemrule_internal(Solver *solv, Id idx, Id *reqrp, Id *conrp, Id *sysrp, /* the problem rules are somewhat ordered from "near to the problem" to * "near to the job" */ - lreqr = lconr = lsysr = ljobr = 0; + lreqr = lconr = lsysr = ljobr = lblkr = 0; while ((rid = solv->learnt_pool.elements[idx++]) != 0) { assert(rid > 0); @@ -1102,9 +1102,9 @@ findproblemrule_internal(Solver *solv, Id idx, Id *reqrp, Id *conrp, Id *sysrp, if (MAPTST(rseen, rid - solv->learntrules)) continue; MAPSET(rseen, rid - solv->learntrules); - findproblemrule_internal(solv, solv->learnt_why.elements[rid - solv->learntrules], &lreqr, &lconr, &lsysr, &ljobr, rseen); + findproblemrule_internal(solv, solv->learnt_why.elements[rid - solv->learntrules], &lreqr, &lconr, &lsysr, &ljobr, &lblkr, rseen); } - else if ((rid >= solv->jobrules && rid < solv->jobrules_end) || (rid >= solv->infarchrules && rid < solv->infarchrules_end) || (rid >= solv->duprules && rid < solv->duprules_end) || (rid >= solv->bestrules && rid < solv->bestrules_end) || (rid >= solv->yumobsrules && rid <= solv->yumobsrules_end)) + else if ((rid >= solv->jobrules && rid < solv->jobrules_end) || (rid >= solv->infarchrules && rid < solv->infarchrules_end) || (rid >= solv->duprules && rid < solv->duprules_end) || (rid >= solv->bestrules && rid < solv->bestrules_end) || (rid >= solv->yumobsrules && rid < solv->yumobsrules_end)) { if (!*jobrp) *jobrp = rid; @@ -1114,6 +1114,11 @@ findproblemrule_internal(Solver *solv, Id idx, Id *reqrp, Id *conrp, Id *sysrp, if (!*sysrp) *sysrp = rid; } + else if (rid >= solv->blackrules && rid < solv->blackrules_end) + { + if (!*blkrp) + *blkrp = rid; + } else { assert(rid < solv->pkgrules_end); @@ -1176,6 +1181,8 @@ findproblemrule_internal(Solver *solv, Id idx, Id *reqrp, Id *conrp, Id *sysrp, *jobrp = ljobr; if (!*sysrp && lsysr) *sysrp = lsysr; + if (!*blkrp && lblkr) + *blkrp = lblkr; } /* @@ -1190,12 +1197,12 @@ findproblemrule_internal(Solver *solv, Id idx, Id *reqrp, Id *conrp, Id *sysrp, Id solver_findproblemrule(Solver *solv, Id problem) { - Id reqr, conr, sysr, jobr; + Id reqr, conr, sysr, jobr, blkr; Id idx = solv->problems.elements[2 * problem - 2]; Map rseen; - reqr = conr = sysr = jobr = 0; + reqr = conr = sysr = jobr = blkr = 0; map_init(&rseen, solv->learntrules ? solv->nrules - solv->learntrules : 0); - findproblemrule_internal(solv, idx, &reqr, &conr, &sysr, &jobr, &rseen); + findproblemrule_internal(solv, idx, &reqr, &conr, &sysr, &jobr, &blkr, &rseen); map_free(&rseen); /* check if the request is about a not-installed package requiring a installed * package conflicting with the non-installed package. In that case return the conflict */ @@ -1223,6 +1230,8 @@ solver_findproblemrule(Solver *solv, Id problem) return reqr; /* some requires */ if (conr) return conr; /* some conflict */ + if (blkr) + return blkr; /* a blacklisted package */ if (sysr) return sysr; /* an update rule */ if (jobr) diff --git a/src/rules.c b/src/rules.c index 6b1432f..ffa2988 100644 --- a/src/rules.c +++ b/src/rules.c @@ -3210,7 +3210,7 @@ solver_addchoicerules(Solver *solv) Map m, mneg; Rule *r; Queue q, qi, qcheck, infoq; - int i, j, rid, havechoice; + int i, j, rid, havechoice, negcnt; Id p, d, pp; Id p2, pp2; Solvable *s, *s2; @@ -3389,9 +3389,12 @@ solver_addchoicerules(Solver *solv) qi.elements[j] = 0; } /* empty map again */ + negcnt = 0; FOR_RULELITERALS(p, pp, r) if (p > 0) MAPCLR(&m, p); + else + negcnt++; if (i == qi.count) { #if 0 @@ -3400,7 +3403,14 @@ solver_addchoicerules(Solver *solv) #endif continue; } - + /* add neg elements to the front */ + if (negcnt > 1) + { + i = 0; + FOR_RULELITERALS(p, pp, r) + if (p < 0 && p != r->p) + queue_insert(&q, i++, p); + } /* don't add identical rules */ if (lastaddedp == r->p && lastaddedcnt == q.count) { |