summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Schroeder <mls@suse.de>2012-03-30 19:20:31 +0200
committerMichael Schroeder <mls@suse.de>2012-03-30 19:20:31 +0200
commit7609adb10abd3e602f40f448767556177aac7e68 (patch)
tree513d651c115c4ecec9d211d462554e9e03002626
parent8621f7de539e074fa9d59b8f1daa9aef9420886b (diff)
downloadlibsolv-7609adb10abd3e602f40f448767556177aac7e68.tar.gz
libsolv-7609adb10abd3e602f40f448767556177aac7e68.tar.bz2
libsolv-7609adb10abd3e602f40f448767556177aac7e68.zip
- also implement files.xml parsing for m&m
-rw-r--r--ext/repo_mdk.c38
-rw-r--r--tools/mdk2solv.c19
2 files changed, 55 insertions, 2 deletions
diff --git a/ext/repo_mdk.c b/ext/repo_mdk.c
index 43b6f2e..f8ece96 100644
--- a/ext/repo_mdk.c
+++ b/ext/repo_mdk.c
@@ -253,6 +253,7 @@ enum state {
STATE_START,
STATE_MEDIA_INFO,
STATE_INFO,
+ STATE_FILES,
NUMSTATES
};
@@ -267,6 +268,7 @@ struct stateswitch {
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 }
};
@@ -480,6 +482,13 @@ startElement(void *userData, const char *name, const char **atts)
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;
}
@@ -503,6 +512,35 @@ endElement(void *userData, const char *name)
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;
}
diff --git a/tools/mdk2solv.c b/tools/mdk2solv.c
index cec705e..f680f65 100644
--- a/tools/mdk2solv.c
+++ b/tools/mdk2solv.c
@@ -36,6 +36,7 @@ usage(int status)
"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);
@@ -46,10 +47,10 @@ main(int argc, char **argv)
{
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)
{
@@ -59,6 +60,9 @@ main(int argc, char **argv)
case 'i':
infofile = optarg;
break;
+ case 'f':
+ filesfile = optarg;
+ break;
default:
usage(1);
break;
@@ -78,6 +82,17 @@ main(int argc, char **argv)
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);