- add support for susetags filelist
authorMichael Schroeder <mls@suse.de>
Fri, 25 Apr 2008 10:57:22 +0000 (10:57 +0000)
committerMichael Schroeder <mls@suse.de>
Fri, 25 Apr 2008 10:57:22 +0000 (10:57 +0000)
- plug mem join2 leak

tools/repo_rpmmd.c
tools/repo_susetags.c
tools/repo_updateinfoxml.c
tools/susetags2solv.c
tools/tools_util.h

index 607b644..419a6f9 100644 (file)
@@ -914,4 +914,5 @@ repo_add_rpmmd(Repo *repo, FILE *fp, int flags)
   if (pd.data)
     repodata_internalize(pd.data);
   sat_free(pd.content);
+  join_freemem();
 }
index 79b1793..58f203c 100644 (file)
@@ -875,6 +875,31 @@ repo_add_susetags(Repo *repo, FILE *fp, Id vendor, const char *language, int fla
            language = strdup(line + 6);
            break;
 
+         case CTAG('=', 'F', 'l', 's'):
+           {
+             if (line[6] != '/')
+               continue;       /* no relative files, please */
+             char *p = strrchr(line + 6, '/');
+             Id did;
+             if (p && p != line + 6 && !p[1])
+               {
+                 *p = 0;
+                 p = strrchr(line + 6, '/');
+               }
+             if (p)
+               {
+                 *p++ = 0;
+                 did = repodata_str2dir(data, line + 6, 1);
+               }
+             else
+               {
+                 p = line + 6;
+                 did = repodata_str2dir(data, "/", 1);
+               }
+             repodata_add_dirstr(data, handle, SOLVABLE_FILELIST, did, p);
+             continue;
+           }
+
          case CTAG('=', 'P', 'a', 't'):
          case CTAG('=', 'P', 'k', 'g'):
            break;
@@ -936,4 +961,5 @@ repo_add_susetags(Repo *repo, FILE *fp, Id vendor, const char *language, int fla
   if (pd.common.tmp)
     free(pd.common.tmp);
   free(line);
+  join_freemem();
 }
index 78fa742..41381ff 100644 (file)
@@ -643,6 +643,7 @@ repo_add_updateinfoxml(Repo *repo, FILE *fp, int flags)
     repodata_internalize(pd.data);
 
   free(pd.content);
+  join_freemem();
 }
 
 /* EOF */
index e383276..a9a8901 100644 (file)
@@ -200,6 +200,18 @@ main(int argc, char **argv)
              repo_add_susetags(repo, fp, vendor, 0, flags | SUSETAGS_EXTEND);
              fclose(fp);
            }
+         else if (!strcmp(fn, "packages.FL") || !strcmp(fn, "packages.FL.gz"))
+           {
+             sprintf(fnp, "%s/%s", descrdir, fn);
+             FILE *fp = myfopen(fnp);
+             if (!fp)
+               {
+                 perror(fn);
+                 exit(1);
+               }
+             repo_add_susetags(repo, fp, vendor, 0, flags | SUSETAGS_EXTEND);
+             fclose(fp);
+           }
          else if (!strncmp(fn, "packages.", 9))
            {
              char lang[6];
index 4b0e69d..6983bd8 100644 (file)
@@ -95,6 +95,15 @@ join2(const char *s1, const char *s2, const char *s3)
   return _join_tmp;
 }
 
+static inline void
+join_freemem(void)
+{
+  if (_join_tmp)
+    free(_join_tmp);
+  _join_tmp = 0;
+  _join_tmpl = 0;
+}
+
 // static char *
 // join(struct parsedata_common *pd, const char *s1, const char *s2, const char *s3)
 // {