Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

- add comments, add BUGS

  • Loading branch information...
commit fc7e634774f03458fe198500dec0640521cd6f46 1 parent 1bb065d
Michael Schroeder mlschroe authored

Showing 2 changed files with 48 additions and 6 deletions. Show diff stats Hide diff stats

  1. +7 0 BUGS
  2. +41 6 src/rules.c
7 BUGS
... ... @@ -0,0 +1,7 @@
  1 +
  2 +Having the same key in multiple repodatas of a repo does not work
  3 +- searching will return both entries
  4 +- repo_write will write a broken solv file
  5 +Fixing the search so that it only returns the last entry will also
  6 +fix repo_write.
  7 +
47 src/rules.c
@@ -2259,6 +2259,21 @@ solver_disablechoicerules(Solver *solv, Rule *r)
2259 2259
2260 2260 #undef CLEANDEPSDEBUG
2261 2261
  2262 +/*
  2263 + * This functions collects all packages that are looked at
  2264 + * when a dependency is checked. We need it to "pin" installed
  2265 + * packages when removing a supplemented package in createcleandepsmap.
  2266 + * Here's an not uncommon example:
  2267 + * A contains "Supplements: packageand(B, C)"
  2268 + * B contains "Requires: A"
  2269 + * Now if we remove C, the supplements is no longer true,
  2270 + * thus we also remove A. Without the dep_pkgcheck function, we
  2271 + * would now also remove B, but this is wrong, as adding back
  2272 + * C doesn't make the supplements true again. Thus we "pin" B
  2273 + * when we remove A.
  2274 + * There's probably a better way to do this, but I haven't come
  2275 + * up with it yet ;)
  2276 + */
2262 2277 static inline void
2263 2278 dep_pkgcheck(Solver *solv, Id dep, Map *m, Queue *q)
2264 2279 {
@@ -2287,7 +2302,26 @@ dep_pkgcheck(Solver *solv, Id dep, Map *m, Queue *q)
2287 2302 queue_push(q, p);
2288 2303 }
2289 2304
2290   -static void solver_createcleandepsmap(Solver *solv)
  2305 +/*
  2306 + * Find all installed packages that are no longer
  2307 + * needed regarding the current solver job.
  2308 + *
  2309 + * The algorithm is:
  2310 + * - remove pass: remove all packages that could have
  2311 + * been dragged in by the obsoleted packages.
  2312 + * i.e. if package A is obsolete and contains "Requires: B",
  2313 + * also remove B, as installing A will have pulled in B.
  2314 + * after this pass, we have a set of still installed packages
  2315 + * with broken dependencies.
  2316 + * - add back pass:
  2317 + * now add back all packages that the still installed packages
  2318 + * require.
  2319 + *
  2320 + * The cleandeps packages are the packages removed in the first
  2321 + * pass and not added back in the second pass.
  2322 + */
  2323 +static void
  2324 +solver_createcleandepsmap(Solver *solv)
2291 2325 {
2292 2326 Pool *pool = solv->pool;
2293 2327 Repo *installed = solv->installed;
@@ -2422,7 +2456,7 @@ static void solver_createcleandepsmap(Solver *solv)
2422 2456 }
2423 2457
2424 2458 #ifdef CLEANDEPSDEBUG
2425   - printf("HELLO PASS\n");
  2459 + printf("REMOVE PASS\n");
2426 2460 #endif
2427 2461 for (;;)
2428 2462 {
@@ -2450,6 +2484,7 @@ static void solver_createcleandepsmap(Solver *solv)
2450 2484 {
2451 2485 /* no longer supplemented, also erase */
2452 2486 int iqcount = iq.count;
  2487 + /* pin packages, see comment above dep_pkgcheck */
2453 2488 dep_pkgcheck(solv, sup, &im, &iq);
2454 2489 for (i = iqcount; i < iq.count; i++)
2455 2490 {
@@ -2478,7 +2513,7 @@ static void solver_createcleandepsmap(Solver *solv)
2478 2513 continue;
2479 2514 MAPCLR(&im, ip);
2480 2515 #ifdef CLEANDEPSDEBUG
2481   - printf("hello %s\n", pool_solvable2str(pool, s));
  2516 + printf("removing %s\n", pool_solvable2str(pool, s));
2482 2517 #endif
2483 2518 if (s->requires)
2484 2519 {
@@ -2540,7 +2575,7 @@ static void solver_createcleandepsmap(Solver *solv)
2540 2575 for (rid = solv->jobrules; rid < solv->jobrules_end; rid++)
2541 2576 {
2542 2577 r = solv->rules + rid;
2543   - if (r->p >= 0 || r->d != 0)
  2578 + if (r->p >= 0 || r->d != 0 || r->w2 != 0)
2544 2579 continue; /* disabled or not erase */
2545 2580 p = -r->p;
2546 2581 MAPCLR(&im, p);
@@ -2574,7 +2609,7 @@ static void solver_createcleandepsmap(Solver *solv)
2574 2609 }
2575 2610
2576 2611 #ifdef CLEANDEPSDEBUG
2577   - printf("BYE PASS\n");
  2612 + printf("ADDBACK PASS\n");
2578 2613 #endif
2579 2614 for (;;)
2580 2615 {
@@ -2611,7 +2646,7 @@ static void solver_createcleandepsmap(Solver *solv)
2611 2646 ip = queue_shift(&iq);
2612 2647 s = pool->solvables + ip;
2613 2648 #ifdef CLEANDEPSDEBUG
2614   - printf("bye %s\n", pool_solvable2str(pool, s));
  2649 + printf("adding back %s\n", pool_solvable2str(pool, s));
2615 2650 #endif
2616 2651 if (s->requires)
2617 2652 {

0 comments on commit fc7e634

Please sign in to comment.
Something went wrong with that request. Please try again.