- fix susetags2solv -b bugs
authorMichael Schroeder <mls@suse.de>
Tue, 4 Mar 2008 18:12:08 +0000 (18:12 +0000)
committerMichael Schroeder <mls@suse.de>
Tue, 4 Mar 2008 18:12:08 +0000 (18:12 +0000)
- do not hardcode dir 1

tools/repo_rpmmd.c
tools/repo_susetags.c
tools/susetags2solv.c

index ef62056..8a35775 100644 (file)
@@ -708,13 +708,16 @@ endElement(void *userData, const char *name)
       id = str2id(pool, pd->content, 1);
       s->provides = repo_addid_dep(repo, s->provides, id, SOLVABLE_FILEMARKER);
 #endif
-      if ((p = strrchr(pd->content, '/')) != 0) {
-       *p++ = 0;
-       id = repodata_str2dir(pd->data, pd->content, 1);
-      } else {
-       id = 1;
-       p = pd->content;
-      }
+      if ((p = strrchr(pd->content, '/')) != 0)
+       {
+         *p++ = 0;
+         id = repodata_str2dir(pd->data, pd->content, 1);
+       }
+      else
+       {
+         p = pd->content;
+         id = repodata_str2dir(pd->data, "/", 1);
+       }
       repodata_add_dirstr(pd->data, entry, SOLVABLE_FILELIST, id, p);
       break;
     // xml store capabilities
index e80b3b2..fb2cb49 100644 (file)
@@ -851,7 +851,7 @@ repo_add_susetags(Repo *repo, FILE *fp, Id vendor, const char *language, int fla
                  }
              }
            if (n != repo->end)
-             repodata_merge_attrs (data, i, last_found);
+             repodata_merge_attrs(data, i, last_found);
          }
       free (pd.share_with);
     }
index aa9e069..05c6832 100644 (file)
@@ -150,6 +150,26 @@ main(int argc, char **argv)
          perror(descrdir);
          exit(1);
        }
+
+      /* bring packages to front */
+      for (i = 0; i < ndirs; i++)
+       {
+         char *fn = files[i]->d_name;
+         if (!strcmp(fn, "packages") || !strcmp(fn, "packages.gz"))
+           break;
+        }
+      if (i == ndirs)
+       {
+         fprintf(stderr, "found no packages file\n");
+         exit(1);
+       }
+      if (i)
+       {
+         struct dirent *de = files[i];
+         memmove(files + 1, files, i * sizeof(de));
+         files[0] = de;
+       }
+
       fnp = sat_malloc(strlen(descrdir) + 128);
       for (i = 0; i < ndirs; i++)
        {
@@ -184,11 +204,11 @@ main(int argc, char **argv)
              char lang[6];
              char *p;
              sprintf(fnp, "%s/%s", descrdir, fn);
-             p = strrchr(fn, '.');
+             p = strrchr(fnp, '.');
              if (p && !strcmp(p, ".gz"))
                {
                  *p = 0;
-                 p = strrchr(fn, '.');
+                 p = strrchr(fnp, '.');
                }
              if (!p || !p[1] || strlen(p + 1) > 5)
                continue;
@@ -204,6 +224,8 @@ main(int argc, char **argv)
              fclose(fp);
            }
        }
+      for (i = 0; i < ndirs; i++)
+       free(files[i]);
       free(files);
       free(fnp);
     }