-/* -*- mode: C; c-file-style: "gnu"; fill-column: 78 -*- */
+/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
/*
* repo_helix.c
*
STATE_SUBCHANNEL,
STATE_PACKAGE,
STATE_NAME,
+ STATE_VENDOR,
STATE_HISTORY,
STATE_UPDATE,
STATE_EPOCH,
{ STATE_SUBCHANNEL, "patch", STATE_PACKAGE, 0 },
{ STATE_SUBCHANNEL, "product", STATE_PACKAGE, 0 },
{ STATE_PACKAGE, "name", STATE_NAME, 1 },
+ { STATE_PACKAGE, "vendor", STATE_VENDOR, 1 },
{ STATE_PACKAGE, "epoch", STATE_PEPOCH, 1 },
{ STATE_PACKAGE, "version", STATE_PVERSION, 1 },
{ STATE_PACKAGE, "release", STATE_PRELEASE, 1 },
if ((pd->pack & PACK_BLOCK) == 0) /* alloc new block ? */
{
pool->solvables = (Solvable *)realloc(pool->solvables, (pool->nsolvables + pd->pack + PACK_BLOCK + 1) * sizeof(Solvable));
- pd->start = pool->solvables + pd->repo->start;
+ pd->start = pool->solvables + pool->nsolvables;
memset(pd->start + pd->pack, 0, (PACK_BLOCK + 1) * sizeof(Solvable));
}
char *cflavor = strdup(flavor); /* make pointer safe */
Id npr;
- Id pid, *pidp;
+ Id pid;
/* this is either a kernel package or a kmp */
if (s->provides)
{
+ Offset prov = s->provides;
npr = 0;
- for (pidp = pd->repo->idarraydata + s->provides; (pid = *pidp++) != 0; )
+ while ((pid = pd->repo->idarraydata[prov++]) != 0)
{
const char *depname = 0;
Reldep *prd = 0;
if (s->requires)
{
+ Offset reqs = s->requires;
npr = 0;
- for (pidp = pd->repo->idarraydata + s->requires; (pid = *pidp++) != 0; )
+ while ((pid = pd->repo->idarraydata[reqs++]) != 0)
{
const char *depname = 0;
Reldep *prd = 0;
case STATE_NAME:
s->name = str2id(pool, pd->content, 1);
break;
+ case STATE_VENDOR:
+ s->vendor = str2id(pool, pd->content, 1);
+ break;
case STATE_UPDATE: /* new version, keeping all other metadata */
evr = evr2id(pool, pd,
pd->epoch ? pd->evrspace + pd->epoch : 0,
*
*/
-Repo *
-pool_addrepo_helix(Pool *pool, FILE *fp)
+void
+repo_add_helix(Repo *repo, FILE *fp)
{
+ Pool *pool = repo->pool;
Parsedata pd;
char buf[BUFF_SIZE];
int i, l;
- Repo *repo;
struct stateswitch *sw;
- // create empty repo
- repo = pool_addrepo_empty(pool);
+ if (repo->start && repo->start + repo->nsolvables != pool->nsolvables)
+ abort();
+ if (!repo->start)
+ repo->start = pool->nsolvables;
- // prepare parsedata
+ /* prepare parsedata */
memset(&pd, 0, sizeof(pd));
for (i = 0, sw = stateswitches; sw->from != NUMSTATES; i++, sw++)
{
// adapt package count
pool->nsolvables += pd.pack;
- repo->nsolvables = pd.pack;
+ repo->nsolvables += pd.pack;
free(pd.content);
free(pd.evrspace);
-
- return repo;
}