Imported Upstream version 0.6.23
[platform/upstream/libsolv.git] / src / repo.c
index 15e7e80..9e59fe2 100644 (file)
@@ -666,230 +666,6 @@ repo_reserve_ids(Repo *repo, Offset olddeps, int num)
 
 /***********************************************************************/
 
-/*
- * some SUSE specific fixups, should go into a separate file
- */
-
-Offset
-repo_fix_supplements(Repo *repo, Offset provides, Offset supplements, Offset freshens)
-{
-  Pool *pool = repo->pool;
-  Id id, idp, idl;
-  char buf[1024], *p, *dep;
-  int i, l;
-
-  if (provides)
-    {
-      for (i = provides; repo->idarraydata[i]; i++)
-       {
-         id = repo->idarraydata[i];
-         if (ISRELDEP(id))
-           continue;
-         dep = (char *)pool_id2str(pool, id);
-         if (!strncmp(dep, "locale(", 7) && strlen(dep) < sizeof(buf) - 2)
-           {
-             idp = 0;
-             strcpy(buf + 2, dep);
-             dep = buf + 2 + 7;
-             if ((p = strchr(dep, ':')) != 0 && p != dep)
-               {
-                 *p++ = 0;
-                 idp = pool_str2id(pool, dep, 1);
-                 dep = p;
-               }
-             id = 0;
-             while ((p = strchr(dep, ';')) != 0)
-               {
-                 if (p == dep)
-                   {
-                     dep = p + 1;
-                     continue;
-                   }
-                 *p++ = 0;
-                 idl = pool_str2id(pool, dep, 1);
-                 idl = pool_rel2id(pool, NAMESPACE_LANGUAGE, idl, REL_NAMESPACE, 1);
-                 if (id)
-                   id = pool_rel2id(pool, id, idl, REL_OR, 1);
-                 else
-                   id = idl;
-                 dep = p;
-               }
-             if (dep[0] && dep[1])
-               {
-                 for (p = dep; *p && *p != ')'; p++)
-                   ;
-                 *p = 0;
-                 idl = pool_str2id(pool, dep, 1);
-                 idl = pool_rel2id(pool, NAMESPACE_LANGUAGE, idl, REL_NAMESPACE, 1);
-                 if (id)
-                   id = pool_rel2id(pool, id, idl, REL_OR, 1);
-                 else
-                   id = idl;
-               }
-             if (idp)
-               id = pool_rel2id(pool, idp, id, REL_AND, 1);
-             if (id)
-               supplements = repo_addid_dep(repo, supplements, id, 0);
-           }
-         else if ((p = strchr(dep, ':')) != 0 && p != dep && p[1] == '/' && strlen(dep) < sizeof(buf))
-           {
-             strcpy(buf, dep);
-             p = buf + (p - dep);
-             *p++ = 0;
-             idp = pool_str2id(pool, buf, 1);
-             /* strip trailing slashes */
-             l = strlen(p);
-             while (l > 1 && p[l - 1] == '/')
-               p[--l] = 0;
-             id = pool_str2id(pool, p, 1);
-             id = pool_rel2id(pool, idp, id, REL_WITH, 1);
-             id = pool_rel2id(pool, NAMESPACE_SPLITPROVIDES, id, REL_NAMESPACE, 1);
-             supplements = repo_addid_dep(repo, supplements, id, 0);
-           }
-       }
-    }
-  if (supplements)
-    {
-      for (i = supplements; repo->idarraydata[i]; i++)
-       {
-         id = repo->idarraydata[i];
-         if (ISRELDEP(id))
-           continue;
-         dep = (char *)pool_id2str(pool, id);
-         if (!strncmp(dep, "system:modalias(", 16))
-           dep += 7;
-         if (!strncmp(dep, "modalias(", 9) && dep[9] && dep[10] && strlen(dep) < sizeof(buf))
-           {
-             strcpy(buf, dep);
-             p = strchr(buf + 9, ':');
-             if (p && p != buf + 9 && strchr(p + 1, ':'))
-               {
-                 *p++ = 0;
-                 idp = pool_str2id(pool, buf + 9, 1);
-                 p[strlen(p) - 1] = 0;
-                 id = pool_str2id(pool, p, 1);
-                 id = pool_rel2id(pool, NAMESPACE_MODALIAS, id, REL_NAMESPACE, 1);
-                 id = pool_rel2id(pool, idp, id, REL_AND, 1);
-               }
-             else
-               {
-                 p = buf + 9;
-                 p[strlen(p) - 1] = 0;
-                 id = pool_str2id(pool, p, 1);
-                 id = pool_rel2id(pool, NAMESPACE_MODALIAS, id, REL_NAMESPACE, 1);
-               }
-             if (id)
-               repo->idarraydata[i] = id;
-           }
-         else if (!strncmp(dep, "packageand(", 11) && strlen(dep) < sizeof(buf))
-           {
-             strcpy(buf, dep);
-             id = 0;
-             dep = buf + 11;
-             while ((p = strchr(dep, ':')) != 0)
-               {
-                 if (p == dep)
-                   {
-                     dep = p + 1;
-                     continue;
-                   }
-                 /* argh, allow pattern: prefix. sigh */
-                 if (p - dep == 7 && !strncmp(dep, "pattern", 7))
-                   {
-                     p = strchr(p + 1, ':');
-                     if (!p)
-                       break;
-                   }
-                 *p++ = 0;
-                 idp = pool_str2id(pool, dep, 1);
-                 if (id)
-                   id = pool_rel2id(pool, id, idp, REL_AND, 1);
-                 else
-                   id = idp;
-                 dep = p;
-               }
-             if (dep[0] && dep[1])
-               {
-                 dep[strlen(dep) - 1] = 0;
-                 idp = pool_str2id(pool, dep, 1);
-                 if (id)
-                   id = pool_rel2id(pool, id, idp, REL_AND, 1);
-                 else
-                   id = idp;
-               }
-             if (id)
-               repo->idarraydata[i] = id;
-           }
-         else if (!strncmp(dep, "filesystem(", 11) && strlen(dep) < sizeof(buf))
-           {
-             strcpy(buf, dep + 11);
-             if ((p = strrchr(buf, ')')) != 0)
-               *p = 0;
-             id = pool_str2id(pool, buf, 1);
-             id = pool_rel2id(pool, NAMESPACE_FILESYSTEM, id, REL_NAMESPACE, 1);
-             repo->idarraydata[i] = id;
-           }
-       }
-    }
-  if (freshens && repo->idarraydata[freshens])
-    {
-      Id idsupp = 0, idfresh = 0;
-      if (!supplements || !repo->idarraydata[supplements])
-       return freshens;
-      for (i = supplements; repo->idarraydata[i]; i++)
-        {
-         if (!idsupp)
-           idsupp = repo->idarraydata[i];
-         else
-           idsupp = pool_rel2id(pool, idsupp, repo->idarraydata[i], REL_OR, 1);
-        }
-      for (i = freshens; repo->idarraydata[i]; i++)
-        {
-         if (!idfresh)
-           idfresh = repo->idarraydata[i];
-         else
-           idfresh = pool_rel2id(pool, idfresh, repo->idarraydata[i], REL_OR, 1);
-        }
-      if (!idsupp)
-        idsupp = idfresh;
-      else
-       idsupp = pool_rel2id(pool, idsupp, idfresh, REL_AND, 1);
-      supplements = repo_addid_dep(repo, 0, idsupp, 0);
-    }
-  return supplements;
-}
-
-Offset
-repo_fix_conflicts(Repo *repo, Offset conflicts)
-{
-  char buf[1024], *p, *dep;
-  Pool *pool = repo->pool;
-  Id id;
-  int i;
-
-  if (!conflicts)
-    return conflicts;
-  for (i = conflicts; repo->idarraydata[i]; i++)
-    {
-      id = repo->idarraydata[i];
-      if (ISRELDEP(id))
-       continue;
-      dep = (char *)pool_id2str(pool, id);
-      if (!strncmp(dep, "otherproviders(", 15) && strlen(dep) < sizeof(buf) - 2)
-       {
-         strcpy(buf, dep + 15);
-         if ((p = strchr(buf, ')')) != 0)
-           *p = 0;
-         id = pool_str2id(pool, buf, 1);
-         id = pool_rel2id(pool, NAMESPACE_OTHERPROVIDERS, id, REL_NAMESPACE, 1);
-         repo->idarraydata[i] = id;
-       }
-    }
-  return conflicts;
-}
-
-/***********************************************************************/
-
 struct matchdata
 {
   Pool *pool;