return i;
}
-struct deps {
- unsigned int provides;
- unsigned int requires;
- unsigned int obsoletes;
- unsigned int conflicts;
- unsigned int recommends;
- unsigned int supplements;
- unsigned int enhances;
- unsigned int suggests;
- unsigned int freshens;
-};
-
struct parsedata {
char *kind;
Source *source;
int aline;
Source *source;
Solvable *s;
- struct deps *deps = 0, *dp = 0;
- int pack, i;
+ int pack;
struct parsedata pd;
source = pool_addsource_empty(pool);
#define istag(x) !strcmp (key, x)
if (istag ("PRODUCT"))
{
+ if (s && s->arch != ARCH_SRC && s->arch != ARCH_NOSRC)
+ s->provides = source_addid_dep(source, s->provides, rel2id(pool, s->name, s->evr, REL_EQ, 1), 0);
+ if (s)
+ s->supplements = source_fix_legacy(source, s->provides, s->supplements);
/* Only support one product. */
- assert (!dp);
pd.kind = "product";
if ((pack & PACK_BLOCK) == 0)
{
pool->solvables = realloc(pool->solvables, (pool->nsolvables + pack + PACK_BLOCK + 1) * sizeof(Solvable));
memset(pool->solvables + source->start + pack, 0, (PACK_BLOCK + 1) * sizeof(Solvable));
- if (!deps)
- deps = malloc((pack + PACK_BLOCK + 1) * sizeof(struct deps));
- else
- deps = realloc(deps, (pack + PACK_BLOCK + 1) * sizeof(struct deps));
- memset(deps + pack, 0, (PACK_BLOCK + 1) * sizeof(struct deps));
}
s = pool->solvables + source->start + pack;
s->source = source;
- dp = deps + pack;
pack++;
}
else if (istag ("VERSION"))
arch. We don't know the latter here, though. */
s->arch = str2id (pool, "noarch" , 1);
else if (istag ("PREREQUIRES"))
- dp->requires = adddep(pool, &pd, dp->requires, value, 2);
+ s->requires = adddep(pool, &pd, s->requires, value, 2);
else if (istag ("REQUIRES"))
- dp->requires = adddep(pool, &pd, dp->requires, value, 1);
+ s->requires = adddep(pool, &pd, s->requires, value, 1);
else if (istag ("PROVIDES"))
- dp->provides = adddep(pool, &pd, dp->provides, value, 0);
+ s->provides = adddep(pool, &pd, s->provides, value, 0);
else if (istag ("CONFLICTS"))
- dp->conflicts = adddep(pool, &pd, dp->conflicts, value, 0);
+ s->conflicts = adddep(pool, &pd, s->conflicts, value, 0);
else if (istag ("OBSOLETES"))
- dp->obsoletes = adddep(pool, &pd, dp->obsoletes, value, 0);
+ s->obsoletes = adddep(pool, &pd, s->obsoletes, value, 0);
else if (istag ("RECOMMENDS"))
- dp->recommends = adddep(pool, &pd, dp->recommends, value, 0);
+ s->recommends = adddep(pool, &pd, s->recommends, value, 0);
else if (istag ("SUGGESTS"))
- dp->suggests = adddep(pool, &pd, dp->suggests, value, 0);
+ s->suggests = adddep(pool, &pd, s->suggests, value, 0);
else if (istag ("SUPPLEMENTS"))
- dp->supplements = adddep(pool, &pd, dp->supplements, value, 0);
+ s->supplements = adddep(pool, &pd, s->supplements, value, 0);
else if (istag ("ENHANCES"))
- dp->enhances = adddep(pool, &pd, dp->enhances, value, 0);
+ s->enhances = adddep(pool, &pd, s->enhances, value, 0);
/* FRESHENS doesn't seem to exist. */
/* XXX do something about LINGUAS and ARCH? */
#undef istag
fprintf (stderr, "malformed line: %s\n", line);
}
- if (dp && s->arch != ARCH_SRC && s->arch != ARCH_NOSRC)
- dp->provides = source_addid_dep(source, dp->provides, rel2id(pool, s->name, s->evr, REL_EQ, 1), 0);
- if (dp)
- dp->supplements = source_fix_legacy(source, dp->provides, dp->supplements);
+ if (s && s->arch != ARCH_SRC && s->arch != ARCH_NOSRC)
+ s->provides = source_addid_dep(source, s->provides, rel2id(pool, s->name, s->evr, REL_EQ, 1), 0);
+ if (s)
+ s->supplements = source_fix_legacy(source, s->provides, s->supplements);
pool->nsolvables += pack;
source->nsolvables = pack;
- s = pool->solvables + source->start;
- for (i = 0; i < pack; i++, s++)
- {
- s->provides = deps[i].provides;
- s->requires = deps[i].requires;
- s->conflicts = deps[i].conflicts;
- s->obsoletes = deps[i].obsoletes;
- s->recommends = deps[i].recommends;
- s->supplements = deps[i].supplements;
- s->suggests = deps[i].suggests;
- s->enhances = deps[i].enhances;
- s->freshens = deps[i].freshens;
- }
-
- free(deps);
if (pd.tmp)
free(pd.tmp);
free(line);
};
-// Deps are stored as offsets into source->idarraydata
-typedef struct _deps {
- Offset provides;
- Offset requires;
- Offset obsoletes;
- Offset conflicts;
- Offset recommends;
- Offset supplements;
- Offset enhances;
- Offset suggests;
- Offset freshens;
-} Deps;
-
/*
* parser data
*/
Source *source; // current source
Solvable *start; // collected solvables
- // all dependencies
- Deps *deps; // dependencies array, indexed by pack#
-
// package data
int epoch; // epoch (as offset into evrspace)
int version; // version (as offset into evrspace)
Parsedata *pd = (Parsedata *)userData;
struct stateswitch *sw;
Pool *pool = pd->pool;
+ Solvable *s = pd->start ? pd->start + pd->pack : 0;
if (pd->depth != pd->statedepth)
{
pool->solvables = (Solvable *)realloc(pool->solvables, (pool->nsolvables + pd->pack + PACK_BLOCK + 1) * sizeof(Solvable));
pd->start = pool->solvables + pd->source->start;
memset(pd->start + pd->pack, 0, (PACK_BLOCK + 1) * sizeof(Solvable));
- if (!pd->deps)
- pd->deps = (Deps *)malloc((pd->pack + PACK_BLOCK + 1) * sizeof(Deps));
- else
- pd->deps = (Deps *)realloc(pd->deps, (pd->pack + PACK_BLOCK + 1) * sizeof(Deps));
- memset(pd->deps + pd->pack, 0, (PACK_BLOCK + 1) * sizeof(Deps));
}
if (!strcmp(name, "selection"))
break;
case STATE_PROVIDES: /* start of provides */
- pd->deps[pd->pack].provides = 0;
+ s->provides = 0;
break;
case STATE_PROVIDESENTRY: /* entry within provides */
- pd->deps[pd->pack].provides = adddep(pool, pd, pd->deps[pd->pack].provides, atts, 0);
+ s->provides = adddep(pool, pd, s->provides, atts, 0);
break;
case STATE_REQUIRES:
- pd->deps[pd->pack].requires = 0;
+ s->requires = 0;
break;
case STATE_REQUIRESENTRY:
- pd->deps[pd->pack].requires = adddep(pool, pd, pd->deps[pd->pack].requires, atts, 1);
+ s->requires = adddep(pool, pd, s->requires, atts, 1);
break;
case STATE_OBSOLETES:
- pd->deps[pd->pack].obsoletes = 0;
+ s->obsoletes = 0;
break;
case STATE_OBSOLETESENTRY:
- pd->deps[pd->pack].obsoletes = adddep(pool, pd, pd->deps[pd->pack].obsoletes, atts, 0);
+ s->obsoletes = adddep(pool, pd, s->obsoletes, atts, 0);
break;
case STATE_CONFLICTS:
- pd->deps[pd->pack].conflicts = 0;
+ s->conflicts = 0;
break;
case STATE_CONFLICTSENTRY:
- pd->deps[pd->pack].conflicts = adddep(pool, pd, pd->deps[pd->pack].conflicts, atts, 0);
+ s->conflicts = adddep(pool, pd, s->conflicts, atts, 0);
break;
case STATE_RECOMMENDS:
- pd->deps[pd->pack].recommends = 0;
+ s->recommends = 0;
break;
case STATE_RECOMMENDSENTRY:
- pd->deps[pd->pack].recommends = adddep(pool, pd, pd->deps[pd->pack].recommends, atts, 0);
+ s->recommends = adddep(pool, pd, s->recommends, atts, 0);
break;
case STATE_SUPPLEMENTS:
- pd->deps[pd->pack].supplements= 0;
+ s->supplements= 0;
break;
case STATE_SUPPLEMENTSENTRY:
- pd->deps[pd->pack].supplements = adddep(pool, pd, pd->deps[pd->pack].supplements, atts, 0);
+ s->supplements = adddep(pool, pd, s->supplements, atts, 0);
break;
case STATE_SUGGESTS:
- pd->deps[pd->pack].suggests = 0;
+ s->suggests = 0;
break;
case STATE_SUGGESTSENTRY:
- pd->deps[pd->pack].suggests = adddep(pool, pd, pd->deps[pd->pack].suggests, atts, 0);
+ s->suggests = adddep(pool, pd, s->suggests, atts, 0);
break;
case STATE_ENHANCES:
- pd->deps[pd->pack].enhances = 0;
+ s->enhances = 0;
break;
case STATE_ENHANCESENTRY:
- pd->deps[pd->pack].enhances = adddep(pool, pd, pd->deps[pd->pack].enhances, atts, 0);
+ s->enhances = adddep(pool, pd, s->enhances, atts, 0);
break;
case STATE_FRESHENS:
- pd->deps[pd->pack].freshens = 0;
+ s->freshens = 0;
break;
case STATE_FRESHENSENTRY:
- pd->deps[pd->pack].freshens = adddep(pool, pd, pd->deps[pd->pack].freshens, atts, 0);
+ s->freshens = adddep(pool, pd, s->freshens, atts, 0);
break;
default:
break;
}
}
-static const char* findKernelFlavor(Parsedata *pd)
+static const char* findKernelFlavor(Parsedata *pd, Solvable *s)
{
Pool *pool = pd->pool;
Id pid, *pidp = 0;
- for (pidp = pd->source->idarraydata + pd->deps[pd->pack].provides; pidp && (pid = *pidp++) != 0; )
+ if (s->provides)
{
- Reldep *prd;
-
- if (!ISRELDEP(pid))
- continue; /* wrong provides name */
- prd = GETRELDEP(pool, pid);
- const char *depname = id2str(pool, prd->name);
- if (!strncmp(depname, "kernel-", strlen("kernel-")))
+ for (pidp = pd->source->idarraydata + s->provides; pidp && (pid = *pidp++) != 0; )
{
- return depname + strlen("kernel-");
+ Reldep *prd;
+ const char *depname;
+
+ if (!ISRELDEP(pid))
+ continue; /* wrong provides name */
+ prd = GETRELDEP(pool, pid);
+ depname = id2str(pool, prd->name);
+ if (!strncmp(depname, "kernel-", strlen("kernel-")))
+ {
+ return depname + strlen("kernel-");
+ }
}
}
//fprintf(stderr, "pack %d\n", pd->pack);
- //fprintf(stderr, "source %d\n", pd->deps[pd->pack].requires);
+ //fprintf(stderr, "source %d\n", s->requires);
- if (! pd->deps[pd->pack].requires )
+ if (!s->requires)
return 0;
- for (pidp = pd->source->idarraydata + pd->deps[pd->pack].requires ; pidp && (pid = *pidp++) != 0; )
+ for (pidp = pd->source->idarraydata + s->requires ; pidp && (pid = *pidp++) != 0; )
{
const char *depname = 0;
return 0;
}
-static int
-countDeps( Id *idarray)
-{
- Id id;
- int count = 0;
-
- while ((id = *idarray++) != ID_NULL)
- count++;
- return count;
-}
/*
* XML callback
pd->release ? pd->evrspace + pd->release : 0);
/* ensure self-provides */
if (s->arch != ARCH_SRC && s->arch != ARCH_NOSRC)
- pd->deps[pd->pack].provides = source_addid_dep(pd->source, pd->deps[pd->pack].provides, rel2id(pool, s->name, s->evr, REL_EQ, 1), 0);
- pd->deps[pd->pack].supplements = source_fix_legacy(pd->source, pd->deps[pd->pack].provides, pd->deps[pd->pack].supplements);
+ s->provides = source_addid_dep(pd->source, s->provides, rel2id(pool, s->name, s->evr, REL_EQ, 1), 0);
+ s->supplements = source_fix_legacy(pd->source, s->provides, s->supplements);
- const char *flavor = findKernelFlavor(pd);
+ const char *flavor = findKernelFlavor(pd, s);
if (flavor)
{
- char *cflavor = strdup(flavor);
+ char *cflavor = strdup(flavor); /* make pointer safe */
- Id npr = 0;
+ Id npr;
Id pid, *pidp;
/* this is either a kernel package or a kmp */
- int c = countDeps(pd->source->idarraydata + pd->deps[pd->pack].provides);
- source_reserve_ids(pd->source, 0, c);
-
- for (pidp = pd->source->idarraydata + pd->deps[pd->pack].provides; pidp && (pid = *pidp++) != 0; )
+ if (s->provides)
{
- const char *depname = 0;
- Reldep *prd = 0;
-
- if (ISRELDEP(pid))
- {
- prd = GETRELDEP(pool, pid);
- depname = id2str(pool, prd->name);
- }
- else
+ npr = 0;
+ for (pidp = pd->source->idarraydata + s->provides; (pid = *pidp++) != 0; )
{
- depname = id2str(pool, pid);
- }
+ const char *depname = 0;
+ Reldep *prd = 0;
- Id newid = pid;
+ if (ISRELDEP(pid))
+ {
+ prd = GETRELDEP(pool, pid);
+ depname = id2str(pool, prd->name);
+ }
+ else
+ {
+ depname = id2str(pool, pid);
+ }
- if (!strncmp(depname, "kernel(", strlen("kernel(")) && !strchr(depname, ':'))
- {
- char newdep[100];
- strcpy(newdep, "kernel(");
- strncat(newdep, cflavor, sizeof(newdep));
- strncat(newdep, ":", sizeof(newdep));
- strncat(newdep, depname + strlen("kernel("), 100);
- newid = str2id(pool, newdep, 1);
- if (prd)
- newid = rel2id(pool, newid, prd->evr, prd->flags, 1);
- }
- npr = source_addid_dep(pd->source, npr, newid, 0);
+ if (!strncmp(depname, "kernel(", strlen("kernel(")) && !strchr(depname, ':'))
+ {
+ char newdep[100];
+ strcpy(newdep, "kernel(");
+ strncat(newdep, cflavor, sizeof(newdep));
+ strncat(newdep, ":", sizeof(newdep));
+ strncat(newdep, depname + strlen("kernel("), 100);
+ pid = str2id(pool, newdep, 1);
+ if (prd)
+ pid = rel2id(pool, pid, prd->evr, prd->flags, 1);
+ }
+
+ npr = source_addid_dep(pd->source, npr, pid, 0);
+ }
+ s->provides = npr;
}
- pd->deps[pd->pack].provides = npr;
#if 1
- npr = 0;
- if (pd->deps[pd->pack].requires)
+ if (s->requires)
{
- c = countDeps(pd->source->idarraydata + pd->deps[pd->pack].requires);
- source_reserve_ids(pd->source, 0, c);
-
- for (pidp = pd->source->idarraydata + pd->deps[pd->pack].requires; pidp && (pid = *pidp++) != 0; )
+ npr = 0;
+ for (pidp = pd->source->idarraydata + s->requires; (pid = *pidp++) != 0; )
{
const char *depname = 0;
Reldep *prd = 0;
depname = id2str(pool, pid);
}
- Id newid = pid;
-
if (!strncmp(depname, "kernel(", strlen("kernel(")) && !strchr(depname, ':'))
{
char newdep[100];
strncat(newdep, cflavor, sizeof(newdep));
strncat(newdep, ":", sizeof(newdep));
strncat(newdep, depname + strlen("kernel("), 100);
- newid = str2id(pool, newdep, 1);
+ pid = str2id(pool, newdep, 1);
if (prd)
- newid = rel2id(pool, newid, prd->evr, prd->flags, 1);
+ pid = rel2id(pool, pid, prd->evr, prd->flags, 1);
}
- npr = source_addid_dep(pd->source, npr, newid, 0);
+ npr = source_addid_dep(pd->source, npr, pid, 0);
}
+ s->requires = npr;
}
- pd->deps[pd->pack].requires = npr;
#endif
free(cflavor);
}
char buf[BUFF_SIZE];
int i, l;
Source *source;
- Solvable *solvable;
- Deps *deps;
struct stateswitch *sw;
// create empty source
pool->nsolvables += pd.pack;
source->nsolvables = pd.pack;
- // now set dependency pointers for each solvable
- deps = pd.deps;
- solvable = pool->solvables + source->start;
- for (i = 0; i < pd.pack; i++, solvable++)
- {
- solvable->provides = deps[i].provides;
- solvable->requires = deps[i].requires;
- solvable->conflicts = deps[i].conflicts;
- solvable->obsoletes = deps[i].obsoletes;
- solvable->recommends = deps[i].recommends;
- solvable->supplements = deps[i].supplements;
- solvable->suggests = deps[i].suggests;
- solvable->enhances = deps[i].enhances;
- solvable->freshens = deps[i].freshens;
- }
-
- free(deps);
free(pd.content);
free(pd.evrspace);
{ NUMSTATES}
};
-struct deps {
- unsigned int provides;
- unsigned int requires;
- unsigned int obsoletes;
- unsigned int conflicts;
- unsigned int recommends;
- unsigned int supplements;
- unsigned int enhances;
- unsigned int suggests;
- unsigned int freshens;
-};
-
struct parsedata {
int depth;
enum state state;
Pool *pool;
Source *source;
Solvable *start;
- struct deps *deps;
char *kind;
struct stateswitch *swtab[NUMSTATES];
s->source = pd->source;
if (!s->arch)
s->arch = ARCH_NOARCH;
- pd->deps[pd->pack].provides = source_addid_dep(pd->source, pd->deps[pd->pack].provides, rel2id(pool, s->name, s->evr, REL_EQ, 1), 0);
+ s->provides = source_addid_dep(pd->source, s->provides, rel2id(pool, s->name, s->evr, REL_EQ, 1), 0);
pd->pack++;
}
pd->kind = "atom";
pool->solvables = realloc(pool->solvables, (pool->nsolvables + pd->pack + PACK_BLOCK + 1) * sizeof(Solvable));
pd->start = pool->solvables + pd->source->start;
memset(pd->start + pd->pack, 0, (PACK_BLOCK + 1) * sizeof(Solvable));
- if (!pd->deps)
- pd->deps = malloc((pd->pack + PACK_BLOCK + 1) * sizeof(struct deps));
- else
- pd->deps = realloc(pd->deps, (pd->pack + PACK_BLOCK + 1) * sizeof(struct deps));
- memset(pd->deps + pd->pack, 0, (PACK_BLOCK + 1) * sizeof(struct deps));
}
#if 0
fprintf(stderr, "package #%d\n", pd->pack);
s->evr = makeevr_atts(pool, pd, atts);
break;
case STATE_PROVIDES:
- pd->deps[pd->pack].provides = 0;
+ s->provides = 0;
break;
case STATE_PROVIDESENTRY:
- pd->deps[pd->pack].provides = adddep(pool, pd, pd->deps[pd->pack].provides, atts, 0);
+ s->provides = adddep(pool, pd, s->provides, atts, 0);
break;
case STATE_REQUIRES:
- pd->deps[pd->pack].requires = 0;
+ s->requires = 0;
break;
case STATE_REQUIRESENTRY:
- pd->deps[pd->pack].requires = adddep(pool, pd, pd->deps[pd->pack].requires, atts, 1);
+ s->requires = adddep(pool, pd, s->requires, atts, 1);
break;
case STATE_OBSOLETES:
- pd->deps[pd->pack].obsoletes = 0;
+ s->obsoletes = 0;
break;
case STATE_OBSOLETESENTRY:
- pd->deps[pd->pack].obsoletes = adddep(pool, pd, pd->deps[pd->pack].obsoletes, atts, 0);
+ s->obsoletes = adddep(pool, pd, s->obsoletes, atts, 0);
break;
case STATE_CONFLICTS:
- pd->deps[pd->pack].conflicts = 0;
+ s->conflicts = 0;
break;
case STATE_CONFLICTSENTRY:
- pd->deps[pd->pack].conflicts = adddep(pool, pd, pd->deps[pd->pack].conflicts, atts, 0);
+ s->conflicts = adddep(pool, pd, s->conflicts, atts, 0);
break;
case STATE_RECOMMENDS:
- pd->deps[pd->pack].recommends = 0;
+ s->recommends = 0;
break;
case STATE_RECOMMENDSENTRY:
- pd->deps[pd->pack].recommends = adddep(pool, pd, pd->deps[pd->pack].recommends, atts, 0);
+ s->recommends = adddep(pool, pd, s->recommends, atts, 0);
break;
case STATE_SUPPLEMENTS:
- pd->deps[pd->pack].supplements= 0;
+ s->supplements= 0;
break;
case STATE_SUPPLEMENTSENTRY:
- pd->deps[pd->pack].supplements = adddep(pool, pd, pd->deps[pd->pack].supplements, atts, 0);
+ s->supplements = adddep(pool, pd, s->supplements, atts, 0);
break;
case STATE_SUGGESTS:
- pd->deps[pd->pack].suggests = 0;
+ s->suggests = 0;
break;
case STATE_SUGGESTSENTRY:
- pd->deps[pd->pack].suggests = adddep(pool, pd, pd->deps[pd->pack].suggests, atts, 0);
+ s->suggests = adddep(pool, pd, s->suggests, atts, 0);
break;
case STATE_ENHANCES:
- pd->deps[pd->pack].enhances = 0;
+ s->enhances = 0;
break;
case STATE_ENHANCESENTRY:
- pd->deps[pd->pack].enhances = adddep(pool, pd, pd->deps[pd->pack].enhances, atts, 0);
+ s->enhances = adddep(pool, pd, s->enhances, atts, 0);
break;
case STATE_FRESHENS:
- pd->deps[pd->pack].freshens = 0;
+ s->freshens = 0;
break;
case STATE_FRESHENSENTRY:
- pd->deps[pd->pack].freshens = adddep(pool, pd, pd->deps[pd->pack].freshens, atts, 0);
+ s->freshens = adddep(pool, pd, s->freshens, atts, 0);
break;
default:
break;
if (!s->arch)
s->arch = ARCH_NOARCH;
if (s->arch != ARCH_SRC && s->arch != ARCH_NOSRC)
- pd->deps[pd->pack].provides = source_addid_dep(pd->source, pd->deps[pd->pack].provides, rel2id(pool, s->name, s->evr, REL_EQ, 1), 0);
- pd->deps[pd->pack].supplements = source_fix_legacy(pd->source, pd->deps[pd->pack].provides, pd->deps[pd->pack].supplements);
+ s->provides = source_addid_dep(pd->source, s->provides, rel2id(pool, s->name, s->evr, REL_EQ, 1), 0);
+ s->supplements = source_fix_legacy(pd->source, s->provides, s->supplements);
pd->pack++;
break;
case STATE_NAME:
char buf[BUFF_SIZE];
int i, l;
Source *source;
- Solvable *s;
- struct deps *deps;
struct stateswitch *sw;
source = pool_addsource_empty(pool);
pool->nsolvables += pd.pack;
source->nsolvables = pd.pack;
- deps = pd.deps;
- s = pool->solvables + source->start;
- for (i = 0; i < pd.pack; i++, s++)
- {
- s->provides = deps[i].provides;
- s->requires = deps[i].requires;
- s->conflicts = deps[i].conflicts;
- s->obsoletes = deps[i].obsoletes;
- s->recommends = deps[i].recommends;
- s->supplements = deps[i].supplements;
- s->suggests = deps[i].suggests;
- s->enhances = deps[i].enhances;
- s->freshens = deps[i].freshens;
- }
- free(deps);
free(pd.content);
return source;
}
return olddeps;
}
-struct deps {
- unsigned int provides;
- unsigned int requires;
- unsigned int obsoletes;
- unsigned int conflicts;
- unsigned int recommends;
- unsigned int supplements;
- unsigned int enhances;
- unsigned int suggests;
- unsigned int freshens;
-};
-
static int
-rpm2solv(Pool *pool, Source *source, Solvable *s, struct deps *deps, RpmHead *rpmhead)
+rpm2solv(Pool *pool, Source *source, Solvable *s, RpmHead *rpmhead)
{
char *name;
char *evr;
s->evr = str2id(pool, evr, 1);
free(evr);
- deps->provides = makedeps(pool, source, rpmhead, TAG_PROVIDENAME, TAG_PROVIDEVERSION, TAG_PROVIDEFLAGS, 0);
- deps->provides = addfileprovides(pool, source, rpmhead, deps->provides);
- deps->provides = source_addid_dep(source, deps->provides, rel2id(pool, s->name, s->evr, REL_EQ, 1), 0);
- deps->requires = makedeps(pool, source, rpmhead, TAG_REQUIRENAME, TAG_REQUIREVERSION, TAG_REQUIREFLAGS, 0);
- deps->conflicts = makedeps(pool, source, rpmhead, TAG_CONFLICTNAME, TAG_CONFLICTVERSION, TAG_CONFLICTFLAGS, 0);
- deps->obsoletes = makedeps(pool, source, rpmhead, TAG_OBSOLETENAME, TAG_OBSOLETEVERSION, TAG_OBSOLETEFLAGS, 0);
-
- deps->recommends = makedeps(pool, source, rpmhead, TAG_SUGGESTSNAME, TAG_SUGGESTSVERSION, TAG_SUGGESTSFLAGS, 2);
- deps->suggests = makedeps(pool, source, rpmhead, TAG_SUGGESTSNAME, TAG_SUGGESTSVERSION, TAG_SUGGESTSFLAGS, 1);
- deps->supplements = makedeps(pool, source, rpmhead, TAG_ENHANCESNAME, TAG_ENHANCESVERSION, TAG_ENHANCESFLAGS, 2);
- deps->enhances = makedeps(pool, source, rpmhead, TAG_ENHANCESNAME, TAG_ENHANCESVERSION, TAG_ENHANCESFLAGS, 1);
- deps->freshens = 0;
- deps->supplements = source_fix_legacy(source, deps->provides, deps->supplements);
+ s->provides = makedeps(pool, source, rpmhead, TAG_PROVIDENAME, TAG_PROVIDEVERSION, TAG_PROVIDEFLAGS, 0);
+ s->provides = addfileprovides(pool, source, rpmhead, s->provides);
+ s->provides = source_addid_dep(source, s->provides, rel2id(pool, s->name, s->evr, REL_EQ, 1), 0);
+ s->requires = makedeps(pool, source, rpmhead, TAG_REQUIRENAME, TAG_REQUIREVERSION, TAG_REQUIREFLAGS, 0);
+ s->conflicts = makedeps(pool, source, rpmhead, TAG_CONFLICTNAME, TAG_CONFLICTVERSION, TAG_CONFLICTFLAGS, 0);
+ s->obsoletes = makedeps(pool, source, rpmhead, TAG_OBSOLETENAME, TAG_OBSOLETEVERSION, TAG_OBSOLETEFLAGS, 0);
+
+ s->recommends = makedeps(pool, source, rpmhead, TAG_SUGGESTSNAME, TAG_SUGGESTSVERSION, TAG_SUGGESTSFLAGS, 2);
+ s->suggests = makedeps(pool, source, rpmhead, TAG_SUGGESTSNAME, TAG_SUGGESTSVERSION, TAG_SUGGESTSFLAGS, 1);
+ s->supplements = makedeps(pool, source, rpmhead, TAG_ENHANCESNAME, TAG_ENHANCESVERSION, TAG_ENHANCESFLAGS, 2);
+ s->enhances = makedeps(pool, source, rpmhead, TAG_ENHANCESNAME, TAG_ENHANCESVERSION, TAG_ENHANCESFLAGS, 1);
+ s->freshens = 0;
+ s->supplements = source_fix_legacy(source, s->provides, s->supplements);
return 1;
}
RpmHead *rpmhead;
Source *source;
Solvable *s;
- struct deps *deps;
Id id, *refhash;
unsigned int refmask, h;
int asolv;
pool->solvables = realloc(pool->solvables, (pool->nsolvables + 256) * sizeof(Solvable));
memset(pool->solvables + source->start, 0, 256 * sizeof(Solvable));
source->rpmdbid = calloc(256, sizeof(unsigned int));
- deps = calloc(256, sizeof(*deps));
asolv = 256;
rpmheadsize = 0;
rpmhead = 0;
memset(pool->solvables + source->start + asolv, 0, 256 * sizeof(Solvable));
source->rpmdbid = realloc(source->rpmdbid, (asolv + 256) * sizeof(unsigned int));
memset(source->rpmdbid + asolv, 0, 256 * sizeof(unsigned int));
- deps = realloc(deps, (asolv + 256) * sizeof(*deps));
- memset(deps + asolv, 0, 256 * sizeof(*deps));
asolv += 256;
}
pool->solvables[source->start + i].source = source;
memcpy(rpmhead->data, (unsigned char *)data.data + 8, rpmhead->cnt * 16 + rpmhead->dcnt);
rpmhead->dp = rpmhead->data + rpmhead->cnt * 16;
source->rpmdbid[i] = dbid;
- if (rpm2solv(pool, source, pool->solvables + source->start + i, deps + i, rpmhead))
+ if (rpm2solv(pool, source, pool->solvables + source->start + i, rpmhead))
i++;
}
nrpmids = i;
pool->solvables = realloc(pool->solvables, (pool->nsolvables + nrpmids) * sizeof(Solvable));
memset(pool->solvables + source->start, 0, nrpmids * sizeof(Solvable));
source->rpmdbid = calloc(nrpmids, sizeof(unsigned int));
- deps = calloc(nrpmids, sizeof(*deps));
refhash = 0;
refmask = 0;
if (r->arch)
s->arch = str2id(pool, id2str(ref->pool, r->arch), 1);
}
- deps[i].provides = copydeps(pool, source, r->provides, ref);
- deps[i].requires = copydeps(pool, source, r->requires, ref);
- deps[i].conflicts = copydeps(pool, source, r->conflicts, ref);
- deps[i].obsoletes = copydeps(pool, source, r->obsoletes, ref);
- deps[i].recommends = copydeps(pool, source, r->recommends, ref);
- deps[i].suggests = copydeps(pool, source, r->suggests, ref);
- deps[i].supplements = copydeps(pool, source, r->supplements, ref);
- deps[i].enhances = copydeps(pool, source, r->enhances, ref);
- deps[i].freshens = copydeps(pool, source, r->freshens, ref);
+ s->provides = copydeps(pool, source, r->provides, ref);
+ s->requires = copydeps(pool, source, r->requires, ref);
+ s->conflicts = copydeps(pool, source, r->conflicts, ref);
+ s->obsoletes = copydeps(pool, source, r->obsoletes, ref);
+ s->recommends = copydeps(pool, source, r->recommends, ref);
+ s->suggests = copydeps(pool, source, r->suggests, ref);
+ s->supplements = copydeps(pool, source, r->supplements, ref);
+ s->enhances = copydeps(pool, source, r->enhances, ref);
+ s->freshens = copydeps(pool, source, r->freshens, ref);
continue;
}
}
memcpy(rpmhead->data, (unsigned char *)data.data + 8, rpmhead->cnt * 16 + rpmhead->dcnt);
rpmhead->dp = rpmhead->data + rpmhead->cnt * 16;
- rpm2solv(pool, source, s, deps + i, rpmhead);
+ rpm2solv(pool, source, s, rpmhead);
}
if (refhash)
pool->nsolvables += nrpmids;
source->nsolvables = nrpmids;
- // copy solvable data to pool
- s = pool->solvables + source->start;
- for (i = 0; i < nrpmids; i++, s++)
- {
- s->provides = deps[i].provides;
- s->requires = deps[i].requires;
- s->conflicts = deps[i].conflicts;
- s->obsoletes = deps[i].obsoletes;
- s->recommends = deps[i].recommends;
- s->supplements = deps[i].supplements;
- s->suggests = deps[i].suggests;
- s->enhances = deps[i].enhances;
- s->freshens = deps[i].freshens;
- }
- free(deps);
if (db)
db->close(db, 0);
return source;
{ NUMSTATES}
};
-struct deps {
- unsigned int provides;
- unsigned int requires;
- unsigned int obsoletes;
- unsigned int conflicts;
- unsigned int recommends;
- unsigned int supplements;
- unsigned int enhances;
- unsigned int suggests;
- unsigned int freshens;
-};
-
struct parsedata {
int depth;
enum state state;
Pool *pool;
Source *source;
Solvable *start;
- struct deps *deps;
struct stateswitch *swtab[NUMSTATES];
enum state sbtab[NUMSTATES];
};
pool->solvables = realloc(pool->solvables, (pool->nsolvables + pd->numpacks) * sizeof(Solvable));
pd->start = pool->solvables + pd->source->start;
memset(pd->start, 0, pd->numpacks * sizeof(Solvable));
- pd->deps = calloc(pd->numpacks, sizeof(struct deps));
}
}
break;
s->evr = makeevr_atts(pool, pd, atts);
break;
case STATE_PROVIDES:
- pd->deps[pd->pack].provides = 0;
+ s->provides = 0;
break;
case STATE_PROVIDESENTRY:
- pd->deps[pd->pack].provides = adddep(pool, pd, pd->deps[pd->pack].provides, atts, 0);
+ s->provides = adddep(pool, pd, s->provides, atts, 0);
break;
case STATE_REQUIRES:
- pd->deps[pd->pack].requires = 0;
+ s->requires = 0;
break;
case STATE_REQUIRESENTRY:
- pd->deps[pd->pack].requires = adddep(pool, pd, pd->deps[pd->pack].requires, atts, 1);
+ s->requires = adddep(pool, pd, s->requires, atts, 1);
break;
case STATE_OBSOLETES:
- pd->deps[pd->pack].obsoletes = 0;
+ s->obsoletes = 0;
break;
case STATE_OBSOLETESENTRY:
- pd->deps[pd->pack].obsoletes = adddep(pool, pd, pd->deps[pd->pack].obsoletes, atts, 0);
+ s->obsoletes = adddep(pool, pd, s->obsoletes, atts, 0);
break;
case STATE_CONFLICTS:
- pd->deps[pd->pack].conflicts = 0;
+ s->conflicts = 0;
break;
case STATE_CONFLICTSENTRY:
- pd->deps[pd->pack].conflicts = adddep(pool, pd, pd->deps[pd->pack].conflicts, atts, 0);
+ s->conflicts = adddep(pool, pd, s->conflicts, atts, 0);
break;
case STATE_RECOMMENDS:
- pd->deps[pd->pack].recommends = 0;
+ s->recommends = 0;
break;
case STATE_RECOMMENDSENTRY:
- pd->deps[pd->pack].recommends = adddep(pool, pd, pd->deps[pd->pack].recommends, atts, 0);
+ s->recommends = adddep(pool, pd, s->recommends, atts, 0);
break;
case STATE_SUPPLEMENTS:
- pd->deps[pd->pack].supplements= 0;
+ s->supplements= 0;
break;
case STATE_SUPPLEMENTSENTRY:
- pd->deps[pd->pack].supplements = adddep(pool, pd, pd->deps[pd->pack].supplements, atts, 0);
+ s->supplements = adddep(pool, pd, s->supplements, atts, 0);
break;
case STATE_SUGGESTS:
- pd->deps[pd->pack].suggests = 0;
+ s->suggests = 0;
break;
case STATE_SUGGESTSENTRY:
- pd->deps[pd->pack].suggests = adddep(pool, pd, pd->deps[pd->pack].suggests, atts, 0);
+ s->suggests = adddep(pool, pd, s->suggests, atts, 0);
break;
case STATE_ENHANCES:
- pd->deps[pd->pack].enhances = 0;
+ s->enhances = 0;
break;
case STATE_ENHANCESENTRY:
- pd->deps[pd->pack].enhances = adddep(pool, pd, pd->deps[pd->pack].enhances, atts, 0);
+ s->enhances = adddep(pool, pd, s->enhances, atts, 0);
break;
case STATE_FRESHENS:
- pd->deps[pd->pack].freshens = 0;
+ s->freshens = 0;
break;
case STATE_FRESHENSENTRY:
- pd->deps[pd->pack].freshens = adddep(pool, pd, pd->deps[pd->pack].freshens, atts, 0);
+ s->freshens = adddep(pool, pd, s->freshens, atts, 0);
break;
default:
break;
if (!s->arch)
s->arch = ARCH_NOARCH;
if (s->arch != ARCH_SRC && s->arch != ARCH_NOSRC)
- pd->deps[pd->pack].provides = source_addid_dep(pd->source, pd->deps[pd->pack].provides, rel2id(pool, s->name, s->evr, REL_EQ, 1), 0);
- pd->deps[pd->pack].supplements = source_fix_legacy(pd->source, pd->deps[pd->pack].provides, pd->deps[pd->pack].supplements);
+ s->provides = source_addid_dep(pd->source, s->provides, rel2id(pool, s->name, s->evr, REL_EQ, 1), 0);
+ s->supplements = source_fix_legacy(pd->source, s->provides, s->supplements);
pd->pack++;
break;
case STATE_NAME:
break;
case STATE_FILE:
id = str2id(pool, pd->content, 1);
- pd->deps[pd->pack].provides = source_addid(pd->source, pd->deps[pd->pack].provides, id);
+ s->provides = source_addid(pd->source, s->provides, id);
break;
default:
break;
char buf[BUFF_SIZE];
int i, l;
Source *source;
- Solvable *s;
- struct deps *deps;
struct stateswitch *sw;
source = pool_addsource_empty(pool);
pool->nsolvables += pd.pack;
source->nsolvables = pd.pack;
- deps = pd.deps;
- s = pool->solvables + source->start;
- for (i = 0; i < pd.pack; i++, s++)
- {
- s->provides = deps[i].provides;
- s->requires = deps[i].requires;
- s->conflicts = deps[i].conflicts;
- s->obsoletes = deps[i].obsoletes;
- s->recommends = deps[i].recommends;
- s->supplements = deps[i].supplements;
- s->suggests = deps[i].suggests;
- s->enhances = deps[i].enhances;
- s->freshens = deps[i].freshens;
- }
- free(deps);
free(pd.content);
return source;
}
return i;
}
-struct deps {
- unsigned int provides;
- unsigned int requires;
- unsigned int obsoletes;
- unsigned int conflicts;
- unsigned int recommends;
- unsigned int supplements;
- unsigned int enhances;
- unsigned int suggests;
- unsigned int freshens;
-};
-
struct parsedata {
char *kind;
Source *source;
int aline;
Source *source;
Solvable *s;
- struct deps *deps = 0, *dp = 0;
int intag = 0;
int cummulate = 0;
int pack;
char *sp[5];
- int i;
struct parsedata pd;
source = pool_addsource_empty(pool);
continue;
if (!strncmp(line, "=Pkg:", 5) || !strncmp(line, "=Pat:", 5))
{
- if (dp && s->arch != ARCH_SRC && s->arch != ARCH_NOSRC)
- dp->provides = source_addid_dep(source, dp->provides, rel2id(pool, s->name, s->evr, REL_EQ, 1), 0);
- if (dp)
- dp->supplements = source_fix_legacy(source, dp->provides, dp->supplements);
+ if (s && s->arch != ARCH_SRC && s->arch != ARCH_NOSRC)
+ s->provides = source_addid_dep(source, s->provides, rel2id(pool, s->name, s->evr, REL_EQ, 1), 0);
+ if (s)
+ s->supplements = source_fix_legacy(source, s->provides, s->supplements);
pd.kind = 0;
if (line[3] == 't')
pd.kind = "pattern";
{
pool->solvables = realloc(pool->solvables, (pool->nsolvables + pack + PACK_BLOCK + 1) * sizeof(Solvable));
memset(pool->solvables + source->start + pack, 0, (PACK_BLOCK + 1) * sizeof(Solvable));
- if (!deps)
- deps = malloc((pack + PACK_BLOCK + 1) * sizeof(struct deps));
- else
- deps = realloc(deps, (pack + PACK_BLOCK + 1) * sizeof(struct deps));
- memset(deps + pack, 0, (PACK_BLOCK + 1) * sizeof(struct deps));
}
s = pool->solvables + source->start + pack;
s->source = source;
- dp = deps + pack;
pack++;
if (split(line + 5, sp, 5) != 4)
{
}
if (!strncmp(line, "=Prv:", 5))
{
- dp->provides = adddep(pool, &pd, dp->provides, line, 0, pd.kind);
+ s->provides = adddep(pool, &pd, s->provides, line, 0, pd.kind);
continue;
}
if (!strncmp(line, "=Req:", 5))
{
- dp->requires = adddep(pool, &pd, dp->requires, line, 1, pd.kind);
+ s->requires = adddep(pool, &pd, s->requires, line, 1, pd.kind);
continue;
}
if (!strncmp(line, "=Prq:", 5))
{
if (pd.kind)
- dp->requires = adddep(pool, &pd, dp->requires, line, 0, 0);
+ s->requires = adddep(pool, &pd, s->requires, line, 0, 0);
else
- dp->requires = adddep(pool, &pd, dp->requires, line, 2, 0);
+ s->requires = adddep(pool, &pd, s->requires, line, 2, 0);
continue;
}
if (!strncmp(line, "=Obs:", 5))
{
- dp->obsoletes = adddep(pool, &pd, dp->obsoletes, line, 0, pd.kind);
+ s->obsoletes = adddep(pool, &pd, s->obsoletes, line, 0, pd.kind);
continue;
}
if (!strncmp(line, "=Con:", 5))
{
- dp->conflicts = adddep(pool, &pd, dp->conflicts, line, 0, pd.kind);
+ s->conflicts = adddep(pool, &pd, s->conflicts, line, 0, pd.kind);
continue;
}
if (!strncmp(line, "=Rec:", 5))
{
- dp->recommends = adddep(pool, &pd, dp->recommends, line, 0, pd.kind);
+ s->recommends = adddep(pool, &pd, s->recommends, line, 0, pd.kind);
continue;
}
if (!strncmp(line, "=Sup:", 5))
{
- dp->supplements = adddep(pool, &pd, dp->supplements, line, 0, pd.kind);
+ s->supplements = adddep(pool, &pd, s->supplements, line, 0, pd.kind);
continue;
}
if (!strncmp(line, "=Enh:", 5))
{
- dp->enhances = adddep(pool, &pd, dp->enhances, line, 0, pd.kind);
+ s->enhances = adddep(pool, &pd, s->enhances, line, 0, pd.kind);
continue;
}
if (!strncmp(line, "=Sug:", 5))
{
- dp->suggests = adddep(pool, &pd, dp->suggests, line, 0, pd.kind);
+ s->suggests = adddep(pool, &pd, s->suggests, line, 0, pd.kind);
continue;
}
if (!strncmp(line, "=Fre:", 5))
{
- dp->freshens = adddep(pool, &pd, dp->freshens, line, 0, pd.kind);
+ s->freshens = adddep(pool, &pd, s->freshens, line, 0, pd.kind);
continue;
}
if (!strncmp(line, "=Prc:", 5))
{
- dp->recommends = adddep(pool, &pd, dp->recommends, line, 0, 0);
+ s->recommends = adddep(pool, &pd, s->recommends, line, 0, 0);
continue;
}
if (!strncmp(line, "=Psg:", 5))
{
- dp->suggests = adddep(pool, &pd, dp->suggests, line, 0, 0);
+ s->suggests = adddep(pool, &pd, s->suggests, line, 0, 0);
continue;
}
}
- if (dp && s->arch != ARCH_SRC && s->arch != ARCH_NOSRC)
- dp->provides = source_addid_dep(source, dp->provides, rel2id(pool, s->name, s->evr, REL_EQ, 1), 0);
- if (dp)
- dp->supplements = source_fix_legacy(source, dp->provides, dp->supplements);
+ if (s && s->arch != ARCH_SRC && s->arch != ARCH_NOSRC)
+ s->provides = source_addid_dep(source, s->provides, rel2id(pool, s->name, s->evr, REL_EQ, 1), 0);
+ if (s)
+ s->supplements = source_fix_legacy(source, s->provides, s->supplements);
pool->nsolvables += pack;
source->nsolvables = pack;
- s = pool->solvables + source->start;
- for (i = 0; i < pack; i++, s++)
- {
- s->provides = deps[i].provides;
- s->requires = deps[i].requires;
- s->conflicts = deps[i].conflicts;
- s->obsoletes = deps[i].obsoletes;
- s->recommends = deps[i].recommends;
- s->supplements = deps[i].supplements;
- s->suggests = deps[i].suggests;
- s->enhances = deps[i].enhances;
- s->freshens = deps[i].freshens;
- }
- free(deps);
if (pd.tmp)
free(pd.tmp);
free(line);