Imported Upstream version 0.6.23
[platform/upstream/libsolv.git] / ext / repo_rpmdb.c
index 308cfe5..95756c0 100644 (file)
@@ -54,7 +54,9 @@
 /* 3: added triggers */
 /* 4: fixed triggers */
 /* 5: fixed checksum copying */
-#define RPMDB_COOKIE_VERSION 5
+/* 6: add SOLVABLE_PREREQ_IGNOREINST support */
+/* 7: fix bug in ignoreinst logic */
+#define RPMDB_COOKIE_VERSION 7
 
 #define TAG_NAME               1000
 #define TAG_VERSION            1001
@@ -587,18 +589,23 @@ makedeps(Pool *pool, Repo *repo, RpmHead *rpmhead, int tagn, int tagv, int tagf,
   solv_free(n);
   solv_free(v);
   solv_free(f);
-  if (has_ign && ignq->count > 2)
+  if (ignq && ignq->count)
     {
-      Id id, lastid = 0;
-      int j;
-
-      solv_sort(ignq->elements, ignq->count / 2, sizeof(Id) * 2, ignq_sortcmp, 0);
-      for (i = j = 0; i < ignq->count; i += 2)
+      int j = 0;
+      if (has_ign && ignq->count == 2)
+       j = 1;
+      else if (has_ign)
        {
-         id = ignq->elements[i];
-         if (id != lastid && ignq->elements[i + 1] > 0)
-           ignq->elements[j++] = id;
-         lastid = id;
+         Id id, lastid = 0;
+
+         solv_sort(ignq->elements, ignq->count / 2, sizeof(Id) * 2, ignq_sortcmp, 0);
+         for (i = j = 0; i < ignq->count; i += 2)
+           {
+             id = ignq->elements[i];
+             if (id != lastid && ignq->elements[i + 1] > 0)
+               ignq->elements[j++] = id;
+             lastid = id;
+           }
        }
       queue_truncate(ignq, j);
     }
@@ -983,8 +990,7 @@ rpm2solv(Pool *pool, Repo *repo, Repodata *data, Solvable *s, RpmHead *rpmhead,
   s->supplements = makedeps(pool, repo, rpmhead, TAG_SUPPLEMENTNAME, TAG_SUPPLEMENTVERSION, TAG_SUPPLEMENTFLAGS, 0, 0);
   s->enhances  = makedeps(pool, repo, rpmhead, TAG_ENHANCENAME, TAG_ENHANCEVERSION, TAG_ENHANCEFLAGS, 0, 0);
 
-  s->supplements = repo_fix_supplements(repo, s->provides, s->supplements, 0);
-  s->conflicts = repo_fix_conflicts(repo, s->conflicts);
+  repo_rewrite_suse_deps(s, 0);
 
   if (data && ignq.count)
     repodata_set_idarray(data, s - pool->solvables, SOLVABLE_PREREQ_IGNOREINST, &ignq);
@@ -2434,7 +2440,7 @@ rpm_iterate_filelist(void *rpmhandle, int flags, void (*cb)(void *, const char *
   if ((flags & RPM_ITERATE_FILELIST_WITHCOL) != 0)
     {
       co = headint32array(rpmhead, TAG_FILECOLORS, &cnt2);
-      if (!co || cnt != cnt2)
+      if (co && cnt != cnt2)
        {
          solv_free(co);
          solv_free(md);
@@ -2512,8 +2518,7 @@ rpm_iterate_filelist(void *rpmhandle, int flags, void (*cb)(void *, const char *
              info.digest = md5;
            }
        }
-      if (co)
-       info.color = co[i];
+      info.color = co ? co[i] : 0;
       (*cb)(cbdata, space, &info);
     }
   solv_free(space);