2 * Copyright (c) 2007, Novell Inc.
4 * This program is licensed under the BSD license, read LICENSE.BSD
5 * for further information
13 #include <sys/types.h>
22 #include "repo_solv.h"
23 #include "repo_write.h"
26 main(int argc, char **argv)
28 Pool *pool = pool_create();
37 if ((fp = fopen(*argv, "r")) == NULL)
42 repo_add_solv(repo_create(pool, ""), fp);
49 for (i = 0; i < pool->nrepos; i++)
50 new_id_size += pool->repos[i]->idarraysize;
51 new_id = (Id*) malloc (sizeof (Id) * new_id_size);
53 for (i = 0; i < pool->nrepos; i++)
55 Repo *repo = pool->repos[i];
57 memcpy (new_id + new_id_size, repo->idarraydata,
58 repo->idarraysize * sizeof (new_id[0]));
59 for (si = repo->start; si < repo->start + repo->nsolvables; si++)
61 Solvable *s = pool->solvables + si;
63 s->provides += new_id_size;
65 s->obsoletes += new_id_size;
67 s->conflicts += new_id_size;
69 s->requires += new_id_size;
71 s->recommends += new_id_size;
73 s->suggests+= new_id_size;
75 s->supplements += new_id_size;
77 s->enhances += new_id_size;
79 s->freshens += new_id_size;
81 new_id_size += repo->idarraysize;
84 pool->repos[0]->nsolvables += repo->nsolvables;
86 repo->start = pool->nsolvables;
87 free (repo->idarraydata);
88 repo->idarraydata = 0;
91 while (pool->nrepos > 1)
93 repo_free(pool->repos[pool->nrepos - 1], 1);
95 free (pool->repos[0]->idarraydata);
96 pool->repos[0]->idarraydata = new_id;
97 pool->repos[0]->idarraysize = new_id_size;
99 repo_write(pool->repos[0], stdout);