&path, &arch, &offline, &conf))
return -1;
+ // Enable offline mode
+ if (offline)
+ flags |= PAKFIRE_FLAGS_OFFLINE;
+
// Create a new Pakfire instance
int r = pakfire_create(&self->pakfire, path, arch, conf, flags);
if (r) {
return -1;
}
- // Set offline mode if requested
- if (offline)
- pakfire_set_offline(self->pakfire, 1);
-
return 0;
}
Py_RETURN_NONE;
}
-static PyObject* Pakfire_get_offline(PakfireObject* self) {
- int offline = pakfire_get_offline(self->pakfire);
-
- if (offline)
- Py_RETURN_TRUE;
-
- Py_RETURN_FALSE;
-}
-
-static int Pakfire_set_offline(PakfireObject* self, PyObject* value) {
- pakfire_set_offline(self->pakfire, PyObject_IsTrue(value));
-
- return 0;
-}
-
static PyObject* Pakfire_bind(PakfireObject* self, PyObject* args) {
const char* src = NULL;
const char* dst = NULL;
NULL,
NULL
},
- {
- "offline",
- (getter)Pakfire_get_offline,
- (setter)Pakfire_set_offline,
- NULL,
- NULL,
- },
{
"path",
(getter)Pakfire_get_path,
#include <pakfire/repolist.h>
#include <pakfire/types.h>
+enum pakfire_flags {
+ PAKFIRE_FLAGS_OFFLINE = (1 << 0),
+};
+
int pakfire_create(Pakfire* pakfire, const char* path, const char* arch,
const char* conf, int flags);
const char* pakfire_get_arch(Pakfire pakfire);
-int pakfire_get_offline(Pakfire pakfire);
-void pakfire_set_offline(Pakfire pakfire, int offline);
-
const char** pakfire_get_installonly(Pakfire pakfire);
void pakfire_set_installonly(Pakfire pakfire, const char** installonly);
pakfire_get_arch;
pakfire_get_installed_repo;
pakfire_get_installonly;
- pakfire_get_offline;
pakfire_get_path;
pakfire_get_pool;
pakfire_get_repo;
pakfire_ref;
pakfire_search;
pakfire_set_installonly;
- pakfire_set_offline;
pakfire_unref;
pakfire_version_compare;
pakfire_whatprovides;
return pakfire->arch;
}
-PAKFIRE_EXPORT int pakfire_get_offline(Pakfire pakfire) {
- return pakfire->offline;
-}
-
-PAKFIRE_EXPORT void pakfire_set_offline(Pakfire pakfire, int offline) {
- pakfire->offline = offline;
-}
-
PAKFIRE_EXPORT int pakfire_version_compare(Pakfire pakfire, const char* evr1, const char* evr2) {
return pool_evrcmp_str(pakfire->pool, evr1, evr2, EVRCMP_COMPARE);
}