STATE_START,
STATE_MEDIA_INFO,
STATE_INFO,
+ STATE_FILES,
NUMSTATES
};
static struct stateswitch stateswitches[] = {
{ STATE_START, "media_info", STATE_MEDIA_INFO, 0 },
{ STATE_MEDIA_INFO, "info", STATE_INFO, 1 },
+ { STATE_MEDIA_INFO, "files", STATE_FILES, 1 },
{ NUMSTATES }
};
set_sourcerpm(pd->data, pd->solvable, pd->solvable - pool->solvables, str);
break;
}
+ case STATE_FILES:
+ {
+ const char *fn = find_attr("fn", atts);
+ const char *distepoch = find_attr("distepoch", atts);
+ pd->solvable = joinhash_lookup(pd->repo, pd->joinhash, pd->joinhashmask, fn, distepoch);
+ break;
+ }
default:
break;
}
if (s && *pd->content)
repodata_set_str(pd->data, s - pd->pool->solvables, SOLVABLE_DESCRIPTION, pd->content);
break;
+ case STATE_FILES:
+ if (s && *pd->content)
+ {
+ char *np, *p, *sl;
+ for (p = pd->content; p && *p; p = np)
+ {
+ Id id;
+ np = strchr(p, '\n');
+ if (np)
+ *np++ = 0;
+ if (!*p)
+ continue;
+ sl = strrchr(p, '/');
+ if (sl)
+ {
+ *sl++ = 0;
+ id = repodata_str2dir(pd->data, p, 1);
+ }
+ else
+ {
+ sl = p;
+ id = 0;
+ }
+ if (!id)
+ id = repodata_str2dir(pd->data, "/", 1);
+ repodata_add_dirstr(pd->data, s - pd->pool->solvables, SOLVABLE_FILELIST, id, sl);
+ }
+ }
+ break;
default:
break;
}
"mdk2solv [-i <infoxml>]\n"
" reads a 'synthesis' repository from <stdin> and writes a .solv file to <stdout>\n"
" -i : info.xml file for extra attributes\n"
+ " -f : files.xml file for extra attributes\n"
" -h : print help & exit\n"
);
exit(status);
{
Pool *pool;
Repo *repo;
- char *infofile;
+ char *infofile = 0, *filesfile = 0;
int c;
- while ((c = getopt(argc, argv, "hi:")) >= 0)
+ while ((c = getopt(argc, argv, "hi:f:")) >= 0)
{
switch(c)
{
case 'i':
infofile = optarg;
break;
+ case 'f':
+ filesfile = optarg;
+ break;
default:
usage(1);
break;
repo_add_mdk_info(repo, fp, REPO_EXTEND_SOLVABLES | REPO_REUSE_REPODATA | REPO_NO_INTERNALIZE);
fclose(fp);
}
+ if (filesfile)
+ {
+ FILE *fp = solv_xfopen(filesfile, "r");
+ if (!fp)
+ {
+ perror(filesfile);
+ exit(1);
+ }
+ repo_add_mdk_info(repo, fp, REPO_EXTEND_SOLVABLES | REPO_REUSE_REPODATA | REPO_NO_INTERNALIZE);
+ fclose(fp);
+ }
repo_internalize(repo);
tool_write(repo, 0, 0);
pool_free(pool);