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];
58 memcpy (new_id + new_id_size, repo->idarraydata,
59 repo->idarraysize * sizeof (new_id[0]));
60 FOR_REPO_SOLVABLES (repo, si, s)
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 s->repo = pool->repos[0];
83 new_id_size += repo->idarraysize;
86 pool->repos[0]->nsolvables += repo->nsolvables;
87 if (pool->repos[0]->start > repo->start)
88 pool->repos[0]->start = repo->start;
89 if (pool->repos[0]->end < repo->end)
90 pool->repos[0]->end = repo->end;
92 repo->start = pool->nsolvables;
93 repo->end = repo->start;
94 free (repo->idarraydata);
95 repo->idarraydata = 0;
98 while (pool->nrepos > 1)
100 repo_free(pool->repos[pool->nrepos - 1], 1);
102 free (pool->repos[0]->idarraydata);
103 pool->repos[0]->idarraydata = new_id;
104 pool->repos[0]->idarraysize = new_id_size;
106 repo_write(pool->repos[0], stdout);