cosmetics: change comments
[platform/upstream/libsolv.git] / ext / repo_deb.c
index 2e1977b..e9e4e39 100644 (file)
@@ -274,7 +274,7 @@ control2solvable(Solvable *s, Repodata *data, char *control)
          break;
        case 'R' << 8 | 'E':
          if (!strcasecmp(tag, "replaces"))
-           s->obsoletes = makedeps(repo, q, s->conflicts, 0);
+           s->obsoletes = makedeps(repo, q, s->obsoletes, 0);
          else if (!strcasecmp(tag, "recommends"))
            s->recommends = makedeps(repo, q, s->recommends, 0);
          break;
@@ -329,22 +329,30 @@ control2solvable(Solvable *s, Repodata *data, char *control)
   if (s->obsoletes)
     {
       /* obsoletes only count when the packages also conflict */
+      /* XXX: should not transcode here */
       int i, j, k;
-      Id d;
+      Id d, cid;
       for (i = j = s->obsoletes; (d = repo->idarraydata[i]) != 0; i++)
        {
-         if (s->conflicts)
+         if (!s->conflicts)
+           continue;
+         for (k = s->conflicts; (cid = repo->idarraydata[k]) != 0; k++)
            {
-             for (k = s->conflicts; repo->idarraydata[k] != 0; k++)
-               if (repo->idarraydata[k] == d)
-                 break;
-             if (repo->idarraydata[k])
+             if (repo->idarraydata[k] == cid)
+               break;
+             if (ISRELDEP(cid))
                {
-                 repo->idarraydata[j++] = d;
+                 Reldep *rd = GETRELDEP(pool, cid);
+                 if (rd->flags < 8 && rd->name == d)
+                   break;      /* specialize obsoletes */
                }
            }
+         if (cid)
+           repo->idarraydata[j++] = cid;
        }
       repo->idarraydata[j] = 0;
+      if (j == s->obsoletes)
+       s->obsoletes = 0;
     }
 }
 
@@ -587,7 +595,8 @@ repo_add_deb(Repo *repo, const char *deb, int flags)
   ctar[l2] = 0;
   s = pool_id2solvable(pool, repo_add_solvable(repo));
   control2solvable(s, data, (char *)ctar);
-  repodata_set_location(data, s - pool->solvables, 0, 0, deb);
+  if (!(flags & REPO_NO_LOCATION))
+    repodata_set_location(data, s - pool->solvables, 0, 0, deb);
   if (S_ISREG(stb.st_mode))
     repodata_set_num(data, s - pool->solvables, SOLVABLE_DOWNLOADSIZE, (unsigned long long)stb.st_size);
   if (gotpkgid)