small code cleanups
authorMichael Schroeder <mls@suse.de>
Thu, 22 Nov 2012 12:36:51 +0000 (13:36 +0100)
committerMichael Schroeder <mls@suse.de>
Thu, 22 Nov 2012 12:36:51 +0000 (13:36 +0100)
src/rules.c
src/selection.c

index 537d3207ef1b268051f13287492a300b38b34d41..12be39b5bf2b72c2e4ec32f42b73031d11fc7027 100644 (file)
@@ -773,8 +773,10 @@ solver_addrpmrulesforweak(Solver *solv, Map *m)
        continue;
 
       s = pool->solvables + i;
-      if (!pool_installable(pool, s))          /* only look at installable ones */
+      if (!s->repo)
        continue;
+      if (s->repo != pool->installed && !pool_installable(pool, s))
+       continue;       /* only look at installable ones */
 
       sup = 0;
       if (s->supplements)
@@ -2733,9 +2735,9 @@ solver_createcleandepsmap(Solver *solv, Map *cleandepsmap, int unneeded)
          if (di.solvid <= 0)
            continue;
          s = pool->solvables + di.solvid;
-         if (!s->requires)
+         if (!s->repo || !s->requires)
            continue;
-         if (!pool_installable(pool, s))
+         if (s->repo != installed && !pool_installable(pool, s))
            continue;
          if (strncmp(pool_id2str(pool, s->name), "pattern:", 8) != 0)
            continue;
index 32d4e283b586940480e3231630ca5f662cad5fca..63db2c109b5bb334d543c5f7ac23251e5dd88162 100644 (file)
@@ -195,20 +195,23 @@ selection_limit_rel(Pool *pool, Queue *selection, Id relflags, Id relevr)
                }
            }
          queue_free(&q);
-         continue;
        }
-      if (select != SOLVER_SOLVABLE_NAME && select != SOLVER_SOLVABLE_PROVIDES)
-       continue;       /* actually internal error */
-      if (relflags == REL_ARCH && (relevr == ARCH_SRC || relevr == ARCH_NOSRC) && ISRELDEP(id))
+      else if (select == SOLVER_SOLVABLE_NAME && select == SOLVER_SOLVABLE_PROVIDES)
        {
-         Reldep *rd = GETRELDEP(pool, id);
-         if (rd->flags == REL_ARCH && rd->evr == ARCH_SRC)
-           id = rd->name;
+         /* don't stack src reldeps */
+         if (relflags == REL_ARCH && (relevr == ARCH_SRC || relevr == ARCH_NOSRC) && ISRELDEP(id))
+           {
+             Reldep *rd = GETRELDEP(pool, id);
+             if (rd->flags == REL_ARCH && rd->evr == ARCH_SRC)
+               id = rd->name;
+           }
+         selection->elements[i + 1] = pool_rel2id(pool, id, relevr, relflags, 1);
        }
-      selection->elements[i + 1] = pool_rel2id(pool, id, relevr, relflags, 1);
+      else
+       continue;       /* actually internal error */
       if (relflags == REL_ARCH)
         selection->elements[i] |= SOLVER_SETARCH;
-      if (relflags == REL_EQ && select == SOLVER_SOLVABLE_NAME && selection->elements[i])
+      if (relflags == REL_EQ && select != SOLVER_SOLVABLE_PROVIDES)
         {
          if (pool->disttype == DISTTYPE_DEB)
             selection->elements[i] |= SOLVER_SETEVR;   /* debian can't match version only like rpm */
@@ -243,7 +246,7 @@ selection_addsrc(Pool *pool, Queue *selection, int flags)
            continue;
          if (s->arch == ARCH_SRC || s->arch == ARCH_NOSRC)
            havesrc = 1;
-         else if (!pool_installable(pool, s))
+         else if (s->repo != pool->installed && !pool_installable(pool, s))
            continue;
          queue_push(&q, p);
        }
@@ -373,7 +376,7 @@ selection_depglob(Pool *pool, Queue *selection, const char *name, int flags)
       FOR_POOL_SOLVABLES(p)
         {
           Solvable *s = pool->solvables + p;
-          if (!pool_installable(pool, s))
+          if (s->repo != pool->installed && !pool_installable(pool, s))
            if (!(flags & SELECTION_SOURCE_ONLY) || (s->arch != ARCH_SRC && s->arch != ARCH_NOSRC))
               continue;
          if ((flags & SELECTION_INSTALLED_ONLY) != 0 && s->repo != pool->installed)
@@ -435,7 +438,7 @@ selection_depglob_arch(Pool *pool, Queue *selection, const char *name, int flags
 
   if ((ret = selection_depglob(pool, selection, name, flags)) != 0)
     return ret;
-  /* check if theres an .arch suffix */
+  /* check if there is an .arch suffix */
   if ((r = strrchr(name, '.')) != 0 && r[1] && (archid = str2archid(pool, r + 1)) != 0)
     {
       char *rname = solv_strdup(name);
@@ -470,7 +473,7 @@ selection_filelist(Pool *pool, Queue *selection, const char *name, int flags)
       Solvable *s = pool->solvables + di.solvid;
       if (!s->repo)
        continue;
-      if (!pool_installable(pool, s))
+      if (s->repo != pool->installed && !pool_installable(pool, s))
        if (!(flags & SELECTION_SOURCE_ONLY) || (s->arch != ARCH_SRC && s->arch != ARCH_NOSRC))
          continue;
       if ((flags & SELECTION_INSTALLED_ONLY) != 0 && s->repo != pool->installed)