- add support for repository disabling
authorMichael Schroeder <mls@suse.de>
Thu, 9 Jul 2009 13:57:47 +0000 (15:57 +0200)
committerMichael Schroeder <mls@suse.de>
Thu, 9 Jul 2009 13:57:47 +0000 (15:57 +0200)
- add support for checksum stringification
- rename internal repodata functions
- add limited support for package colors
- do not put patches/patterns into the transaction

13 files changed:
examples/solv.c
src/policy.c
src/pool.h
src/poolarch.c
src/poolarch.h
src/repo.c
src/repo.h
src/repodata.c
src/repodata.h
src/rules.c
src/solver.c
src/solverdebug.c
src/transaction.c

index 1640bcf..15878e4 100644 (file)
@@ -492,7 +492,7 @@ checksig(Pool *sigpool, FILE *fp, FILE *sigfp)
       cleanupgpg(gpgdir);
       return 0;
     }
-  snprintf(cmd, sizeof(cmd), "gpg -q --homedir %s --import %s", gpgdir, keysfile);
+  snprintf(cmd, sizeof(cmd), "gpg2 -q --homedir %s --import %s", gpgdir, keysfile);
   if (system(cmd))
     {
       fprintf(stderr, "key import error\n");
@@ -632,7 +632,7 @@ writecachedrepo(Repo *repo, unsigned char *cookie)
   sat_free(addedfileprovides);
   repodata_internalize(info);
   repo_write(repo, fp, 0, 0, 0);
-  repo_free_repodata(repo, info);
+  repodata_free(info);
   if (fwrite(cookie, 32, 1, fp) != 1)
     {
       fclose(fp);
@@ -1417,7 +1417,7 @@ rerunsolver:
                      if (os->repo == pool->installed && os->name == s->name && os->arch == s->arch && os->evr == baseevr)
                        break;
                    }
-                 if (op)
+                 if (op && access("/usr/bin/applydeltarpm", X_OK) == 0)
                    {
                      /* base is installed, run sequence check */
                      const char *seqname;
@@ -1434,7 +1434,7 @@ rerunsolver:
                      seqnum = pool_lookup_str(pool, SOLVID_POS, DELTA_SEQ_NUM);
                      seq = pool_tmpjoin(pool, seqname, "-", seqevr);
                      seq = pool_tmpjoin(pool, seq, "-", seqnum);
-                     if (system(pool_tmpjoin(pool, "applydeltarpm -c -s ", seq, 0)) != 0)
+                     if (system(pool_tmpjoin(pool, "/usr/bin/applydeltarpm -c -s ", seq, 0)) != 0)
                        continue;       /* didn't match */
                      /* looks good, download delta */
                      chksumtype = 0;
index 8c442a0..168400b 100644 (file)
@@ -295,9 +295,12 @@ prune_to_best_version(Pool *pool, Queue *plist)
        {
          FOR_PROVIDES(p, pp, obs)
            {
-             if (pool->solvables[p].name == s->name)
+             Solvable *ps = pool->solvables + p;
+             if (ps->name == s->name)
                continue;
-             if (!pool->obsoleteusesprovides && !pool_match_nevr(pool, pool->solvables + p, obs))
+             if (!pool->obsoleteusesprovides && !pool_match_nevr(pool, ps, obs))
+               continue;
+             if (pool->obsoleteusescolors && !pool_colormatch(pool, s, ps))
                continue;
              for (j = 0; j < plist->count; j++)
                {
@@ -472,11 +475,14 @@ policy_create_obsolete_index(Solver *solv)
        {
          FOR_PROVIDES(p, pp, obs)
            {
-             if (pool->solvables[p].repo != installed)
+             Solvable *ps = pool->solvables + p;;
+             if (ps->repo != installed)
+               continue;
+             if (ps->name == s->name)
                continue;
-             if (pool->solvables[p].name == s->name)
+             if (!pool->obsoleteusesprovides && !pool_match_nevr(pool, ps, obs))
                continue;
-             if (!pool->obsoleteusesprovides && !pool_match_nevr(pool, pool->solvables + p, obs))
+             if (pool->obsoleteusescolors && !pool_colormatch(pool, s, ps))
                continue;
              obsoletes[p - installed->start]++;
            }
@@ -503,15 +509,17 @@ policy_create_obsolete_index(Solver *solv)
        {
          FOR_PROVIDES(p, pp, obs)
            {
-             if (pool->solvables[p].repo != installed)
+             Solvable *ps = pool->solvables + p;;
+             if (ps->repo != installed)
                continue;
-             if (pool->solvables[p].name == s->name)
+             if (ps->name == s->name)
                continue;
-             if (!pool->obsoleteusesprovides && !pool_match_nevr(pool, pool->solvables + p, obs))
+             if (!pool->obsoleteusesprovides && !pool_match_nevr(pool, ps, obs))
                continue;
-             p -= installed->start;
-             if (obsoletes_data[obsoletes[p]] != i)
-               obsoletes_data[--obsoletes[p]] = i;
+             if (pool->obsoleteusescolors && !pool_colormatch(pool, s, ps))
+               continue;
+             if (obsoletes_data[obsoletes[p - installed->start]] != i)
+               obsoletes_data[--obsoletes[p - installed->start]] = i;
            }
        }
     }
@@ -570,7 +578,10 @@ policy_findupdatepackages(Solver *solv, Solvable *s, Queue *qs, int allow_all)
            {
              FOR_PROVIDES(p2, pp2, obs)   /* and all matching providers of the obsoletes */
                {
-                 if (!pool->obsoleteusesprovides && !pool_match_nevr(pool, pool->solvables + p2, obs))
+                 Solvable *ps2 = pool->solvables + p2;
+                 if (!pool->obsoleteusesprovides && !pool_match_nevr(pool, ps2, obs))
+                   continue;
+                 if (pool->obsoleteusescolors && !pool_colormatch(pool, s, ps2))
                    continue;
                  if (p2 == n)          /* match ! */
                    break;
index 3df007b..365bd66 100644 (file)
@@ -78,11 +78,14 @@ struct _Pool {
   int promoteepoch;            /* true: missing epoch is replaced by epoch of dependency   */
   int obsoleteusesprovides;    /* true: obsoletes are matched against provides, not names */
   int implicitobsoleteusesprovides;    /* true: implicit obsoletes due to same name are matched against provides, not names */
+  int obsoleteusescolors;      /* true: obsoletes check arch color */
   int novirtualconflicts;      /* true: conflicts on names, not on provides */
   int allowselfconflicts;      /* true: packages which conflict with itself are installable */
 
   Id *id2arch;                 /* map arch ids to scores */
-  Id lastarch;                 /* last valid entry in id2arch */
+  unsigned char *id2color;     /* map arch ids to colors */
+  Id lastarch;                 /* last valid entry in id2arch/id2color */
+
   Queue vendormap;             /* map vendor to vendorclasses mask */
 
   /* providers data, as two-step indirect list
@@ -241,21 +244,6 @@ extern void pool_addfileprovides_ids(Pool *pool, struct _Repo *installed, Id **i
 extern void pool_freewhatprovides(Pool *pool);
 extern Id pool_queuetowhatprovides(Pool *pool, Queue *q);
 
-static inline int pool_installable(const Pool *pool, Solvable *s)
-{
-  if (!s->arch || s->arch == ARCH_SRC || s->arch == ARCH_NOSRC)
-    return 0;
-  if (pool->id2arch && (s->arch > pool->lastarch || !pool->id2arch[s->arch]))
-    return 0;
-  if (pool->considered)
-    { 
-      Id id = s - pool->solvables;
-      if (!MAPTST(pool->considered, id))
-       return 0;
-    }
-  return 1;
-}
-
 extern Id pool_addrelproviders(Pool *pool, Id d);
 
 static inline Id pool_whatprovides(Pool *pool, Id d)
index c25f876..dffb40b 100644 (file)
@@ -57,6 +57,7 @@ pool_setarch(Pool *pool, const char *arch)
   Id id, lastarch;
 
   pool->id2arch = sat_free(pool->id2arch);
+  pool->id2color = sat_free(pool->id2color);
   if (!arch)
     {
       pool->lastarch = 0;
@@ -108,3 +109,24 @@ pool_setarch(Pool *pool, const char *arch)
   pool->id2arch = id2arch;
   pool->lastarch = lastarch;
 }
+
+unsigned char
+pool_arch2color_slow(Pool *pool, Id arch)
+{
+  const char *s;
+  unsigned char color;
+
+  if (arch > pool->lastarch)
+    return ARCHCOLOR_ALL;
+  if (!pool->id2color)
+    pool->id2color = sat_calloc(pool->lastarch + 1, 1);
+  s = id2str(pool, arch);
+  if (arch == ARCH_NOARCH || arch == ARCH_ALL)
+    color = ARCHCOLOR_ALL;
+  else if (!strcmp(s, "s390x") || strstr(s, "64"))
+    color = ARCHCOLOR_64;
+  else
+    color = ARCHCOLOR_32;
+  return color;
+}
+
index 9019d6a..5ace54f 100644 (file)
 #include "pool.h"
 
 extern void pool_setarch(Pool *, const char *);
+extern unsigned char pool_arch2color_slow(Pool *pool, Id arch);
+
+#define ARCHCOLOR_32    1
+#define ARCHCOLOR_64    2
+#define ARCHCOLOR_ALL   255
+
+static inline unsigned char pool_arch2color(Pool *pool, Id arch)
+{
+  if (arch > pool->lastarch)
+    return ARCHCOLOR_ALL;
+  if (pool->id2color && pool->id2color[arch])
+    return pool->id2color[arch];
+  return pool_arch2color_slow(pool, arch);
+}
+
+static inline int pool_colormatch(Pool *pool, Solvable *s1, Solvable *s2)
+{
+  if (s1->arch == s2->arch)
+    return 1;
+  if ((pool_arch2color(pool, s1->arch) & pool_arch2color(pool, s2->arch)) != 0)
+    return 1;
+  return 0;
+}
 
 #endif /* SATSOLVER_POOLARCH_H */
index 25e07ff..2fe502d 100644 (file)
@@ -60,7 +60,7 @@ repo_freedata(Repo *repo)
 {
   int i;
   for (i = 0; i < repo->nrepodata; i++)
-    repodata_free(repo->repodata + i);
+    repodata_freedata(repo->repodata + i);
   sat_free(repo->repodata);
   sat_free(repo->idarraydata);
   sat_free(repo->rpmdbid);
@@ -797,6 +797,8 @@ repo_search(Repo *repo, Id p, Id keyname, const char *match, int flags, int (*ca
 {
   struct matchdata md;
 
+  if (repo->disabled && !(flags & SEARCH_DISABLED_REPOS))
+    return;
   memset(&md, 0, sizeof(md));
   md.pool = repo->pool;
   md.flags = flags;
@@ -972,7 +974,7 @@ repo_add_repodata(Repo *repo, int localpool)
   repo->nrepodata++;
   repo->repodata = sat_realloc2(repo->repodata, repo->nrepodata, sizeof(*data));
   data = repo->repodata + repo->nrepodata - 1;
-  repodata_init(data, repo, localpool);
+  repodata_initdata(data, repo, localpool);
   return data;
 }
 
@@ -987,16 +989,6 @@ repo_last_repodata(Repo *repo)
 }
 
 void
-repo_free_repodata(Repo *repo, Repodata *data)
-{
-  int i = data - repo->repodata;
-  repodata_free(data);
-  if (i < repo->nrepodata - 1)
-    memmove(repo->repodata + i, repo->repodata + i + 1, (repo->nrepodata - 1 - i) * sizeof(Repodata));
-  repo->nrepodata--;
-}
-
-void
 repo_set_id(Repo *repo, Id p, Id keyname, Id id)
 {
   Repodata *data = repo_last_repodata(repo);
index d61e5c9..ee8f881 100644 (file)
 
 
 typedef struct _Repo {
-  const char *name;
+  const char *name;            /* application private name pointer */
   Id repoid;                   /* our id */
   void *appdata;               /* application private pointer */
 
-  Pool *pool;                  /* pool containing repo data */
+  Pool *pool;                  /* pool containing this repo */
 
   int start;                   /* start of this repo solvables within pool->solvables */
   int end;                     /* last solvable + 1 of this repo */
   int nsolvables;              /* number of solvables repo is contributing to pool */
 
+  int disabled;                        /* ignore the solvables? */
   int priority;                        /* priority of this repo */
   int subpriority;             /* sub-priority of this repo, used just for sorting, not pruning */
 
   Id *idarraydata;             /* array of metadata Ids, solvable dependencies are offsets into this array */
   int idarraysize;
-  Offset lastoff;
+  Offset lastoff;              /* start of last array in idarraydata */
 
   Id *rpmdbid;                 /* solvable side data */
 
@@ -114,15 +115,34 @@ static inline void repo_free_solvable_block(Repo *repo, Id start, int count, int
   pool_free_solvable_block(repo->pool, start, count, reuseids);
 }
 
+#define FOR_REPO_SOLVABLES(r, p, s)                                            \
+  for (p = (r)->start, s = (r)->pool->solvables + p; p < (r)->end; p++, s = (r)->pool->solvables + p)  \
+    if (s->repo == (r))
+
+
+/* those two functions are here because they need the Repo definition */
+
 static inline Repo *pool_id2repo(Pool *pool, Id repoid)
 {
   return pool->repos[repoid - 1];
 }
 
-#define FOR_REPO_SOLVABLES(r, p, s)                                            \
-  for (p = (r)->start, s = (r)->pool->solvables + p; p < (r)->end; p++, s = (r)->pool->solvables + p)  \
-    if (s->repo == (r))
-
+static inline int pool_installable(const Pool *pool, Solvable *s)
+{
+  if (!s->arch || s->arch == ARCH_SRC || s->arch == ARCH_NOSRC)
+    return 0;
+  if (s->repo && s->repo->disabled)
+    return 0;
+  if (pool->id2arch && (s->arch > pool->lastarch || !pool->id2arch[s->arch]))
+    return 0;
+  if (pool->considered)
+    { 
+      Id id = s - pool->solvables;
+      if (!MAPTST(pool->considered, id))
+       return 0;
+    }
+  return 1;
+}
 
 /* search callback values */
 
@@ -143,28 +163,30 @@ typedef struct _KeyValue {
   struct _KeyValue *parent;
 } KeyValue;
 
-/* search flags */
+/* search matcher flags */
 #define SEARCH_STRINGMASK      15
 #define SEARCH_STRING          1
 #define SEARCH_SUBSTRING       2
 #define SEARCH_GLOB            3
 #define SEARCH_REGEX           4
 #define SEARCH_ERROR           5
-
-#define        SEARCH_NOCASE                   (1<<8)
-#define        SEARCH_NO_STORAGE_SOLVABLE      (1<<9)
-#define SEARCH_SUB                     (1<<10)
-#define SEARCH_ARRAYSENTINEL           (1<<11)
-#define SEARCH_SKIP_KIND               (1<<12)
-
-
-/* By default we don't match in attributes representing filelists
-   because the construction of those strings is costly.  Specify this
-   flag if you want this.  In that case kv->str will contain the full
-   filename (if matched of course).  */
-#define SEARCH_FILES                   (1<<13)
-
-/* Internal */
+#define        SEARCH_NOCASE                   (1<<7)
+
+/* iterator control */
+#define        SEARCH_NO_STORAGE_SOLVABLE      (1<<8)
+#define SEARCH_SUB                     (1<<9)
+#define SEARCH_ARRAYSENTINEL           (1<<10)
+#define SEARCH_DISABLED_REPOS          (1<<11)
+
+/* stringification flags */
+#define SEARCH_SKIP_KIND               (1<<16)
+/* By default we stringify just to the basename of a file because
+   the construction of the full filename is costly.  Specify this
+   flag if you want to match full filenames */
+#define SEARCH_FILES                   (1<<17)
+#define SEARCH_CHECKSUMS               (1<<18)
+
+/* dataiterator internal */
 #define SEARCH_THISSOLVID              (1<<31)
 
 
@@ -174,7 +196,6 @@ typedef struct _KeyValue {
 
 Repodata *repo_add_repodata(Repo *repo, int localpool);
 Repodata *repo_last_repodata(Repo *repo);
-void repo_free_repodata(Repo *repo, Repodata *data);
 
 void repo_search(Repo *repo, Id p, Id key, const char *match, int flags, int (*callback)(void *cbdata, Solvable *s, Repodata *data, Repokey *key, KeyValue *kv), void *cbdata);
 
index 89cd1c2..6df3717 100644 (file)
@@ -43,7 +43,7 @@ extern unsigned int unchecked_decompress_buf (const unsigned char *in,
 
 
 void
-repodata_init(Repodata *data, Repo *repo, int localpool)
+repodata_initdata(Repodata *data, Repo *repo, int localpool)
 {
   memset(data, 0, sizeof (*data));
   data->repo = repo;
@@ -60,7 +60,7 @@ repodata_init(Repodata *data, Repo *repo, int localpool)
 }
 
 void
-repodata_free(Repodata *data)
+repodata_freedata(Repodata *data)
 {
   int i;
 
@@ -95,6 +95,17 @@ repodata_free(Repodata *data)
   sat_free(data->attriddata);
 }
 
+void
+repodata_free(Repodata *data)
+{
+  Repo *repo = data->repo;
+  int i = data - repo->repodata;
+  repodata_freedata(data);
+  if (i < repo->nrepodata - 1)
+  memmove(repo->repodata + i, repo->repodata + i + 1, (repo->nrepodata - 1 - i) * sizeof(Repodata));
+  repo->nrepodata--;
+}
+
 
 /***************************************************************
  * key pool management
@@ -655,6 +666,13 @@ repodata_stringify(Pool *pool, Repodata *data, Repokey *key, KeyValue *kv, int f
         come up with the same filename again.  */
       kv->id = 0;
       return 1;
+    case REPOKEY_TYPE_MD5:
+    case REPOKEY_TYPE_SHA1:
+    case REPOKEY_TYPE_SHA256:
+      if (!(flags & SEARCH_CHECKSUMS))
+       return 0;       /* skip em */
+      kv->str = repodata_chk2str(data, key->type, (const unsigned char *)kv->str);
+      return 1;
     default:
       return 0;
     }
@@ -1112,6 +1130,8 @@ dataiterator_step(Dataiterator *di)
        case di_enterrepo: di_enterrepo:
          if (!di->repo)
            goto di_bye;
+         if (di->repo->disabled && !(di->flags & SEARCH_DISABLED_REPOS))
+           goto di_nextrepo;
          if (!(di->flags & SEARCH_THISSOLVID))
            {
              di->solvid = di->repo->start - 1; /* reset solvid iterator */
@@ -1209,7 +1229,7 @@ dataiterator_step(Dataiterator *di)
            }
          /* FALLTHROUGH */
 
-       case di_nextrepo:
+       case di_nextrepo: di_nextrepo:
          if (di->repoid >= 0)
            {
              di->repoid++;
index 74698bf..e0f2022 100644 (file)
@@ -113,7 +113,8 @@ typedef struct _Repodata {
 /*-----
  * management functions
  */
-void repodata_init(Repodata *data, struct _Repo *repo, int localpool);
+void repodata_initdata(Repodata *data, struct _Repo *repo, int localpool);
+void repodata_freedata(Repodata *data);
 void repodata_free(Repodata *data);
 
 
index 1a15dd5..b673e80 100644 (file)
@@ -20,6 +20,7 @@
 #include "solver.h"
 #include "bitmap.h"
 #include "pool.h"
+#include "poolarch.h"
 #include "util.h"
 #include "policy.h"
 #include "solverdebug.h"
@@ -669,8 +670,11 @@ solver_addrpmrulesforsolvable(Solver *solv, Solvable *s, Map *m)
                  /* foreach provider of an obsoletes of 's' */ 
                  FOR_PROVIDES(p, pp, obs)
                    {
+                     Solvable *ps = pool->solvables + p;
                      if (!pool->obsoleteusesprovides /* obsoletes are matched names, not provides */
-                         && !pool_match_nevr(pool, pool->solvables + p, obs))
+                         && !pool_match_nevr(pool, ps, obs))
+                       continue;
+                     if (pool->obsoleteusescolors && !pool_colormatch(pool, s, ps))
                        continue;
                      addrpmrule(solv, -n, -p, SOLVER_RULE_RPM_PACKAGE_OBSOLETES, obs);
                    }
@@ -685,6 +689,8 @@ solver_addrpmrulesforsolvable(Solver *solv, Solvable *s, Map *m)
                continue;
              if (!pool->implicitobsoleteusesprovides && s->name != ps->name)
                continue;
+             if (pool->obsoleteusescolors && !pool_colormatch(pool, s, ps))
+               continue;
              if (s->name == ps->name)
                addrpmrule(solv, -n, -p, SOLVER_RULE_RPM_SAME_NAME, 0);
              else
@@ -1170,7 +1176,10 @@ solver_createdupmaps(Solver *solv)
                    {
                      FOR_PROVIDES(pi, pp, obs)
                        {
-                         if (!pool->obsoleteusesprovides && !pool_match_nevr(pool, pool->solvables + pi, obs))
+                         Solvable *pis = pool->solvables + pi;
+                         if (!pool->obsoleteusesprovides && !pool_match_nevr(pool, pis, obs))
+                           continue;
+                         if (pool->obsoleteusescolors && !pool_colormatch(pool, s, pis))
                            continue;
                          MAPSET(&solv->dupinvolvedmap, pi);
                        }
@@ -1363,6 +1372,8 @@ jobtodisablelist(Solver *solv, Id how, Id what, Queue *q)
                  continue;
                if (!pool->obsoleteusesprovides && !pool_match_nevr(pool, ps, obs))
                  continue;
+               if (pool->obsoleteusescolors && !pool_colormatch(pool, s, ps))
+                 continue;
                queue_push(q, DISABLE_UPDATE);
                queue_push(q, p);
              }
@@ -1374,6 +1385,8 @@ jobtodisablelist(Solver *solv, Id how, Id what, Queue *q)
            continue;
          if (!pool->implicitobsoleteusesprovides && ps->name != s->name)
            continue;
+         if (pool->obsoleteusescolors && !pool_colormatch(pool, s, ps))
+           continue;
          queue_push(q, DISABLE_UPDATE);
          queue_push(q, p);
        }
index 09801d1..b54b849 100644 (file)
@@ -2393,7 +2393,7 @@ solver_solve(Solver *solv, Queue *job)
   POOL_DEBUG(SAT_DEBUG_STATS, "distupgrade=%d distupgrade_removeunsupported=%d\n", solv->distupgrade, solv->distupgrade_removeunsupported);
   POOL_DEBUG(SAT_DEBUG_STATS, "allowuninstall=%d, allowdowngrade=%d, allowarchchange=%d, allowvendorchange=%d\n", solv->allowuninstall, solv->allowdowngrade, solv->allowarchchange, solv->allowvendorchange);
   POOL_DEBUG(SAT_DEBUG_STATS, "promoteepoch=%d, novirtualconflicts=%d, allowselfconflicts=%d\n", pool->promoteepoch, pool->novirtualconflicts, pool->allowselfconflicts);
-  POOL_DEBUG(SAT_DEBUG_STATS, "obsoleteusesprovides=%d, implicitobsoleteusesprovides=%d\n", pool->obsoleteusesprovides, pool->implicitobsoleteusesprovides);
+  POOL_DEBUG(SAT_DEBUG_STATS, "obsoleteusesprovides=%d, implicitobsoleteusesprovides=%d, obsoleteusescolors=%d\n", pool->obsoleteusesprovides, pool->implicitobsoleteusesprovides, pool->obsoleteusescolors);
   POOL_DEBUG(SAT_DEBUG_STATS, "dontinstallrecommended=%d, ignorealreadyrecommended=%d, dontshowinstalledrecommended=%d\n", solv->dontinstallrecommended, solv->ignorealreadyrecommended, solv->dontshowinstalledrecommended);
 
   /* create whatprovides if not already there */
index cb62f32..4776e32 100644 (file)
@@ -21,6 +21,7 @@
 #include "solverdebug.h"
 #include "bitmap.h"
 #include "pool.h"
+#include "poolarch.h"
 #include "util.h"
 #include "evr.h"
 #include "policy.h"
@@ -72,7 +73,9 @@ solver_create_decisions_obsoletesmap(Solver *solv)
                continue;
              if (!pool->implicitobsoleteusesprovides && s->name != ps->name)
                continue;
-             if (pool->solvables[p].repo == installed && !obsoletesmap[p])
+             if (pool->obsoleteusescolors && !pool_colormatch(pool, s, ps))
+               continue;
+             if (ps->repo == installed && !obsoletesmap[p])
                {
                  obsoletesmap[p] = n;
                  obsoletesmap[n]++;
@@ -101,7 +104,10 @@ solver_create_decisions_obsoletesmap(Solver *solv)
            {
              FOR_PROVIDES(p, pp, obs)
                {
-                 if (!pool->obsoleteusesprovides && !pool_match_nevr(pool, pool->solvables + p, obs))
+                 Solvable *ps = pool->solvables + p;
+                 if (!pool->obsoleteusesprovides && !pool_match_nevr(pool, ps, obs))
+                   continue;
+                 if (pool->obsoleteusescolors && !pool_colormatch(pool, s, ps))
                    continue;
                  if (pool->solvables[p].repo == installed && !obsoletesmap[p])
                    {
index c01ff17..7d67a55 100644 (file)
@@ -21,6 +21,7 @@
 #include "solver.h"
 #include "bitmap.h"
 #include "pool.h"
+#include "poolarch.h"
 #include "evr.h"
 #include "util.h"
 
@@ -394,7 +395,7 @@ void
 transaction_classify(Transaction *trans, int mode, Queue *classes)
 {
   Pool *pool = trans->pool;
-  int ntypes[SOLVER_TRANSACTION_MAXTYPE];
+  int ntypes[SOLVER_TRANSACTION_MAXTYPE + 1];
   Solvable *s, *sq;
   Id v, vq, type, p, q;
   int i, j;
@@ -560,6 +561,8 @@ create_transaction_info(Transaction *trans, Queue *decisionq)
            continue;
          if (!pool->implicitobsoleteusesprovides && s->name != s2->name)
            continue;
+         if (pool->obsoleteusescolors && !pool_colormatch(pool, s, s2))
+           continue;
          queue_push(ti, p);
          queue_push(ti, p2);
        }
@@ -575,6 +578,8 @@ create_transaction_info(Transaction *trans, Queue *decisionq)
                    continue;
                  if (!pool->obsoleteusesprovides && !pool_match_nevr(pool, pool->solvables + p2, obs))
                    continue;
+                 if (pool->obsoleteusescolors && !pool_colormatch(pool, s, s2))
+                   continue;
                  queue_push(ti, p);
                  queue_push(ti, p2);
                }
@@ -639,6 +644,11 @@ transaction_calculate(Transaction *trans, Queue *decisionq, Map *noobsmap)
        MAPSET(&trans->transactsmap, -p);
       if ((!installed || s->repo != installed) && p > 0)
        {
+         const char *n = id2str(pool, s->name);
+         if (!strncmp(n, "patch:", 6))
+           continue;
+         if (!strncmp(n, "pattern:", 8))
+           continue;
          MAPSET(&trans->transactsmap, p);
          if (noobsmap && MAPTST(noobsmap, p))
            neednoobs = 1;