- get rid of static variables used by join2
[platform/upstream/libsolv.git] / ext / repo_susetags.c
index 89bd3d5..6395425 100644 (file)
@@ -24,18 +24,21 @@ struct datashare {
   Id evr;
   Id arch;
 };
+
 struct parsedata {
-  char *kind;
+  Pool *pool;
   Repo *repo;
   Repodata *data;
+  char *kind;
   int flags;
-  struct parsedata_common common;
   int last_found_source;
   struct datashare *share_with;
   int nshare;
-  Id (*dirs)[3]; // dirid, size, nfiles
+  Id (*dirs)[3];                       /* dirid, size, nfiles */
   int ndirs;
-  Id langcache[ID_NUM_INTERNAL];
+  struct joindata jd;
+  char *language;                      /* the default language */
+  Id langcache[ID_NUM_INTERNAL];       /* cache for the default language */
   int lineno;
 };
 
@@ -52,13 +55,14 @@ static char *flagtab[] = {
 static Id
 langtag(struct parsedata *pd, Id tag, const char *language)
 {
-  if (language && !language[0])
-    language = 0;
-  if (!language || tag >= ID_NUM_INTERNAL)
+  if (language && *language)
     return pool_id2langid(pd->repo->pool, tag, language, 1);
-  return pool_id2langid(pd->repo->pool, tag, language, 1);
+  if (!pd->language)
+    return tag;
+  if (tag >= ID_NUM_INTERNAL)
+    return pool_id2langid(pd->repo->pool, tag, pd->language, 1);
   if (!pd->langcache[tag])
-    pd->langcache[tag] = pool_id2langid(pd->repo->pool, tag, language, 1);
+    pd->langcache[tag] = pool_id2langid(pd->repo->pool, tag, pd->language, 1);
   return pd->langcache[tag];
 }
 
@@ -77,20 +81,20 @@ adddep(Pool *pool, struct parsedata *pd, unsigned int olddeps, char *line, Id ma
   if (line[6] == '/')
     {
       /* A file dependency. Do not try to parse it */
-      id = str2id(pool, line + 6, 1);
+      id = pool_str2id(pool, line + 6, 1);
     }
   else
     {
       i = split(line + 6, sp, 4); /* name, <op>, evr, ? */
       if (i != 1 && i != 3) /* expect either 'name' or 'name' <op> 'evr' */
         {
-         pool_debug(pool, SAT_FATAL, "susetags: bad dependency line: %d: %s\n", pd->lineno, line);
+         pool_debug(pool, SOLV_FATAL, "susetags: bad dependency line: %d: %s\n", pd->lineno, line);
           exit(1);
         }
       if (kind)
-        id = str2id(pool, join2(kind, ":", sp[0]), 1);
+        id = pool_str2id(pool, join2(&pd->jd, kind, ":", sp[0]), 1);
       else
-        id = str2id(pool, sp[0], 1);
+        id = pool_str2id(pool, sp[0], 1);
       if (i == 3)
         {
           evrid = makeevr(pool, sp[2]);
@@ -99,10 +103,10 @@ adddep(Pool *pool, struct parsedata *pd, unsigned int olddeps, char *line, Id ma
               break;
           if (flags == 6)
             {
-             pool_debug(pool, SAT_FATAL, "susetags: unknown relation in %d: '%s'\n", pd->lineno, sp[1]);
+             pool_debug(pool, SOLV_FATAL, "susetags: unknown relation in %d: '%s'\n", pd->lineno, sp[1]);
               exit(1);
             }
-          id = rel2id(pool, id, evrid, flags + 1, 1);
+          id = pool_rel2id(pool, id, evrid, flags + 1, 1);
         }
     }
   return repo_addid_dep(pd->repo, olddeps, id, marker);
@@ -120,16 +124,19 @@ add_source(struct parsedata *pd, char *line, Solvable *s, Id handle)
   Repo *repo = s->repo;
   Pool *pool = repo->pool;
   char *sp[5];
+  Id name;
+  Id evr;
+  Id arch;
 
   if (split(line, sp, 5) != 4)
     {
-      pool_debug(pool, SAT_FATAL, "susetags: bad source line: %d: %s\n", pd->lineno, line);
+      pool_debug(pool, SOLV_FATAL, "susetags: bad source line: %d: %s\n", pd->lineno, line);
       exit(1);
     }
 
-  Id name = str2id(pool, sp[0], 1);
-  Id evr = makeevr(pool, join2(sp[1], "-", sp[2]));
-  Id arch = str2id(pool, sp[3], 1);
+  name = pool_str2id(pool, sp[0], 1);
+  evr = makeevr(pool, join2(&pd->jd, sp[1], "-", sp[2]));
+  arch = pool_str2id(pool, sp[3], 1);
   /* XXX: could record a dep here, depends on where we want to store the data */
   if (name == s->name)
     repodata_set_void(pd->data, handle, SOLVABLE_SOURCENAME);
@@ -152,17 +159,20 @@ static void
 add_dirline(struct parsedata *pd, char *line)
 {
   char *sp[6];
+  long filesz;
+  long filenum;
+  unsigned dirid;
   if (split(line, sp, 6) != 5)
     return;
-  pd->dirs = sat_extend(pd->dirs, pd->ndirs, 1, sizeof(pd->dirs[0]), 31);
-  long filesz = strtol(sp[1], 0, 0);
+  pd->dirs = solv_extend(pd->dirs, pd->ndirs, 1, sizeof(pd->dirs[0]), 31);
+  filesz = strtol(sp[1], 0, 0);
   filesz += strtol(sp[2], 0, 0);
-  long filenum = strtol(sp[3], 0, 0);
+  filenum = strtol(sp[3], 0, 0);
   filenum += strtol(sp[4], 0, 0);
   /* hack: we know that there's room for a / */
   if (*sp[0] != '/')
     *--sp[0] = '/';
-  unsigned dirid = repodata_str2dir(pd->data, sp[0], 1);
+  dirid = repodata_str2dir(pd->data, sp[0], 1);
 #if 0
 fprintf(stderr, "%s -> %d\n", sp[0], dirid);
 #endif
@@ -179,18 +189,18 @@ set_checksum(struct parsedata *pd, Repodata *data, Id handle, Id keyname, char *
   Id type;
   if (split(line, sp, 3) != 2)
     {
-      pool_debug(pd->repo->pool, SAT_FATAL, "susetags: bad checksum line: %d: %s\n", pd->lineno, line);
+      pool_debug(pd->repo->pool, SOLV_FATAL, "susetags: bad checksum line: %d: %s\n", pd->lineno, line);
       exit(1);
     }
-  type = sat_chksum_str2type(sp[0]);
+  type = solv_chksum_str2type(sp[0]);
   if (!type)
     {
-      pool_debug(pd->repo->pool, SAT_FATAL, "susetags: unknown checksum type: %d: %s\n", pd->lineno, sp[0]);
+      pool_debug(pd->repo->pool, SOLV_FATAL, "susetags: unknown checksum type: %d: %s\n", pd->lineno, sp[0]);
       exit(1);
     }
-  if (strlen(sp[1]) != 2 * sat_chksum_len(type))
+  if (strlen(sp[1]) != 2 * solv_chksum_len(type))
     {
-      pool_debug(pd->repo->pool, SAT_FATAL, "susetags: bad checksum length: %d: for %s: %s\n", pd->lineno, sp[0], sp[1]);
+      pool_debug(pd->repo->pool, SOLV_FATAL, "susetags: bad checksum length: %d: for %s: %s\n", pd->lineno, sp[0], sp[1]);
       exit(1);
     }
   repodata_set_checksum(data, handle, keyname, type, sp[1]);
@@ -224,7 +234,7 @@ set_delta_location(Repodata *data, Id handle, int medianr, char *dir, char *file
   if (l == 1 && dir[0] == '.') 
     l = 0; 
   if (dir && l)
-    repodata_set_id(data, handle, DELTA_LOCATION_DIR, strn2id(pool, dir, l, 1));
+    repodata_set_id(data, handle, DELTA_LOCATION_DIR, pool_strn2id(pool, dir, l, 1));
   if ((p = strrchr(file, '.')) != 0)
     {
       *p = 0;
@@ -233,14 +243,14 @@ set_delta_location(Repodata *data, Id handle, int medianr, char *dir, char *file
          *p = '.';
          p = op;
          *p = 0;
-         if (!strcmp(p + 1, ".delta.rpm") && (op = strrchr(file, '.')) != 0)
+         if (!strcmp(p + 1, "delta.rpm") && (op = strrchr(file, '.')) != 0)
            {
              *p = '.';
              p = op;
              *p = 0;
            }
        }
-      repodata_set_id(data, handle, DELTA_LOCATION_SUFFIX, str2id(pool, p + 1, 1));
+      repodata_set_id(data, handle, DELTA_LOCATION_SUFFIX, pool_str2id(pool, p + 1, 1));
     }
   if ((p = strrchr(file, '-')) != 0)
     {
@@ -251,9 +261,9 @@ set_delta_location(Repodata *data, Id handle, int medianr, char *dir, char *file
          p = op;
          *p = 0;
        }
-      repodata_set_id(data, handle, DELTA_LOCATION_EVR, str2id(pool, p + 1, 1));
+      repodata_set_id(data, handle, DELTA_LOCATION_EVR, pool_str2id(pool, p + 1, 1));
     }
-  repodata_set_id(data, handle, DELTA_LOCATION_NAME, str2id(pool, file, 1));
+  repodata_set_id(data, handle, DELTA_LOCATION_NAME, pool_str2id(pool, file, 1));
 }
 
 
@@ -286,7 +296,7 @@ commit_diskusage(struct parsedata *pd, Id handle)
   /* Now sort in dirid order.  This ensures that parents come before
      their children.  */
   if (pd->ndirs > 1)
-    sat_sort(pd->dirs, pd->ndirs, sizeof(pd->dirs[0]), id3_cmp, 0);
+    solv_sort(pd->dirs, pd->ndirs, sizeof(pd->dirs[0]), id3_cmp, 0);
   /* Substract leaf numbers from all parents to make the numbers
      non-cumulative.  This must be done post-order (i.e. all leafs
      adjusted before parents).  We ensure this by starting at the end of
@@ -399,7 +409,7 @@ finish_solvable(struct parsedata *pd, Solvable *s, Id handle, Offset freshens)
          lastreal = p + 1;
       for (p = lastreal; *p; p++)
        {
-         str = id2str(pool, *p);
+         str = pool_id2str(pool, *p);
          if (*str != '/')
            lastreal = p + 1;
        }
@@ -409,13 +419,13 @@ finish_solvable(struct parsedata *pd, Solvable *s, Id handle, Offset freshens)
            {
              char fname_buf[128];
              const char *fname;
-             str = id2str(pool, *p);
+             str = pool_id2str(pool, *p);
              sp = strrchr(str, '/');
              /* Need to copy filename now, before we add string that could
                 realloc the stringspace (and hence invalidate str).  */
              fname = sp + 1;
              if (strlen(fname) >= 128)
-               fname = strdup(fname);
+               fname = solv_strdup(fname);
              else
                {
                  memcpy(fname_buf, fname, strlen(fname) + 1);
@@ -423,7 +433,7 @@ finish_solvable(struct parsedata *pd, Solvable *s, Id handle, Offset freshens)
                }
              if (sp - str >= 128)
                {
-                 char *sdup = strdup(str);
+                 char *sdup = solv_strdup(str);
                  sdup[sp - str] = 0;
                  did = repodata_str2dir(pd->data, sdup, 1);
                  free(sdup);
@@ -449,7 +459,7 @@ finish_solvable(struct parsedata *pd, Solvable *s, Id handle, Offset freshens)
      to do twice (in case we see the same package twice).  */
   if (s->name && s->arch != ARCH_SRC && s->arch != ARCH_NOSRC)
     s->provides = repo_addid_dep(pd->repo, s->provides,
-               rel2id(pool, s->name, s->evr, REL_EQ, 1), 0);
+               pool_rel2id(pool, s->name, s->evr, REL_EQ, 1), 0);
   /* XXX This uses repo_addid_dep internally, so should also be
      harmless to do twice.  */
   s->supplements = repo_fix_supplements(pd->repo, s->provides, s->supplements, freshens);
@@ -462,7 +472,7 @@ static Hashtable
 joinhash_init(Repo *repo, Hashmask *hmp)
 {
   Hashmask hm = mkmask(repo->nsolvables);
-  Hashtable ht = sat_calloc(hm + 1, sizeof(*ht));
+  Hashtable ht = solv_calloc(hm + 1, sizeof(*ht));
   Hashval h, hh;
   Solvable *s;
   int i;
@@ -539,7 +549,7 @@ lookup_shared_id(Repodata *data, Id p, Id keyname, Id voidid, int uninternalized
  * flags: flags
  */
 
-void
+int
 repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int flags)
 {
   Pool *pool = repo->pool;
@@ -572,10 +582,11 @@ repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int
   line = malloc(1024);
   aline = 1024;
 
-  pd.repo = pd.common.repo = repo;
+  pd.pool = pool;
+  pd.repo = repo;
   pd.data = data;
-  pd.common.pool = pool;
   pd.flags = flags;
+  pd.language = language && *language ? solv_strdup(language) : 0;
 
   linep = line;
   s = 0;
@@ -586,7 +597,8 @@ repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int
     {
       Repodata *sdata;
       int i;
-      for (i = 0, sdata = repo->repodata; i < repo->nrepodata; i++, sdata++)
+      
+      FOR_REPODATAS(repo, i, sdata)
        {
          int p;
          if (!repodata_has_keyname(sdata, SUSETAGS_SHARE_NAME))
@@ -605,7 +617,7 @@ repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int
                continue;
              if (p - repo->start >= pd.nshare)
                {
-                 pd.share_with = sat_realloc2(pd.share_with, p - repo->start + 256, sizeof(*pd.share_with));
+                 pd.share_with = solv_realloc2(pd.share_with, p - repo->start + 256, sizeof(*pd.share_with));
                  memset(pd.share_with + pd.nshare, 0, (p - repo->start + 256 - pd.nshare) * sizeof(*pd.share_with));
                  pd.nshare = p - repo->start + 256;
                }
@@ -657,7 +669,7 @@ repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int
          if (is_end
              && strncmp(linep - 1 - intag, line + 1, intag))
            {
-             pool_debug(pool, SAT_ERROR, "susetags: Nonmatching multi-line tags: %d: '%s' '%s' %d\n", pd.lineno, linep - 1 - intag, line + 1, intag);
+             pool_debug(pool, SOLV_ERROR, "susetags: Nonmatching multi-line tags: %d: '%s' '%s' %d\n", pd.lineno, linep - 1 - intag, line + 1, intag);
            }
          if (cummulate && !is_end)
            {
@@ -689,7 +701,7 @@ repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int
          char *tagend = strchr(line, ':');
          if (!tagend)
            {
-             pool_debug(pool, SAT_FATAL, "susetags: bad line: %d: %s\n", pd.lineno, line);
+             pool_debug(pool, SOLV_FATAL, "susetags: bad line: %d: %s\n", pd.lineno, line);
              exit(1);
            }
          intag = tagend - (line + 1);
@@ -716,26 +728,28 @@ repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int
        continue;
       if (! (line[0] && line[1] && line[2] && line[3] && (line[4] == ':' || line[4] == '.')))
         continue;
+      line_lang[0] = 0;
       if (line[4] == '.')
         {
           char *endlang;
           endlang = strchr(line + 5, ':');
           if (endlang)
             {
+             int langsize = endlang - (line + 5);
               keylen = endlang - line - 1;
-              strncpy(line_lang, line + 5, 5);
-              line_lang[endlang - line - 5] = 0;
+             if (langsize > 5)
+               langsize = 5;
+              strncpy(line_lang, line + 5, langsize);
+              line_lang[langsize] = 0;
             }
         }
-      else
-        line_lang[0] = 0;
       tag = tag_from_string(line);
 
       if (indelta)
        {
          /* Example:
            =Dlt: subversion 1.6.16 1.3.1 i586
-           =Dsq: subversion-1.6.15-4.2-d57b3fc86e7a2f73796e8e35b96fa86212c910
+           =Dsq: subversion 1.6.15 4.2 i586 d57b3fc86e7a2f73796e8e35b96fa86212c910
            =Cks: SHA1 14a8410cf741856a5d70d89dab62984dba6a1ca7
            =Loc: 1 subversion-1.6.15_1.6.16-4.2_1.3.1.i586.delta.rpm
            =Siz: 81558
@@ -744,45 +758,15 @@ repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int
            {
            case CTAG('=', 'D', 's', 'q'):
              {
-               char *seqevr = 0, *seqname = 0, *seqnum;
-               seqnum = strrchr(line + 6, '-');
-               if (seqnum)
-                 {
-                   *seqnum++ = 0;
-                   if ((seqevr = strrchr(line + 6, '-')) != 0)
-                     {
-                       char *evr2;
-                       *seqevr = 0;
-                       if ((evr2 = strrchr(line + 6, '-')) != 0)
-                         {
-                           *seqevr = '-';
-                           seqevr = evr2;
-                           *seqevr = 0;
-                         }
-                       seqname = line + 6;
-                       seqevr++;
-                     }
-                 }
-               else
-                 seqnum = line + 6;
-               if (seqname)
-                 repodata_set_id(data, handle, DELTA_SEQ_NAME, str2id(pool, seqname, 1));
-               if (seqevr)
-                 repodata_set_id(data, handle, DELTA_SEQ_EVR, str2id(pool, seqevr, 1));
-               repodata_set_str(data, handle, DELTA_SEQ_NUM, seqnum);
-               if (seqevr)
-                 {
-                   if (indelta != 1)
-                     {
-                       /* XXX: strip of arch part. should create DELTA_SEQ_ARCH instead. */
-                       const char *dltarch = id2str(pool, indelta);
-                       int dltarchl = strlen(dltarch);
-                       int l = strlen(seqevr);
-                       if (l > dltarchl + 1 && seqevr[l - dltarchl - 1] == '.' && !strcmp(seqevr + l - dltarchl, dltarch))
-                         seqevr[l - dltarchl - 1] = 0;
-                       repodata_set_id(data, handle, DELTA_BASE_EVR, str2id(pool, seqevr, 1));
-                     }
-                 }
+               Id evr;
+               if (split(line + 5, sp, 5) != 5)
+                 continue;
+               repodata_set_id(data, handle, DELTA_SEQ_NAME, pool_str2id(pool, sp[0], 1));
+               evr = makeevr(pool, join2(&pd.jd, sp[1], "-", sp[2]));
+               repodata_set_id(data, handle, DELTA_SEQ_EVR, evr);
+               /* repodata_set_id(data, handle, DELTA_SEQ_ARCH, pool_str2id(pool, sp[3], 1)); */
+               repodata_set_str(data, handle, DELTA_SEQ_NUM, sp[4]);
+               repodata_set_id(data, handle, DELTA_BASE_EVR, evr);
                continue;
              }
            case CTAG('=', 'C', 'k', 's'):
@@ -793,7 +777,7 @@ repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int
                int i = split(line + 6, sp, 3);
                if (i != 2 && i != 3)
                  {
-                   pool_debug(pool, SAT_FATAL, "susetags: bad location line: %d: %s\n", pd.lineno, line);
+                   pool_debug(pool, SOLV_FATAL, "susetags: bad location line: %d: %s\n", pd.lineno, line);
                    exit(1);
                  }
                set_delta_location(data, handle, atoi(sp[0]), i == 3 ? sp[2] : 0, sp[1]);
@@ -810,7 +794,7 @@ repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int
              indelta = 0;
              break;
            default:
-             pool_debug(pool, SAT_ERROR, "susetags: unknown line: %d: %s\n", pd.lineno, line);
+             pool_debug(pool, SOLV_ERROR, "susetags: unknown line: %d: %s\n", pd.lineno, line);
              continue;
            }
        }
@@ -823,23 +807,21 @@ repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int
        */
       if (tag == CTAG('=', 'D', 'l', 't'))
        {
-         Id dltarch;
          if (s)
            finish_solvable(&pd, s, handle, freshens);
          s = 0;
          pd.kind = 0;
           if (split(line + 5, sp, 5) != 4)
            {
-             pool_debug(pool, SAT_FATAL, "susetags: bad line: %d: %s\n", pd.lineno, line);
+             pool_debug(pool, SOLV_FATAL, "susetags: bad line: %d: %s\n", pd.lineno, line);
              exit(1);
            }
          handle = repodata_new_handle(data);
-         repodata_set_id(data, handle, DELTA_PACKAGE_NAME, str2id(pool, sp[0], 1));
-         repodata_set_id(data, handle, DELTA_PACKAGE_EVR, makeevr(pool, join2(sp[1], "-", sp[2])));
-         dltarch = str2id(pool, sp[3], 1);
-         repodata_set_id(data, handle, DELTA_PACKAGE_ARCH, dltarch);
+         repodata_set_id(data, handle, DELTA_PACKAGE_NAME, pool_str2id(pool, sp[0], 1));
+         repodata_set_id(data, handle, DELTA_PACKAGE_EVR, makeevr(pool, join2(&pd.jd, sp[1], "-", sp[2])));
+         repodata_set_id(data, handle, DELTA_PACKAGE_ARCH, pool_str2id(pool, sp[3], 1));
          repodata_add_flexarray(data, SOLVID_META, REPOSITORY_DELTAINFO, handle);
-         indelta = dltarch ? dltarch : 1;
+         indelta = 1;
          continue;
        }
       if (tag == CTAG('=', 'P', 'k', 'g')
@@ -864,7 +846,7 @@ repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int
 
           if (split(line + 5, sp, 5) != 4)
            {
-             pool_debug(pool, SAT_FATAL, "susetags: bad line: %d: %s\n", pd.lineno, line);
+             pool_debug(pool, SOLV_FATAL, "susetags: bad line: %d: %s\n", pd.lineno, line);
              exit(1);
            }
          s = 0;
@@ -877,11 +859,11 @@ repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int
              Id name, evr, arch;
              /* we don't use the create flag here as a simple pre-check for existance */
              if (pd.kind)
-               name = str2id(pool, join2(pd.kind, ":", sp[0]), 0);
+               name = pool_str2id(pool, join2(&pd.jd, pd.kind, ":", sp[0]), 0);
              else
-               name = str2id(pool, sp[0], 0);
-             evr = makeevr(pool, join2(sp[1], "-", sp[2]));
-             arch = str2id(pool, sp[3], 0);
+               name = pool_str2id(pool, sp[0], 0);
+             evr = makeevr(pool, join2(&pd.jd, sp[1], "-", sp[2]));
+             arch = pool_str2id(pool, sp[3], 0);
              if (name && arch)
                {
                  if (repo->start + last_found_pack + 1 < repo->end)
@@ -902,11 +884,11 @@ repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int
              /* normal operation. create a new solvable. */
              s = pool_id2solvable(pool, repo_add_solvable(repo));
              if (pd.kind)
-               s->name = str2id(pool, join2(pd.kind, ":", sp[0]), 1);
+               s->name = pool_str2id(pool, join2(&pd.jd, pd.kind, ":", sp[0]), 1);
              else
-               s->name = str2id(pool, sp[0], 1);
-             s->evr = makeevr(pool, join2(sp[1], "-", sp[2]));
-             s->arch = str2id(pool, sp[3], 1);
+               s->name = pool_str2id(pool, sp[0], 1);
+             s->evr = makeevr(pool, join2(&pd.jd, sp[1], "-", sp[2]));
+             s->arch = pool_str2id(pool, sp[3], 1);
              s->vendor = defvendor;
              createdpkgs = 1;
            }
@@ -921,7 +903,7 @@ repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int
       if (indesc >= 2 && !s)
         {
 #if 0
-         pool_debug(pool, SAT_ERROR, "susetags: huh %d: %s?\n", pd.lineno, line);
+         pool_debug(pool, SOLV_ERROR, "susetags: huh %d: %s?\n", pd.lineno, line);
 #endif
           continue;
        }
@@ -989,13 +971,13 @@ repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int
            indesc++;
            if (createdpkgs)
              {
-               sat_free(joinhash);
+               solv_free(joinhash);
                joinhash = joinhash_init(repo, &joinhashm);
                createdpkgs = 0;
              }
            continue;
           case CTAG('=', 'V', 'n', 'd'):                                        /* vendor */
-            s->vendor = str2id(pool, line + 6, 1);
+            s->vendor = pool_str2id(pool, line + 6, 1);
             continue;
 
         /* From here it's the attribute tags.  */
@@ -1010,10 +992,10 @@ repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int
              int i = split(line + 6, sp, 3);
              if (i != 2 && i != 3)
                {
-                 pool_debug(pool, SAT_FATAL, "susetags: bad location line: %d: %s\n", pd.lineno, line);
+                 pool_debug(pool, SOLV_FATAL, "susetags: bad location line: %d: %s\n", pd.lineno, line);
                  exit(1);
                }
-             repodata_set_location(data, handle, atoi(sp[0]), i == 3 ? sp[2] : id2str(pool, s->arch), sp[1]);
+             repodata_set_location(data, handle, atoi(sp[0]), i == 3 ? sp[2] : pool_id2str(pool, s->arch), sp[1]);
            }
            continue;
           case CTAG('=', 'S', 'r', 'c'):
@@ -1040,19 +1022,19 @@ repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int
            repodata_set_str(data, handle, SOLVABLE_AUTHORS, line + 6);
            continue;
           case CTAG('=', 'S', 'u', 'm'):
-            repodata_set_str(data, handle, langtag(&pd, SOLVABLE_SUMMARY, language ? language : line_lang), line + 3 + keylen );
+            repodata_set_str(data, handle, langtag(&pd, SOLVABLE_SUMMARY, line_lang), line + 3 + keylen);
             continue;
           case CTAG('=', 'D', 'e', 's'):
-           repodata_set_str(data, handle, langtag(&pd, SOLVABLE_DESCRIPTION, language ? language : line_lang), line + 3 + keylen );
+           repodata_set_str(data, handle, langtag(&pd, SOLVABLE_DESCRIPTION, line_lang), line + 3 + keylen);
            continue;
           case CTAG('=', 'E', 'u', 'l'):
-           repodata_set_str(data, handle, langtag(&pd, SOLVABLE_EULA, language), line + 6);
+           repodata_set_str(data, handle, langtag(&pd, SOLVABLE_EULA, line_lang), line + 6);
            continue;
           case CTAG('=', 'I', 'n', 's'):
-           repodata_set_str(data, handle, langtag(&pd, SOLVABLE_MESSAGEINS, language), line + 6);
+           repodata_set_str(data, handle, langtag(&pd, SOLVABLE_MESSAGEINS, line_lang), line + 6);
            continue;
           case CTAG('=', 'D', 'e', 'l'):
-           repodata_set_str(data, handle, langtag(&pd, SOLVABLE_MESSAGEDEL, language), line + 6);
+           repodata_set_str(data, handle, langtag(&pd, SOLVABLE_MESSAGEDEL, line_lang), line + 6);
            continue;
           case CTAG('=', 'V', 'i', 's'):
            {
@@ -1060,7 +1042,7 @@ repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int
              unsigned k;
              k = atoi(line + 6);
              if (k || !strcasecmp(line + 6, "true"))
-               repodata_set_void(data, handle, SOLVABLE_ISVISIBLE );
+               repodata_set_void(data, handle, SOLVABLE_ISVISIBLE);
            }
            continue;
           case CTAG('=', 'S', 'h', 'r'):
@@ -1068,15 +1050,15 @@ repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int
              Id name, evr, arch;
              if (split(line + 6, sp, 5) != 4)
                {
-                 pool_debug(pool, SAT_FATAL, "susetags: bad =Shr line: %s\n", line + 6);
+                 pool_debug(pool, SOLV_FATAL, "susetags: bad =Shr line: %s\n", line + 6);
                  exit(1);
                }
-             name = str2id(pool, sp[0], 1);
-             evr = makeevr(pool, join2(sp[1], "-", sp[2]));
-             arch = str2id(pool, sp[3], 1);
+             name = pool_str2id(pool, sp[0], 1);
+             evr = makeevr(pool, join2(&pd.jd, sp[1], "-", sp[2]));
+             arch = pool_str2id(pool, sp[3], 1);
              if (last_found_pack >= pd.nshare)
                {
-                 pd.share_with = sat_realloc2(pd.share_with, last_found_pack + 256, sizeof(*pd.share_with));
+                 pd.share_with = solv_realloc2(pd.share_with, last_found_pack + 256, sizeof(*pd.share_with));
                  memset(pd.share_with + pd.nshare, 0, (last_found_pack + 256 - pd.nshare) * sizeof(*pd.share_with));
                  pd.nshare = last_found_pack + 256;
                }
@@ -1115,16 +1097,18 @@ repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int
            repodata_set_str(data, handle, SOLVABLE_ICON, line + 6);
            break;
          case CTAG('=', 'E', 'x', 't'):
-           repodata_add_poolstr_array(data, handle, SOLVABLE_EXTENDS, join2("pattern", ":", line + 6));
+           repodata_add_poolstr_array(data, handle, SOLVABLE_EXTENDS, join2(&pd.jd, "pattern", ":", line + 6));
            break;
          case CTAG('=', 'I', 'n', 'c'):
-           repodata_add_poolstr_array(data, handle, SOLVABLE_INCLUDES, join2("pattern", ":", line + 6));
+           repodata_add_poolstr_array(data, handle, SOLVABLE_INCLUDES, join2(&pd.jd, "pattern", ":", line + 6));
            break;
          case CTAG('=', 'C', 'k', 's'):
            set_checksum(&pd, data, handle, SOLVABLE_CHECKSUM, line + 6);
            break;
          case CTAG('=', 'L', 'a', 'n'):
-           language = strdup(line + 6);
+           pd.language = solv_free(pd.language);
+           if (line[6])
+             pd.language = solv_strdup(line + 6);
            break;
 
          case CTAG('=', 'F', 'l', 's'):
@@ -1167,7 +1151,7 @@ repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int
            break;
 
          default:
-           pool_debug(pool, SAT_ERROR, "susetags: unknown line: %d: %s\n", pd.lineno, line);
+           pool_debug(pool, SOLV_ERROR, "susetags: unknown line: %d: %s\n", pd.lineno, line);
            break;
        }
 
@@ -1230,12 +1214,12 @@ repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int
       map_free(&keyidmap);
     }
 
-  sat_free(joinhash);
+  solv_free(joinhash);
   if (!(flags & REPO_NO_INTERNALIZE))
     repodata_internalize(data);
 
-  if (pd.common.tmp)
-    free(pd.common.tmp);
+  solv_free(pd.language);
   free(line);
-  join_freemem();
+  join_freemem(&pd.jd);
+  return 0;
 }