store back pointer to source in Solvable.
return pool->whatprovidesdata + pool->whatprovides[d];
}
-
-/*
- * return source of solvable
- * or NULL
- */
-
-Source *
-pool_source(Pool *pool, Solvable *s)
-{
- int i;
- Source *source;
- int off = s - pool->solvables;
-
- for (i = 0; i < pool->nsources; i++)
- {
- source = pool->sources[i];
- if (off >= source->start
- && off < source->start+source->nsolvables)
- {
- return source;
- }
- }
- return NULL;
-}
-
// EOF
extern Id *pool_addrelproviders(Pool *pool, Id d);
-extern Source *pool_source(Pool *pool, Solvable *s);
-
static inline int pool_installable(Pool *pool, Solvable *s)
{
if (s->arch == ARCH_SRC || s->arch == ARCH_NOSRC)
#define SOLVABLE_H
#include "pooltypes.h"
+#include "source.h"
typedef struct _Solvable {
Id name;
Id arch;
- Id evr;
+ Id evr; /* epoch:version-release */
- // dependencies are pointers into idarray of source the solvable originates from
- Id *provides; // terminated with Id 0
+ Source *source; /* source we belong to */
+
+ /* dependencies are pointers into idarray of source */
+ Id *provides; /* terminated with Id 0 */
Id *obsoletes;
Id *conflicts;
#endif
addrule(solv, -n, 0); /* mark requestor as uninstallable */
if (solv->rc_output)
- printf(">!> !unflag %s-%s.%s[%s]\n", id2str(pool, s->name), id2str(pool, s->evr), id2str(pool, s->arch), source_name(pool_source(pool, s)));
+ printf(">!> !unflag %s-%s.%s[%s]\n", id2str(pool, s->name), id2str(pool, s->evr), id2str(pool, s->arch), source_name(s->source));
continue;
}
#if 0
}
if (solv->rc_output)
{
- Source *source = pool_source(pool, s);
+ Source *source = s->source;
if (source && strcmp(source_name(source), "locales"))
printf("[%s]", source_name(source));
}
case SOLVER_INSTALL_SOLVABLE: /* install specific solvable */
if (solv->rc_output) {
Solvable *s = pool->solvables + what;
- printf(">!> Installing %s from channel %s\n", id2str(pool, s->name), source_name(pool_source(pool, s)));
+ printf(">!> Installing %s from channel %s\n", id2str(pool, s->name), source_name(s->source));
}
addrule(solv, what, 0); /* install by Id */
break;
#endif
for (i = 0, s = pool->solvables + source->start; i < numsolv; i++, s++)
{
+ s->source = source;
databits = 0;
if (numsolvdatabits)
{
source = pool_addsource_empty(pool);
memset(&pd, 0, sizeof(pd));
- line = malloc(1024);
+ line = xmalloc(1024);
aline = 1024;
pd.source = source;
memset(deps + pack, 0, (PACK_BLOCK + 1) * sizeof(struct deps));
}
s = pool->solvables + source->start + pack;
+ s->source = source;
dp = deps + pack;
pack++;
}
{
case STATE_PACKAGE: /* package complete */
+ s->source = pd->source;
if (!s->arch) /* default to "noarch" */
s->arch = ARCH_NOARCH;
/* HACK: close patch */
if (pd->kind && !strcmp(pd->kind, "patch"))
{
+ 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);
case STATE_PATCH:
if (!strcmp(name, "patch") && strcmp(pd->kind, "patch"))
break; /* already closed */
+ s->source = pd->source;
if (!s->arch)
s->arch = ARCH_NOARCH;
if (s->arch != ARCH_SRC && s->arch != ARCH_NOSRC)
memset(deps + asolv, 0, 256 * sizeof(*deps));
asolv += 256;
}
+ pool->solvables[source->start + i].source = source;
if (key.size != 4)
{
fprintf(stderr, "corrupt Packages database (key size)\n");
s = pool->solvables + source->start;
for (i = 0; i < nrpmids; i++, rp++, s++)
{
+ s->source = source;
dbid = rp->dbid;
source->rpmdbid[i] = dbid;
if (refhash)
switch (pd->state)
{
case STATE_PACKAGE:
-#if 0
- {
- const char *arch = id2str(pool, s->arch);
- if (strcmp(arch, "noarch") && strcmp(arch, "i586") && strcmp(arch, "i686"))
- break;
- }
-#endif
+ s->source = pd->source;
if (!s->arch)
s->arch = ARCH_NOARCH;
if (s->arch != ARCH_SRC && s->arch != ARCH_NOSRC)
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)