]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
- add pool_search() function to search the pool
authorMichael Schroeder <mls@suse.de>
Fri, 15 Feb 2008 15:41:00 +0000 (15:41 +0000)
committerMichael Schroeder <mls@suse.de>
Fri, 15 Feb 2008 15:41:00 +0000 (15:41 +0000)
src/pool.c
src/pool.h

index 6e02c0e23a63c48bc4d1d20fb523d6bf463e5ec5..b2c49419525f7d4e6a505d2c6ba0fd6369be47e6 100644 (file)
@@ -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
index e4056964b4b8bd64bcfcf70ccebc545202bba4c0..e28ce8c550b78eed47e11914f0431273fcddef3b 100644 (file)
@@ -73,6 +73,8 @@ extern "C" {
 
 struct _Repo;
 struct _Repodata;
+struct _Repokey;
+struct _KeyValue;
 
 struct _Pool {
   struct _Stringpool ss;
@@ -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; )