Skip to content

Commit 958c839

Browse files
committed
Further extend choicerule filtering check
Also add testcases. Fixes issue #406. This is getting quite complicated...
1 parent 054818c commit 958c839

3 files changed

Lines changed: 87 additions & 0 deletions

File tree

src/rules.c

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3225,6 +3225,40 @@ solver_choicerulecheck2(Solver *solv, Id pi, Id pt, Queue *q)
32253225
return 0; /* not newest */
32263226
}
32273227

3228+
static int
3229+
solver_choicerulecheck3(Solver *solv, Id pt, Queue *q)
3230+
{
3231+
Pool *pool = solv->pool;
3232+
Id p, pp;
3233+
int i;
3234+
3235+
if (!q->count || q->elements[0] != pt)
3236+
{
3237+
Solvable *s = pool->solvables + pt;
3238+
if (q->count)
3239+
queue_empty(q);
3240+
/* no installed package, so check all with same name */
3241+
queue_push2(q, pt, 0);
3242+
FOR_PROVIDES(p, pp, s->name)
3243+
if (pool->solvables[p].name == s->name && p != pt)
3244+
queue_push(q, p);
3245+
queue_push(q, pt);
3246+
}
3247+
if (q->count <= 3)
3248+
return q->count == 3 && q->elements[2] == pt ? 1 : 0;
3249+
if (!q->elements[1])
3250+
{
3251+
queue_deleten(q, 0, 2);
3252+
policy_filter_unwanted(solv, q, POLICY_MODE_CHOOSE);
3253+
queue_unshift(q, 1); /* filter mark */
3254+
queue_unshift(q, pt);
3255+
}
3256+
for (i = 2; i < q->count; i++)
3257+
if (q->elements[i] == pt)
3258+
return 1;
3259+
return 0; /* not newest */
3260+
}
3261+
32283262
static inline void
32293263
queue_removeelement(Queue *q, Id el)
32303264
{
@@ -3381,6 +3415,11 @@ solver_addchoicerules(Solver *solv)
33813415
isnewest = 0;
33823416
break;
33833417
}
3418+
if (!p2 && !solver_choicerulecheck3(solv, -p, &qcheck2))
3419+
{
3420+
isnewest = 0;
3421+
break;
3422+
}
33843423
}
33853424
/* do extra checking */
33863425
for (i = j = 0; i < qi.count; i += 2)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
repo system 0 testtags <inline>
2+
#>=Pkg: A 1 1 noarch
3+
#>=Prv: libA
4+
#>=Pkg: B 1 1 noarch
5+
#>=Req: libA
6+
repo available 0 testtags <inline>
7+
#>=Pkg: B 1 1 noarch
8+
#>=Req: libA
9+
#>=Pkg: A 2 1 noarch
10+
#>=Pkg: Anew 2 1 noarch
11+
#>=Prv: libA
12+
system i686 rpm system
13+
14+
job update all packages
15+
result transaction,problems <inline>
16+
#>install Anew-2-1.noarch@available
17+
#>upgrade A-1-1.noarch@system A-2-1.noarch@available
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
repo system 0 testtags <inline>
2+
#>=Pkg: A 1 1 noarch
3+
#>=Prv: libA = 1-1
4+
repo available 0 testtags <inline>
5+
#>=Pkg: A 1 1 noarch
6+
#>=Prv: libA = 1-1
7+
#>=Pkg: Anew 1 1 noarch
8+
#>=Prv: libA = 1-1
9+
#>=Pkg: B 1 1 noarch
10+
#>=Req: libA = 1-1
11+
#>=Pkg: A 2 1 noarch
12+
#>=Prv: libA = 2-1
13+
#>=Pkg: Anew 2 1 noarch
14+
#>=Prv: libA = 2-1
15+
#>=Pkg: B 2 1 noarch
16+
#>=Req: libA = 2-1
17+
#>=Pkg: A 2 2 noarch
18+
#>=Prv: libA = 2-2
19+
#>=Pkg: Anew 2 2 noarch
20+
#>=Prv: libA = 2-2
21+
#>=Pkg: B 2 2 noarch
22+
#>=Req: libA = 2-2
23+
#>=Pkg: C 2 1 noarch
24+
#>=Req: B = 2
25+
system i686 rpm system
26+
27+
job install name C
28+
result transaction,problems <inline>
29+
#>install B-2-2.noarch@available
30+
#>install C-2-1.noarch@available
31+
#>upgrade A-1-1.noarch@system A-2-2.noarch@available

0 commit comments

Comments
 (0)