]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
Also look at recommends in only_namespace_recommended mode
authorMichael Schroeder <mls@suse.de>
Mon, 26 Nov 2018 11:57:48 +0000 (12:57 +0100)
committerMichael Schroeder <mls@suse.de>
Mon, 26 Nov 2018 11:57:48 +0000 (12:57 +0100)
We cheat by just checking if the dependency contains a namespace
relation. This is not 100% correct for complex dependencies where
we have multiple blocks after normalsation. But doing it right
is a lot of effort and there should be no difference in practice.

src/solver.c
src/solver_private.h
src/solver_util.c

index a6d00cb457f29b28f67187448c2925b11f1ed7b8..57fa3e494a8faf47cd010689b79fe6c4d41136a1 100644 (file)
@@ -2095,8 +2095,6 @@ resolve_weak(Solver *solv, int level, int disablerules, Queue *dq, Queue *dqs, i
        {
          /* installed, check for recommends */
          Id *recp, rec, pp, p;
-         if (solv->only_namespace_recommended)
-           continue;
          if (!solv->addalreadyrecommended && s->repo == solv->installed)
            continue;
          if (s->recommends)
@@ -2104,6 +2102,9 @@ resolve_weak(Solver *solv, int level, int disablerules, Queue *dq, Queue *dqs, i
              recp = s->repo->idarraydata + s->recommends;
              while ((rec = *recp++) != 0)
                {
+                 /* cheat: we just look if there is REL_NAMESPACE in the dep */
+                 if (solv->only_namespace_recommended && !solver_is_namespace_dep(solv, rec))
+                   continue;
 #ifdef ENABLE_COMPLEX_DEPS
                  if (pool_is_complex_dep(pool, rec))
                    {
index e92617dd55a1575d03682c199fa81a46749b1c73..406b304a60fe5d60198fce897c4c0b934345a29b 100644 (file)
@@ -21,6 +21,7 @@ extern int solver_dep_possible_slow(Solver *solv, Id dep, Map *m);
 extern int solver_dep_fulfilled_cplx(Solver *solv, Reldep *rd);
 extern int solver_is_supplementing_alreadyinstalled(Solver *solv, Solvable *s);
 extern void solver_intersect_obsoleted(Solver *solv, Id p, Queue *q, int qstart, Map *m);
+extern int solver_is_namespace_dep_slow(Solver *solv, Reldep *rd);
 
 extern void solver_createcleandepsmap(Solver *solv, Map *cleandepsmap, int unneeded);
 extern int solver_check_cleandeps_mistakes(Solver *solv);
@@ -92,4 +93,21 @@ solver_is_enhancing(Solver *solv, Solvable *s)
   return 0;
 }
 
+static inline int
+solver_is_namespace_dep(Solver *solv, Id dep)
+{
+  Pool *pool = solv->pool;
+  Reldep *rd;
+  if (!ISRELDEP(dep))
+    return 0;
+  rd = GETRELDEP(pool, dep);
+  if (rd->flags == REL_NAMESPACE)
+    return 1;
+  if (ISRELDEP(rd->name))
+    return solver_is_namespace_dep_slow(solv, rd);
+  if (ISRELDEP(rd->evr))
+    return solver_is_namespace_dep_slow(solv, GETRELDEP(pool, rd->evr));
+  return 0;
+}
+
 #endif /* LIBSOLV_SOLVER_PRIVATE_H */
index a910e115f649f2141cb1c56bd658666e765ceddd..fb17bf4dc7eeffb7704311200f34e669a8edf4d2 100644 (file)
@@ -327,6 +327,23 @@ solver_is_supplementing_alreadyinstalled(Solver *solv, Solvable *s)
     }
   return 0;
 }
+
+int
+solver_is_namespace_dep_slow(Solver *solv, Reldep *rd)
+{
+  Pool *pool = solv->pool;
+  for (;;)
+    {
+      if (rd->flags == REL_NAMESPACE)
+       return 1;
+      if (ISRELDEP(rd->name) && solver_is_namespace_dep_slow(solv, GETRELDEP(pool, rd->name)))
+       return 1;
+      if (!ISRELDEP(rd->evr))
+       return 0;
+      rd = GETRELDEP(pool, rd->evr);
+    }
+}
+
 /*
  * add all installed packages that package p obsoletes to Queue q.
  * Package p is not installed. Also, we know that if