From: Michael Tremer Date: Tue, 16 Jan 2018 00:36:12 +0000 (+0100) Subject: libpakfire: Move the pool logic into Pakfire X-Git-Tag: 0.9.28~1285^2~1176 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f989dacd893aaad7972005d60019322c040b623e;p=pakfire.git libpakfire: Move the pool logic into Pakfire Signed-off-by: Michael Tremer --- diff --git a/src/_pakfire/pakfire.c b/src/_pakfire/pakfire.c index dd0c8bcfd..7bb283a8e 100644 --- a/src/_pakfire/pakfire.c +++ b/src/_pakfire/pakfire.c @@ -27,6 +27,7 @@ #include "key.h" #include "pakfire.h" #include "repo.h" +#include "util.h" static PyObject* Pakfire_new(PyTypeObject* type, PyObject* args, PyObject* kwds) { PakfireObject* self = (PakfireObject *)type->tp_alloc(type, 0); @@ -170,6 +171,52 @@ static PyObject* Pakfire_import_key(PakfireObject* self, PyObject* args) { return _import_keylist(self, keys); } +static PyObject* Pakfire_whatprovides(PakfireObject* self, PyObject* args, PyObject* kwds) { + char* kwlist[] = {"provides", "glob", "icase", "name_only", NULL}; + + const char* provides; + int glob = 0; + int icase = 0; + int name_only = 0; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|iii", kwlist, &provides, &glob, &icase, &name_only)) + return NULL; + + int flags = 0; + if (glob) + flags |= PAKFIRE_GLOB; + if (icase) + flags |= PAKFIRE_ICASE; + if (name_only) + flags |= PAKFIRE_NAME_ONLY; + + PakfirePackageList list = pakfire_whatprovides(self->pakfire, provides, flags); + + return PyList_FromPackageList(self, list); +} + +static PyObject* Pakfire_search(PakfireObject* self, PyObject* args) { + const char* what; + + if (!PyArg_ParseTuple(args, "s", &what)) + return NULL; + + PakfirePackageList list = pakfire_search(self->pakfire, what, 0); + return PyList_FromPackageList(self, list); +} + +static PyObject* Pakfire_version_compare(PakfireObject* self, PyObject* args) { + const char* evr1 = NULL; + const char* evr2 = NULL; + + if (!PyArg_ParseTuple(args, "ss", &evr1, &evr2)) + return NULL; + + int cmp = pakfire_version_compare(self->pakfire, evr1, evr2); + + return PyLong_FromLong(cmp); +} + static struct PyMethodDef Pakfire_methods[] = { { "generate_key", @@ -189,6 +236,24 @@ static struct PyMethodDef Pakfire_methods[] = { METH_VARARGS, NULL }, + { + "search", + (PyCFunction)Pakfire_search, + METH_VARARGS, + NULL + }, + { + "version_compare", + (PyCFunction)Pakfire_version_compare, + METH_VARARGS, + NULL + }, + { + "whatprovides", + (PyCFunction)Pakfire_whatprovides, + METH_VARARGS|METH_KEYWORDS, + NULL + }, { NULL }, }; diff --git a/src/_pakfire/pool.c b/src/_pakfire/pool.c index 4f4f1f9a9..635d4c0c4 100644 --- a/src/_pakfire/pool.c +++ b/src/_pakfire/pool.c @@ -63,17 +63,6 @@ static int Pool_init(PoolObject* self, PyObject* args, PyObject* kwds) { return 0; } -static PyObject* Pool_version_compare(PoolObject* self, PyObject* args) { - const char* evr1 = NULL; - const char* evr2 = NULL; - - if (!PyArg_ParseTuple(args, "ss", &evr1, &evr2)) - return NULL; - - int cmp = pakfire_pool_version_compare(self->pool, evr1, evr2); - return PyLong_FromLong(cmp); -} - static Py_ssize_t Pool_len(PoolObject* self) { return pakfire_pool_count(self->pool); } @@ -133,62 +122,6 @@ static int Pool_set_cache_path(PoolObject* self, PyObject* value) { return 0; } -static PyObject* Pool_whatprovides(PoolObject* self, PyObject* args, PyObject* kwds) { - char* kwlist[] = {"provides", "glob", "icase", "name_only", NULL}; - - const char* provides; - int glob = 0; - int icase = 0; - int name_only = 0; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|iii", kwlist, &provides, &glob, &icase, &name_only)) - return NULL; - - int flags = 0; - if (glob) - flags |= PAKFIRE_GLOB; - if (icase) - flags |= PAKFIRE_ICASE; - if (name_only) - flags |= PAKFIRE_NAME_ONLY; - - PakfirePackageList list = pakfire_pool_whatprovides(self->pool, provides, flags); - - return PyList_FromPackageList(self, list); -} - -static PyObject* Pool_search(PoolObject* self, PyObject* args) { - const char* what; - - if (!PyArg_ParseTuple(args, "s", &what)) - return NULL; - - PakfirePackageList list = pakfire_pool_search(self->pool, what, 0); - return PyList_FromPackageList(self, list); -} - -static struct PyMethodDef Pool_methods[] = { - { - "search", - (PyCFunction)Pool_search, - METH_VARARGS, - NULL - }, - { - "version_compare", - (PyCFunction)Pool_version_compare, - METH_VARARGS, - NULL - }, - { - "whatprovides", - (PyCFunction)Pool_whatprovides, - METH_VARARGS|METH_KEYWORDS, - NULL - }, - { NULL } -}; - static struct PyGetSetDef Pool_getsetters[] = { { "cache_path", @@ -220,7 +153,6 @@ PyTypeObject PoolType = { tp_dealloc: (destructor)Pool_dealloc, tp_init: (initproc)Pool_init, tp_doc: "Pool object", - tp_methods: Pool_methods, tp_getset: Pool_getsetters, tp_as_sequence: &Pool_sequence, }; diff --git a/src/_pakfire/util.c b/src/_pakfire/util.c index c3447a41f..383da37c2 100644 --- a/src/_pakfire/util.c +++ b/src/_pakfire/util.c @@ -142,14 +142,14 @@ PyObject* performance_index(PyObject* self, PyObject* args) { return PyLong_FromUnsignedLong(iterations); } -PyObject* PyList_FromPackageList(PoolObject* pool, PakfirePackageList packagelist) { +PyObject* PyList_FromPackageList(PakfireObject* pakfire, PakfirePackageList packagelist) { PyObject* list = PyList_New(0); int count = pakfire_packagelist_count(packagelist); for (int i = 0; i < count; i++) { PakfirePackage package = pakfire_packagelist_get(packagelist, i); - PyObject* item = new_package(pool, pakfire_package_id(package)); + PyObject* item = new_package(pakfire, pakfire_package_id(package)); PyList_Append(list, item); pakfire_package_unref(package); diff --git a/src/_pakfire/util.h b/src/_pakfire/util.h index f7f43f342..22c51e689 100644 --- a/src/_pakfire/util.h +++ b/src/_pakfire/util.h @@ -26,7 +26,7 @@ #include #include -#include "pool.h" +#include "pakfire.h" extern PyObject *_personality(PyObject *self, PyObject *args); extern PyObject *_sync(PyObject *self, PyObject *args); @@ -34,6 +34,6 @@ extern PyObject *_unshare(PyObject *self, PyObject *args); extern PyObject *version_compare(PyObject *self, PyObject *args); extern PyObject* performance_index(PyObject* self, PyObject* args); -PyObject* PyList_FromPackageList(PoolObject* pool, PakfirePackageList packagelist); +PyObject* PyList_FromPackageList(PakfireObject* pakfire, PakfirePackageList packagelist); #endif /* PYTHON_PAKFIRE_UTIL_H */ diff --git a/src/libpakfire/include/pakfire/pakfire.h b/src/libpakfire/include/pakfire/pakfire.h index 0e8a8b94f..5b917e7fa 100644 --- a/src/libpakfire/include/pakfire/pakfire.h +++ b/src/libpakfire/include/pakfire/pakfire.h @@ -35,13 +35,21 @@ const char* pakfire_get_arch(Pakfire pakfire); PakfirePool pakfire_get_pool(Pakfire pakfire); +int pakfire_version_compare(Pakfire pakfire, const char* evr1, const char* evr2); + PakfireRepo pakfire_get_installed_repo(Pakfire pakfire); void pakfire_set_installed_repo(Pakfire pakfire, PakfireRepo repo); +PakfirePackageList pakfire_whatprovides(Pakfire pakfire, const char* provides, int flags); +PakfirePackageList pakfire_search(Pakfire pakfire, const char* what, int flags); + #ifdef PAKFIRE_PRIVATE #include +void pakfire_pool_has_changed(Pakfire pakfire); +void pakfire_pool_apply_changes(Pakfire pakfire); + Pool* pakfire_get_solv_pool(Pakfire pakfire); #endif diff --git a/src/libpakfire/include/pakfire/pool.h b/src/libpakfire/include/pakfire/pool.h index 3bae21067..806cc3568 100644 --- a/src/libpakfire/include/pakfire/pool.h +++ b/src/libpakfire/include/pakfire/pool.h @@ -48,9 +48,6 @@ PakfirePackageList pakfire_pool_search(PakfirePool pool, const char* what, int f Pool* pakfire_pool_get_solv_pool(PakfirePool pool); char* pakfire_pool_tmpdup(Pool* pool, const char* s); -void pakfire_pool_has_changed(PakfirePool pool); -void pakfire_pool_apply_changes(PakfirePool pool); - Queue* pakfire_pool_get_installonly_queue(PakfirePool pool); #endif diff --git a/src/libpakfire/libpakfire.sym b/src/libpakfire/libpakfire.sym index 687692099..304ad984c 100644 --- a/src/libpakfire/libpakfire.sym +++ b/src/libpakfire/libpakfire.sym @@ -28,8 +28,11 @@ global: pakfire_get_path; pakfire_get_pool; pakfire_ref; + pakfire_search; pakfire_set_installed_repo; pakfire_unref; + pakfire_version_compare; + pakfire_whatprovides; # archive pakfire_archive_count_signatures; diff --git a/src/libpakfire/pakfire.c b/src/libpakfire/pakfire.c index fe19d2e15..78127f2eb 100644 --- a/src/libpakfire/pakfire.c +++ b/src/libpakfire/pakfire.c @@ -18,9 +18,14 @@ # # #############################################################################*/ +#include #include +#include +#include #include +#include +#include #include #include #include @@ -32,12 +37,20 @@ struct _Pakfire { char* path; char* arch; - PakfirePool pool; + + // Pool stuff + PakfirePool _pool; + Pool* pool; + int pool_ready; + Queue installonly; // Logging pakfire_log_function_t log_function; int log_priority; + // Cache + PakfireCache cache; + int nrefs; }; @@ -63,7 +76,11 @@ PAKFIRE_EXPORT Pakfire pakfire_create(const char* path, const char* arch) { DEBUG(" path = %s\n", pakfire_get_path(pakfire)); // Initialize the pool - pakfire->pool = pakfire_pool_create(pakfire); + pakfire->_pool = pakfire_pool_create(pakfire); + pakfire->pool = pool_create(); + + // Set architecture of the pool + pool_setarch(pakfire->pool, pakfire->arch); } return pakfire; @@ -75,6 +92,19 @@ PAKFIRE_EXPORT Pakfire pakfire_ref(Pakfire pakfire) { return pakfire; } +static void pakfire_pool_free_repos(Pool* pool) { + Repo* repo; + int i; + + FOR_REPOS(i, repo) { + PakfireRepo r = repo->appdata; + if (r == NULL) + continue; + + pakfire_repo_unref(r); + } +} + PAKFIRE_EXPORT Pakfire pakfire_unref(Pakfire pakfire) { if (!pakfire) return NULL; @@ -82,7 +112,10 @@ PAKFIRE_EXPORT Pakfire pakfire_unref(Pakfire pakfire) { if (--pakfire->nrefs > 0) return pakfire; - pakfire_pool_unref(pakfire->pool); + pakfire_pool_unref(pakfire->_pool); + pakfire_pool_free_repos(pakfire->pool); + pool_free(pakfire->pool); + queue_free(&pakfire->installonly); pakfire_free(pakfire->path); pakfire_free(pakfire->arch); @@ -103,28 +136,161 @@ PAKFIRE_EXPORT const char* pakfire_get_arch(Pakfire pakfire) { } PAKFIRE_EXPORT PakfirePool pakfire_get_pool(Pakfire pakfire) { - return pakfire_pool_ref(pakfire->pool); + return pakfire_pool_ref(pakfire->_pool); +} + +PAKFIRE_EXPORT int pakfire_version_compare(Pakfire pakfire, const char* evr1, const char* evr2) { + return pool_evrcmp_str(pakfire->pool, evr1, evr2, EVRCMP_COMPARE); } Pool* pakfire_get_solv_pool(Pakfire pakfire) { - return pakfire_pool_get_solv_pool(pakfire->pool); + return pakfire->pool; +} + +void pakfire_pool_has_changed(Pakfire pakfire) { + pakfire->pool_ready = 0; +} + +void pakfire_pool_apply_changes(Pakfire pakfire) { + if (!pakfire->pool_ready) { + pool_addfileprovides(pakfire->pool); + pool_createwhatprovides(pakfire->pool); + pakfire->pool_ready = 1; + } } PAKFIRE_EXPORT PakfireRepo pakfire_get_installed_repo(Pakfire pakfire) { - Pool* p = pakfire_pool_get_solv_pool(pakfire->pool); - if (!p->installed) + if (!pakfire->pool->installed) return NULL; - return pakfire_repo_create_from_repo(pakfire, p->installed); + return pakfire_repo_create_from_repo(pakfire, pakfire->pool->installed); } PAKFIRE_EXPORT void pakfire_set_installed_repo(Pakfire pakfire, PakfireRepo repo) { - Pool* p = pakfire_pool_get_solv_pool(pakfire->pool); - if (!repo) { - pool_set_installed(p, NULL); + pool_set_installed(pakfire->pool, NULL); + return; + } + + pool_set_installed(pakfire->pool, pakfire_repo_get_repo(repo)); +} + +PAKFIRE_EXPORT const char** pakfire_get_installonly(Pakfire pakfire) { + Queue q; + queue_init_clone(&q, &pakfire->installonly); + + const char** installonly = pakfire_malloc(sizeof(const char*) * (q.count + 1)); + + int i = 0; + while (q.count) { + installonly[i++] = pool_id2str(pakfire->pool, queue_shift(&q)); + } + installonly[i] = NULL; + + queue_free(&q); + + return installonly; +} + +Queue* pakfire_get_installonly_queue(Pakfire pakfire) { + return &pakfire->installonly; +} + +PAKFIRE_EXPORT void pakfire_set_installonly(Pakfire pakfire, const char** installonly) { + queue_empty(&pakfire->installonly); + + if (installonly == NULL) return; + + const char* name; + while ((name = *installonly++) != NULL) + queue_pushunique(&pakfire->installonly, pool_str2id(pakfire->pool, name, 1)); +} + +static PakfirePackageList pakfire_pool_dataiterator(Pakfire pakfire, const char* what, int key, int flags) { + PakfirePackageList list = pakfire_packagelist_create(); + pakfire_pool_apply_changes(pakfire); + + int di_flags = 0; + if (flags & PAKFIRE_SUBSTRING) + di_flags |= SEARCH_SUBSTRING; + else + di_flags |= SEARCH_STRING; + + if (flags & PAKFIRE_ICASE) + di_flags |= SEARCH_NOCASE; + if (flags & PAKFIRE_GLOB) + di_flags |= SEARCH_GLOB; + + Dataiterator di; + dataiterator_init(&di, pakfire->pool, 0, 0, key, what, di_flags); + while (dataiterator_step(&di)) { + PakfirePackage pkg = pakfire_package_create(pakfire, di.solvid); + pakfire_packagelist_push_if_not_exists(list, pkg); } + dataiterator_free(&di); + + return list; +} + +static PakfirePackageList pakfire_search_name(Pakfire pakfire, const char* name, int flags) { + if (!flags) { + PakfirePackageList list = pakfire_packagelist_create(); + pakfire_pool_apply_changes(pakfire); + + Id id = pool_str2id(pakfire->pool, name, 0); + if (id == 0) + return list; + + Id p, pp; + Pool* pool = pakfire->pool; + FOR_PROVIDES(p, pp, id) { + Solvable* s = pool_id2solvable(pakfire->pool, p); + + if (s->name == id) { + PakfirePackage pkg = pakfire_package_create(pakfire, p); + pakfire_packagelist_push_if_not_exists(list, pkg); + } + } + + return list; + } + + return pakfire_pool_dataiterator(pakfire, name, SOLVABLE_NAME, flags); +} + +static PakfirePackageList pakfire_search_provides(Pakfire pakfire, const char* provides, int flags) { + if (!flags) { + PakfirePackageList list = pakfire_packagelist_create(); + pakfire_pool_apply_changes(pakfire); + + Id id = pool_str2id(pakfire->pool, provides, 0); + if (id == 0) + return list; + + Id p, pp; + Pool* pool = pakfire->pool; + FOR_PROVIDES(p, pp, id) { + PakfirePackage pkg = pakfire_package_create(pakfire, p); + pakfire_packagelist_push_if_not_exists(list, pkg); + } + + return list; + } + + return pakfire_pool_dataiterator(pakfire, provides, SOLVABLE_PROVIDES, flags); +} + +PAKFIRE_EXPORT PakfirePackageList pakfire_whatprovides(Pakfire pakfire, const char* what, int flags) { + if (flags & PAKFIRE_NAME_ONLY) { + flags &= ~PAKFIRE_NAME_ONLY; + + return pakfire_search_name(pakfire, what, flags); + } else { + return pakfire_search_provides(pakfire, what, flags); + } +} - pool_set_installed(p, pakfire_repo_get_repo(repo)); +PAKFIRE_EXPORT PakfirePackageList pakfire_search(Pakfire pakfire, const char* what, int flags) { + return pakfire_pool_dataiterator(pakfire, what, 0, PAKFIRE_SUBSTRING); } diff --git a/src/libpakfire/pool.c b/src/libpakfire/pool.c index a14ce1380..d8ab58a63 100644 --- a/src/libpakfire/pool.c +++ b/src/libpakfire/pool.c @@ -20,9 +20,7 @@ #include -#include #include -#include #include #include @@ -37,11 +35,10 @@ #include #include -struct _PakfirePool { - Pool* pool; - int provides_ready; - Queue installonly; +// This is just being left here for compatibility +struct _PakfirePool { + Pakfire pakfire; PakfireCache cache; int nrefs; }; @@ -52,40 +49,14 @@ PAKFIRE_EXPORT PakfirePool pakfire_pool_create(Pakfire pakfire) { DEBUG("Allocated Pool at %p\n", pool); pool->nrefs = 1; - // Initialize pool - pool->pool = pool_create(); - queue_init(&pool->installonly); - - // Self-reference this object in libsolv - pool->pool->appdata = pool; - - // Set architecture - const char* arch = pakfire_get_arch(pakfire); - pool_setarch(pool->pool, arch); + pool->pakfire = pakfire_ref(pakfire); } return pool; } -static void pakfire_pool_free_repos(Pool* pool) { - Repo* repo; - int i; - - FOR_REPOS(i, repo) { - PakfireRepo r = repo->appdata; - if (r == NULL) - continue; - - pakfire_repo_unref(r); - } -} - static void pakfire_pool_free(PakfirePool pool) { - pakfire_pool_free_repos(pool->pool); - - queue_free(&pool->installonly); - - pool_free(pool->pool); + pakfire_unref(pool->pakfire); pakfire_free(pool); DEBUG("Released Pool at %p\n", pool); @@ -109,18 +80,19 @@ PAKFIRE_EXPORT PakfirePool pakfire_pool_unref(PakfirePool pool) { } Pool* pakfire_pool_get_solv_pool(PakfirePool pool) { - return pool->pool; + return pakfire_get_solv_pool(pool->pakfire); } PAKFIRE_EXPORT int pakfire_pool_version_compare(PakfirePool pool, const char* evr1, const char* evr2) { - return pool_evrcmp_str(pool->pool, evr1, evr2, EVRCMP_COMPARE); + return pakfire_version_compare(pool->pakfire, evr1, evr2); } PAKFIRE_EXPORT int pakfire_pool_count(PakfirePool pool) { + Pool* p = pakfire_get_solv_pool(pool->pakfire); int cnt = 0; - for (int i = 2; i < pool->pool->nsolvables; i++) { - Solvable* s = pool->pool->solvables + i; + for (int i = 2; i < p->nsolvables; i++) { + Solvable* s = p->solvables + i; if (s->repo) cnt++; } @@ -128,48 +100,16 @@ PAKFIRE_EXPORT int pakfire_pool_count(PakfirePool pool) { return cnt; } -void pakfire_pool_has_changed(PakfirePool pool) { - pool->provides_ready = 0; -} - -void pakfire_pool_apply_changes(PakfirePool pool) { - if (!pool->provides_ready) { - pool_addfileprovides(pool->pool); - pool_createwhatprovides(pool->pool); - pool->provides_ready = 1; - } -} - PAKFIRE_EXPORT const char** pakfire_pool_get_installonly(PakfirePool pool) { - Queue q; - queue_init_clone(&q, &pool->installonly); - - const char** installonly = pakfire_malloc(sizeof(const char*) * (q.count + 1)); - - int i = 0; - while (q.count) { - installonly[i++] = pool_id2str(pool->pool, queue_shift(&q)); - } - installonly[i] = NULL; - - queue_free(&q); - - return installonly; + return pakfire_get_installonly(pool->pakfire); } Queue* pakfire_pool_get_installonly_queue(PakfirePool pool) { - return &pool->installonly; + return pakfire_get_installonly_queue(pool->pakfire); } PAKFIRE_EXPORT void pakfire_pool_set_installonly(PakfirePool pool, const char** installonly) { - queue_empty(&pool->installonly); - - if (installonly == NULL) - return; - - const char* name; - while ((name = *installonly++) != NULL) - queue_pushunique(&pool->installonly, pool_str2id(pool->pool, name, 1)); + pakfire_set_installonly(pool->pakfire, installonly); } PAKFIRE_EXPORT const char* pakfire_pool_get_cache_path(PakfirePool pool) { @@ -193,94 +133,12 @@ PAKFIRE_EXPORT PakfireCache pakfire_pool_get_cache(PakfirePool pool) { return NULL; } -static PakfirePackageList pakfire_pool_dataiterator(PakfirePool pool, const char* what, int key, int flags) { - PakfirePackageList list = pakfire_packagelist_create(); - pakfire_pool_apply_changes(pool); - - int di_flags = 0; - if (flags & PAKFIRE_SUBSTRING) - di_flags |= SEARCH_SUBSTRING; - else - di_flags |= SEARCH_STRING; - - if (flags & PAKFIRE_ICASE) - di_flags |= SEARCH_NOCASE; - if (flags & PAKFIRE_GLOB) - di_flags |= SEARCH_GLOB; - - Dataiterator di; - dataiterator_init(&di, pool->pool, 0, 0, key, what, di_flags); - while (dataiterator_step(&di)) { - PakfirePackage pkg = pakfire_package_create(pool, di.solvid); - pakfire_packagelist_push_if_not_exists(list, pkg); - } - dataiterator_free(&di); - - return list; -} - -static PakfirePackageList pakfire_pool_search_name(PakfirePool _pool, const char* name, int flags) { - if (!flags) { - PakfirePackageList list = pakfire_packagelist_create(); - pakfire_pool_apply_changes(_pool); - - Pool* pool = _pool->pool; - Id id = pool_str2id(pool, name, 0); - if (id == 0) - return list; - - Id p, pp; - FOR_PROVIDES(p, pp, id) { - Solvable* s = pool_id2solvable(pool, p); - - if (s->name == id) { - PakfirePackage pkg = pakfire_package_create(_pool, p); - pakfire_packagelist_push_if_not_exists(list, pkg); - } - } - - return list; - } - - return pakfire_pool_dataiterator(_pool, name, SOLVABLE_NAME, flags); -} - -static PakfirePackageList pakfire_pool_search_provides(PakfirePool _pool, const char* provides, int flags) { - if (!flags) { - PakfirePackageList list = pakfire_packagelist_create(); - pakfire_pool_apply_changes(_pool); - - Pool* pool = _pool->pool; - Id id = pool_str2id(pool, provides, 0); - if (id == 0) - return list; - - Id p, pp; - FOR_PROVIDES(p, pp, id) { - PakfirePackage pkg = pakfire_package_create(_pool, p); - pakfire_packagelist_push_if_not_exists(list, pkg); - } - - return list; - } - - return pakfire_pool_dataiterator(_pool, provides, SOLVABLE_PROVIDES, flags); -} - -PAKFIRE_EXPORT PakfirePackageList pakfire_pool_whatprovides(PakfirePool pool, const char* what, int flags) { - assert((flags & ~(PAKFIRE_ICASE|PAKFIRE_NAME_ONLY|PAKFIRE_GLOB)) == 0); - - if (flags & PAKFIRE_NAME_ONLY) { - flags &= ~PAKFIRE_NAME_ONLY; - - return pakfire_pool_search_name(pool, what, flags); - } else { - return pakfire_pool_search_provides(pool, what, flags); - } +PakfirePackageList pakfire_pool_whatprovides(PakfirePool pool, const char* provides, int flags) { + return pakfire_whatprovides(pool->pakfire, provides, flags); } -PAKFIRE_EXPORT PakfirePackageList pakfire_pool_search(PakfirePool pool, const char* what, int flags) { - return pakfire_pool_dataiterator(pool, what, 0, PAKFIRE_SUBSTRING); +PakfirePackageList pakfire_pool_search(PakfirePool pool, const char* what, int flags) { + return pakfire_search(pool->pakfire, what, flags); } PAKFIRE_EXPORT char* pakfire_pool_tmpdup(Pool* pool, const char* s) {