Skip to content

Commit

Permalink
- add pool_search() function to search the pool
Browse files Browse the repository at this point in the history
  • Loading branch information
mlschroe committed Feb 15, 2008
1 parent 90a6bfc commit d26640b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/pool.c
Expand Up @@ -1003,4 +1003,18 @@ pool_fill_DU(Pool *pool, struct mountpoint *mps, int nmps)

#endif

void pool_search(Pool *pool, Id p, Id key, const char *match, int flags, int (*callback)(void *cbdata, Solvable *s, struct _Repodata *data, struct _Repokey *key, struct _KeyValue *kv), void *cbdata)
{
if (p)
{
if (pool->solvables[p].repo)
repo_search(pool->solvables[p].repo, p, key, match, flags, callback, cbdata);
return;
}
/* FIXME: obey callback return value! */
for (p = 1; p < pool->nsolvables; p++)
if (pool->solvables[p].repo)
repo_search(pool->solvables[p].repo, p, key, match, flags, callback, cbdata);
}

// EOF
9 changes: 9 additions & 0 deletions src/pool.h
Expand Up @@ -73,6 +73,8 @@ extern "C" {

struct _Repo;
struct _Repodata;
struct _Repokey;
struct _KeyValue;

struct _Pool {
struct _Stringpool ss;
Expand Down Expand Up @@ -279,6 +281,13 @@ static inline void pool_setloadcallback(Pool *pool, FILE *(*cb)(struct _Pool *,
pool->loadcallbackdata = loadcbdata;
}

/* search the pool. the following filters are available:
* p - search just this solvable
* key - search only this key
* match - key must match this string
*/
void pool_search(Pool *pool, Id p, Id key, const char *match, int flags, int (*callback)(void *cbdata, Solvable *s, struct _Repodata *data, struct _Repokey *key, struct _KeyValue *kv), void *cbdata);

/* loop over all providers of d */
#define FOR_PROVIDES(v, vp, d) \
for (vp = pool_whatprovides(pool, d) ; (v = *vp++) != 0; )
Expand Down

0 comments on commit d26640b

Please sign in to comment.