@@ -845,18 +845,19 @@ static void
845845disable_recommendsrules (Solver * solv , Queue * weakq )
846846{
847847 Pool * pool = solv -> pool ;
848- int i ;
848+ int i , rid ;
849849 for (i = 0 ; i < weakq -> count ; i ++ )
850850 {
851- Rule * r ;
852- if (!queue_contains (solv -> recommendsruleq , weakq -> elements [i ]))
853- continue ;
854- r = solv -> rules + weakq -> elements [i ];
855- if (r -> d >= 0 )
851+ rid = weakq -> elements [i ];
852+ if ((rid >= solv -> recommendsrules && rid < solv -> recommendsrules_end ) || queue_contains (solv -> recommendsruleq , rid ))
856853 {
857- POOL_DEBUG (SOLV_DEBUG_UNSOLVABLE , "disabling " );
858- solver_printruleclass (solv , SOLV_DEBUG_UNSOLVABLE , r );
859- solver_disablerule (solv , r );
854+ Rule * r = solv -> rules + rid ;
855+ if (r -> d >= 0 )
856+ {
857+ POOL_DEBUG (SOLV_DEBUG_UNSOLVABLE , "disabling " );
858+ solver_printruleclass (solv , SOLV_DEBUG_UNSOLVABLE , r );
859+ solver_disablerule (solv , r );
860+ }
860861 }
861862 }
862863}
@@ -904,6 +905,18 @@ disable_weakrules(Solver *solv, Queue *weakq)
904905 for (i = 0 ; i < weakq -> count ; i ++ )
905906 if (weakq -> elements [i ] > lastweak )
906907 lastweak = weakq -> elements [i ];
908+ if (lastweak >= solv -> recommendsrules && lastweak < solv -> recommendsrules_end )
909+ {
910+ lastweak = 0 ;
911+ for (i = 0 ; i < weakq -> count ; i ++ )
912+ if (weakq -> elements [i ] < solv -> recommendsrules && weakq -> elements [i ] > lastweak )
913+ lastweak = weakq -> elements [i ];
914+ if (lastweak < solv -> pkgrules_end )
915+ {
916+ disable_recommendsrules (solv , weakq );
917+ return ;
918+ }
919+ }
907920 if (lastweak < solv -> pkgrules_end && solv -> strongrecommends && solv -> recommendsruleq && queue_contains (solv -> recommendsruleq , lastweak ))
908921 {
909922 disable_recommendsrules (solv , weakq );
@@ -1397,6 +1410,7 @@ solver_free(Solver *solv)
13971410 solv_free (solv -> choicerules_ref );
13981411 solv_free (solv -> bestrules_pkg );
13991412 solv_free (solv -> yumobsrules_info );
1413+ solv_free (solv -> recommendsrules_info );
14001414 solv_free (solv -> instbuddy );
14011415 solv_free (solv );
14021416}
@@ -3129,10 +3143,6 @@ addedmap2deduceq(Solver *solv, Map *addedmap)
31293143 for (; i < pool -> nsolvables ; i ++ )
31303144 if (MAPTST (addedmap , i ))
31313145 queue_push (& solv -> addedmap_deduceq , i );
3132- j = 0 ;
3133- for (i = 2 ; i < pool -> nsolvables ; i ++ )
3134- if (MAPTST (addedmap , i ))
3135- j ++ ;
31363146}
31373147
31383148static void
@@ -3284,6 +3294,7 @@ solver_solve(Solver *solv, Queue *job)
32843294 queue_empty (& solv -> ruleassertions );
32853295 solv -> bestrules_pkg = solv_free (solv -> bestrules_pkg );
32863296 solv -> yumobsrules_info = solv_free (solv -> yumobsrules_info );
3297+ solv -> recommendsrules_info = solv_free (solv -> recommendsrules_info );
32873298 solv -> choicerules_ref = solv_free (solv -> choicerules_ref );
32883299 if (solv -> noupdate .size )
32893300 map_empty (& solv -> noupdate );
@@ -3354,9 +3365,9 @@ solver_solve(Solver *solv, Queue *job)
33543365 */
33553366 initialnrules = solv -> pkgrules_end ? solv -> pkgrules_end : 1 ;
33563367 if (initialnrules > 1 )
3357- deduceq2addedmap (solv , & addedmap );
3368+ deduceq2addedmap (solv , & addedmap ); /* also enables all pkg rules */
33583369 if (solv -> nrules != initialnrules )
3359- solver_shrinkrules (solv , initialnrules );
3370+ solver_shrinkrules (solv , initialnrules ); /* shrink to just pkg rules */
33603371 solv -> lastpkgrule = 0 ;
33613372 solv -> pkgrules_end = 0 ;
33623373
@@ -3908,6 +3919,11 @@ solver_solve(Solver *solv, Queue *job)
39083919 else
39093920 solv -> yumobsrules = solv -> yumobsrules_end = solv -> nrules ;
39103921
3922+ if (solv -> havedisfavored && solv -> strongrecommends )
3923+ solver_addrecommendsrules (solv );
3924+ else
3925+ solv -> recommendsrules = solv -> recommendsrules_end = solv -> nrules ;
3926+
39113927 if (1 )
39123928 solver_addchoicerules (solv );
39133929 else
@@ -4777,6 +4793,8 @@ solver_alternative2str(Solver *solv, int type, Id id, Id from)
47774793 char buf [64 ];
47784794 if (solver_ruleclass (solv , id ) == SOLVER_RULE_CHOICE )
47794795 id = solver_rule2pkgrule (solv , id );
4796+ if (solver_ruleclass (solv , id ) == SOLVER_RULE_RECOMMENDS )
4797+ id = solver_rule2pkgrule (solv , id );
47804798 rtype = solver_ruleinfo (solv , id , & depfrom , & depto , & dep );
47814799 if ((rtype & SOLVER_RULE_TYPEMASK ) == SOLVER_RULE_JOB )
47824800 {
0 commit comments