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
}
}
if (n != repo->end)
- repodata_merge_attrs (data, i, last_found);
+ repodata_merge_attrs(data, i, last_found);
}
free (pd.share_with);
}
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++)
{
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;
fclose(fp);
}
}
+ for (i = 0; i < ndirs; i++)
+ free(files[i]);
free(files);
free(fnp);
}