pool_freewhatprovides(pool);
pool_freeidhashes(pool);
- pool_freeallrepos(pool, 1);
+ repo_freeallrepos(pool, 1);
xfree(pool->id2arch);
xfree(pool->solvables);
xfree(pool->ss.stringspace);
/*
- * pool_prepare()
+ * pool_createwhatprovides()
*
* create hashes over complete pool to ease lookups
*
*/
void
-pool_prepare(Pool *pool)
+pool_createwhatprovides(Pool *pool)
{
int i, num, np, extra;
Offset off;
{
case REL_AND:
case REL_WITH:
- pp = GET_PROVIDESP(name, p);
- pp2 = GET_PROVIDESP(evr, p);
+ pp = pool_whatprovides(pool, name);
+ pp2 = pool_whatprovides(pool, evr);
while ((p = *pp++) != 0)
{
for (pp3 = pp2; *pp3;)
}
break;
case REL_OR:
- pp = GET_PROVIDESP(name, p);
+ pp = pool_whatprovides(pool, name);
while ((p = *pp++) != 0)
queue_push(&plist, p);
- pp = GET_PROVIDESP(evr, p);
+ pp = pool_whatprovides(pool, evr);
while ((p = *pp++) != 0)
queue_pushunique(&plist, p);
break;
//-----------------------------------------------
-// whatprovides
-// "foo" -> Id -> lookup in table, returns offset into whatprovidesdata where array of Ids providing 'foo' are located, 0-terminated
-
-
-#define GET_PROVIDESP(d, v) (ISRELDEP(d) ? \
- (v = GETRELID(pool, d), pool->whatprovides[v] ? \
- pool->whatprovidesdata + pool->whatprovides[v] : \
- pool_addrelproviders(pool, d) \
- ) : \
- (pool->whatprovidesdata + pool->whatprovides[d]))
-
-/* loop over all providers of d */
-#define FOR_PROVIDES(v, vp, d) \
- for (vp = GET_PROVIDESP(d, v) ; (v = *vp++) != ID_NULL; )
/* mark dependencies with relation by setting bit31 */
/**
* Prepares a pool for solving
*/
-extern void pool_prepare(Pool *pool);
+extern void pool_createwhatprovides(Pool *pool);
extern void pool_freewhatprovides(Pool *pool);
extern Id pool_queuetowhatprovides(Pool *pool, Queue *q);
-extern Id *pool_addrelproviders(Pool *pool, Id d);
-
static inline int pool_installable(Pool *pool, Solvable *s)
{
if (!s->arch || s->arch == ARCH_SRC || s->arch == ARCH_NOSRC)
return 1;
}
+extern Id *pool_addrelproviders(Pool *pool, Id d);
+
+static inline Id *pool_whatprovides(Pool *pool, Id d)
+{
+ Id v;
+ if (!ISRELDEP(d))
+ return pool->whatprovidesdata + pool->whatprovides[d];
+ v = GETRELID(pool, d);
+ if (pool->whatprovides[v])
+ return pool->whatprovidesdata + pool->whatprovides[v];
+ return pool_addrelproviders(pool, d);
+}
+
+/* loop over all providers of d */
+#define FOR_PROVIDES(v, vp, d) \
+ for (vp = pool_whatprovides(pool, d) ; (v = *vp++) != 0; )
+
+
#ifdef __cplusplus
}
#endif
}
void
-pool_freeallrepos(Pool *pool, int reuseids)
+repo_freeallrepos(Pool *pool, int reuseids)
{
int i;
extern Repo *repo_create(Pool *pool, const char *name);
extern void repo_free(Repo *repo, int reuseids);
+extern void repo_freeallrepos(Pool *pool, int reuseids);
extern Offset repo_addid(Repo *repo, Offset olddeps, Id id);
extern Offset repo_addid_dep(Repo *repo, Offset olddeps, Id id, int isreq);
extern Offset repo_reserve_ids(Repo *repo, Offset olddeps, int num);
extern Offset repo_fix_legacy(Repo *repo, Offset provides, Offset supplements);
-extern void pool_freeallrepos(Pool *pool, int reuseids);
-
static inline const char *repo_name(const Repo *repo)
{
return repo->name;
if (req == SOLVABLE_PREREQMARKER) /* skip the marker */
continue;
- dp = GET_PROVIDESP(req, p); /* get providers of req; p is a dummy only */
+ dp = pool_whatprovides(pool, req);
if (*dp == SYSTEMSOLVABLE) /* always installed */
continue;
{
if (req == SOLVABLE_PREREQMARKER)
continue;
- dp = GET_PROVIDESP(req, p);
+ dp = pool_whatprovides(pool, req);
if (*dp)
continue;
printf("package %s-%s.%s requires %s, but no package provides it\n", id2str(pool, s->name), id2str(pool, s->evr), id2str(pool, s->arch), dep2str(pool, req));
{
if (req == SOLVABLE_PREREQMARKER)
continue;
- dp = GET_PROVIDESP(req, p);
+ dp = pool_whatprovides(pool, req);
if (d == 0)
{
if (*dp == r->w2 && dp[1] == 0)