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",
NULL,
NULL
},
+ {
+ "installonly",
+ (getter)Pakfire_get_installonly,
+ (setter)Pakfire_set_installonly,
+ NULL,
+ NULL
+ },
{
"keys",
(getter)Pakfire_get_keys,
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);
NULL,
NULL
},
- {
- "installonly",
- (getter)Pool_get_installonly,
- (setter)Pool_set_installonly,
- NULL,
- NULL
- },
{ NULL }
};
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);
void pakfire_pool_apply_changes(Pakfire pakfire);
Pool* pakfire_get_solv_pool(Pakfire pakfire);
+Queue* pakfire_get_installonly_queue(Pakfire pakfire);
#endif
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);
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 */
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;
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;
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;
}
/* 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]);