summaryrefslogtreecommitdiff
path: root/tools/dumpsolv.c
diff options
context:
space:
mode:
authorMichael Matz <matz@suse.de>2008-04-01 22:24:07 +0000
committerMichael Matz <matz@suse.de>2008-04-01 22:24:07 +0000
commit20d96c2387bb7ab5b3b2fe2d9aac0c0fca87c395 (patch)
tree8b248598899eb74fa3541324a705b557eebd86d8 /tools/dumpsolv.c
parent45f8cbabcb882b30b405b5626e8034c452cc2fd6 (diff)
downloadlibsolv-20d96c2387bb7ab5b3b2fe2d9aac0c0fca87c395.tar.gz
libsolv-20d96c2387bb7ab5b3b2fe2d9aac0c0fca87c395.tar.bz2
libsolv-20d96c2387bb7ab5b3b2fe2d9aac0c0fca87c395.zip
Working but for now inactive code to support non-solvables (things which
have attributes, but are not solvables). The usual functions interpret negative entry numbers as those (positive ones are solvable IDs). I'll probably refine the code some more, hence it's work in progress. susetags2repo: Parse also a "=Lan:" tag, which can be injected externally when multiple language tag files are catted together.
Diffstat (limited to 'tools/dumpsolv.c')
-rw-r--r--tools/dumpsolv.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/tools/dumpsolv.c b/tools/dumpsolv.c
index 0c9816a..a6f5fe4 100644
--- a/tools/dumpsolv.c
+++ b/tools/dumpsolv.c
@@ -58,28 +58,28 @@ printids(Repo *repo, char *kind, Offset ido)
}
int
-dump_repoattrs_cb(void *vcbdata, Solvable *s, Repodata *data, Repokey *key, KeyValue *kv)
+dump_attr(Repo *repo, Repodata *data, Repokey *key, KeyValue *kv)
{
const char *keyname;
- keyname = id2str(s->repo->pool, key->name);
+ keyname = id2str(repo->pool, key->name);
switch(key->type)
{
case REPOKEY_TYPE_ID:
if (data && data->localpool)
kv->str = stringpool_id2str(&data->spool, kv->id);
else
- kv->str = id2str(s->repo->pool, kv->id);
+ kv->str = id2str(repo->pool, kv->id);
printf("%s: %s\n", keyname, kv->str);
break;
case REPOKEY_TYPE_CONSTANTID:
- printf("%s: %s\n", keyname, dep2str(s->repo->pool, kv->id));
+ printf("%s: %s\n", keyname, dep2str(repo->pool, kv->id));
break;
case REPOKEY_TYPE_IDARRAY:
if (data && data->localpool)
printf("%s: %s\n", keyname, stringpool_id2str(&data->spool, kv->id));
else
- printf("%s: %s\n", keyname, dep2str(s->repo->pool, kv->id));
+ printf("%s: %s\n", keyname, dep2str(repo->pool, kv->id));
break;
case REPOKEY_TYPE_STR:
printf("%s: %s\n", keyname, kv->str);
@@ -110,6 +110,12 @@ dump_repoattrs_cb(void *vcbdata, Solvable *s, Repodata *data, Repokey *key, KeyV
return 0;
}
+static int
+dump_repoattrs_cb(void *vcbdata, Solvable *s, Repodata *data, Repokey *key, KeyValue *kv)
+{
+ return dump_attr(s->repo, data, key, kv);
+}
+
/*
* dump all attributes for Id <p>
*/
@@ -123,8 +129,7 @@ dump_repoattrs(Repo *repo, Id p)
Dataiterator di;
dataiterator_init(&di, repo, p, 0, 0, SEARCH_NO_STORAGE_SOLVABLE);
while (dataiterator_step(&di))
- dump_repoattrs_cb(0, repo->pool->solvables + di.solvid, di.data, di.key,
- &di.kv);
+ dump_attr(repo, di.data, di.key, &di.kv);
#endif
}
@@ -244,7 +249,7 @@ int main(int argc, char **argv)
printf("could not read repository\n");
printf("pool contains %d strings, %d rels, string size is %d\n", pool->ss.nstrings, pool->nrels, pool->ss.sstrings);
dump_repodata(repo);
- printf("repo contains %d solvables\n", repo->nsolvables);
+ printf("repo contains %d solvables %d non-solvables\n", repo->nsolvables, repo->nextra);
for (i = repo->start, n = 1; i < repo->end; i++)
{
s = pool->solvables + i;
@@ -276,6 +281,14 @@ int main(int argc, char **argv)
#endif
n++;
}
+ for (i = 0; i < repo->nextra; i++)
+ {
+ printf("\nextra %d:\n", i);
+ Dataiterator di;
+ dataiterator_init(&di, repo, -1 - i, 0, 0, SEARCH_EXTRA | SEARCH_NO_STORAGE_SOLVABLE);
+ while (dataiterator_step(&di))
+ dump_attr(repo, di.data, di.key, &di.kv);
+ }
#if 0
tryme(repo, 0, SOLVABLE_MEDIANR, 0, 0);
printf("\n");