]> git.ipfire.org Git - pakfire.git/commitdiff
libpakfire: Drop pakfire_pool_[gs]et_installonly functions
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 18 Jan 2018 18:25:12 +0000 (19:25 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 18 Jan 2018 18:25:12 +0000 (19:25 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/_pakfire/pakfire.c
src/_pakfire/pool.c
src/libpakfire/include/pakfire/pakfire.h
src/libpakfire/include/pakfire/pool.h
src/libpakfire/libpakfire.sym
src/libpakfire/pool.c
src/libpakfire/request.c

index 7bb283a8e8ef4645fdee9796897efe5d7e7fbe5f..2a9a52bc971d8e71b045540c9a175d70b80c9352 100644 (file)
@@ -217,6 +217,45 @@ static PyObject* Pakfire_version_compare(PakfireObject* self, PyObject* args) {
        return PyLong_FromLong(cmp);
 }
 
+static PyObject* Pakfire_get_installonly(PakfireObject* self) {
+       const char** installonly = pakfire_get_installonly(self->pakfire);
+
+       PyObject* list = PyList_New(0);
+       const char* name;
+
+       while ((name = *installonly++) != NULL) {
+               PyObject* item = PyUnicode_FromString(name);
+               PyList_Append(list, item);
+
+               Py_DECREF(item);
+       }
+
+       Py_INCREF(list);
+       return list;
+}
+
+static int Pakfire_set_installonly(PakfireObject* self, PyObject* value) {
+       if (!PySequence_Check(value)) {
+               PyErr_SetString(PyExc_AttributeError, "Expected a sequence.");
+               return -1;
+       }
+
+       const int length = PySequence_Length(value);
+       const char* installonly[length + 1];
+
+       for (int i = 0; i < length; i++) {
+               PyObject* item = PySequence_GetItem(value, i);
+
+               installonly[i] = PyUnicode_AsUTF8(item);
+               Py_DECREF(item);
+       }
+       installonly[length] = NULL;
+
+       pakfire_set_installonly(self->pakfire, installonly);
+
+       return 0;
+}
+
 static struct PyMethodDef Pakfire_methods[] = {
        {
                "generate_key",
@@ -272,6 +311,13 @@ static struct PyGetSetDef Pakfire_getsetters[] = {
                NULL,
                NULL
        },
+       {
+               "installonly",
+               (getter)Pakfire_get_installonly,
+               (setter)Pakfire_set_installonly,
+               NULL,
+               NULL
+       },
        {
                "keys",
                (getter)Pakfire_get_keys,
index 635d4c0c4fe69ea280499b41ff05759d696c65c6..dcae7b6fbaef10a3eef7b40e8853ffc34c4b7505 100644 (file)
@@ -67,44 +67,7 @@ static Py_ssize_t Pool_len(PoolObject* self) {
        return pakfire_pool_count(self->pool);
 }
 
-static PyObject* Pool_get_installonly(PoolObject* self) {
-       const char** installonly = pakfire_pool_get_installonly(self->pool);
 
-       PyObject* list = PyList_New(0);
-       const char* name;
-
-       while ((name = *installonly++) != NULL) {
-               PyObject* item = PyUnicode_FromString(name);
-               PyList_Append(list, item);
-
-               Py_DECREF(item);
-       }
-
-       Py_INCREF(list);
-       return list;
-}
-
-static int Pool_set_installonly(PoolObject* self, PyObject* value) {
-       if (!PySequence_Check(value)) {
-               PyErr_SetString(PyExc_AttributeError, "Expected a sequence.");
-               return -1;
-       }
-
-       const int length = PySequence_Length(value);
-       const char* installonly[length + 1];
-
-       for (int i = 0; i < length; i++) {
-               PyObject* item = PySequence_GetItem(value, i);
-
-               installonly[i] = PyUnicode_AsUTF8(item);
-               Py_DECREF(item);
-       }
-       installonly[length] = NULL;
-
-       pakfire_pool_set_installonly(self->pool, installonly);
-
-       return 0;
-}
 
 static PyObject* Pool_get_cache_path(PoolObject* self) {
        const char* path = pakfire_pool_get_cache_path(self->pool);
@@ -130,13 +93,6 @@ static struct PyGetSetDef Pool_getsetters[] = {
                NULL,
                NULL
        },
-       {
-               "installonly",
-               (getter)Pool_get_installonly,
-               (setter)Pool_set_installonly,
-               NULL,
-               NULL
-       },
        { NULL }
 };
 
index 5b917e7fa959b795493222835c99492cb8d860ea..5cf492dadd5687befee000a25fb69c5d2fba57fb 100644 (file)
@@ -35,6 +35,9 @@ const char* pakfire_get_arch(Pakfire pakfire);
 
 PakfirePool pakfire_get_pool(Pakfire pakfire);
 
+const char** pakfire_get_installonly(Pakfire pakfire);
+void pakfire_set_installonly(Pakfire pakfire, const char** installonly);
+
 int pakfire_version_compare(Pakfire pakfire, const char* evr1, const char* evr2);
 
 PakfireRepo pakfire_get_installed_repo(Pakfire pakfire);
@@ -51,6 +54,7 @@ void pakfire_pool_has_changed(Pakfire pakfire);
 void pakfire_pool_apply_changes(Pakfire pakfire);
 
 Pool* pakfire_get_solv_pool(Pakfire pakfire);
+Queue* pakfire_get_installonly_queue(Pakfire pakfire);
 
 #endif
 
index fe22c5493ae214dbc36b8f007f23905321953f45..01a5df6532b4112b9cd6306b9c12d6d82c948418 100644 (file)
@@ -30,9 +30,6 @@ PakfirePool pakfire_pool_unref(PakfirePool pool);
 
 int pakfire_pool_count(PakfirePool pool);
 
-const char** pakfire_pool_get_installonly(PakfirePool pool);
-void pakfire_pool_set_installonly(PakfirePool pool, const char** installonly);
-
 const char* pakfire_pool_get_cache_path(PakfirePool pool);
 void pakfire_pool_set_cache_path(PakfirePool pool, const char* path);
 PakfireCache pakfire_pool_get_cache(PakfirePool pool);
@@ -47,8 +44,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);
 
-Queue* pakfire_pool_get_installonly_queue(PakfirePool pool);
-
 #endif
 
 #endif /* PAKFIRE_POOL_H */
index 89ad676e5c1b4abb881093769162d2a9d31844e1..8bebf05b0defeb1b704630867aab14d017f1a258 100644 (file)
@@ -25,11 +25,13 @@ global:
        pakfire_create;
        pakfire_get_arch;
        pakfire_get_installed_repo;
+       pakfire_get_installonly;
        pakfire_get_path;
        pakfire_get_pool;
        pakfire_ref;
        pakfire_search;
        pakfire_set_installed_repo;
+       pakfire_set_installonly;
        pakfire_unref;
        pakfire_version_compare;
        pakfire_whatprovides;
@@ -203,11 +205,9 @@ global:
        pakfire_pool_count;
        pakfire_pool_create;
        pakfire_pool_get_cache_path;
-       pakfire_pool_get_installonly;
        pakfire_pool_ref;
        pakfire_pool_search;
        pakfire_pool_set_cache_path;
-       pakfire_pool_set_installonly;
        pakfire_pool_unref;
        pakfire_pool_whatprovides;
 
index e4025bf174ae3fb991c6826e30d84cb2f552ab6f..8761214e345f6e71cf08239344a92e58305b7bb5 100644 (file)
@@ -96,18 +96,6 @@ PAKFIRE_EXPORT int pakfire_pool_count(PakfirePool pool) {
        return cnt;
 }
 
-PAKFIRE_EXPORT const char** pakfire_pool_get_installonly(PakfirePool pool) {
-       return pakfire_get_installonly(pool->pakfire);
-}
-
-Queue* pakfire_pool_get_installonly_queue(PakfirePool pool) {
-       return pakfire_get_installonly_queue(pool->pakfire);
-}
-
-PAKFIRE_EXPORT void pakfire_pool_set_installonly(PakfirePool pool, const char** installonly) {
-       pakfire_set_installonly(pool->pakfire, installonly);
-}
-
 PAKFIRE_EXPORT const char* pakfire_pool_get_cache_path(PakfirePool pool) {
        if (!pool->cache)
                return NULL;
index 77408585c9a057e5062b4eb640911bb03015c08d..2e8d797f4c48bd9a80ea3355e47ddb4262684727 100644 (file)
@@ -178,10 +178,7 @@ PAKFIRE_EXPORT int pakfire_request_solve(PakfireRequest request, int flags) {
        }
 
        /* turn off implicit obsoletes for installonly packages */
-       PakfirePool pool = pakfire_get_pool(request->pakfire);
-       Queue* installonly = pakfire_pool_get_installonly_queue(pool);
-       pakfire_pool_unref(pool);
-
+       Queue* installonly = pakfire_get_installonly_queue(request->pakfire);
        for (int i = 0; i < installonly->count; i++)
                queue_push2(&queue, SOLVER_MULTIVERSION|SOLVER_SOLVABLE_PROVIDES,
                        installonly->elements[i]);