]> git.ipfire.org Git - pakfire.git/commitdiff
libpakfire: Move offline switch into flags
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 3 Jun 2021 20:05:59 +0000 (20:05 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 3 Jun 2021 20:05:59 +0000 (20:05 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/_pakfire/pakfire.c
src/libpakfire/include/pakfire/pakfire.h
src/libpakfire/libpakfire.sym
src/libpakfire/pakfire.c

index 9b49d0bf2d5fa47235fb4c9a1c21c55357cce236..8f27060d54b34944de8e8fce27b8051239201699 100644 (file)
@@ -62,6 +62,10 @@ static int Pakfire_init(PakfireObject* self, PyObject* args, PyObject* kwds) {
                        &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) {
@@ -79,10 +83,6 @@ static int Pakfire_init(PakfireObject* self, PyObject* args, PyObject* kwds) {
                return -1;
     }
 
-       // Set offline mode if requested
-       if (offline)
-               pakfire_set_offline(self->pakfire, 1);
-
        return 0;
 }
 
@@ -667,21 +667,6 @@ static PyObject* Pakfire_dist(PakfireObject* self, PyObject* args) {
        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;
@@ -1036,13 +1021,6 @@ static struct PyGetSetDef Pakfire_getsetters[] = {
                NULL,
                NULL
        },
-       {
-               "offline",
-               (getter)Pakfire_get_offline,
-               (setter)Pakfire_set_offline,
-               NULL,
-               NULL,
-       },
     {
                "path",
                (getter)Pakfire_get_path,
index 17aa78f3b8e06356f7c6cc6a83131479e0acc88f..ef01dd98b68f227b65b43a82f5d0e22daceffee9 100644 (file)
 #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);
 
@@ -51,9 +55,6 @@ int pakfire_copy_out(Pakfire pakfire, const char* src, const char* dst);
 
 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);
 
index 3ed5620d302e232318d48293366d424ab6dfd161..fd490e4c0dba5152e26603e3d439fcf385636b0b 100644 (file)
@@ -32,7 +32,6 @@ global:
        pakfire_get_arch;
        pakfire_get_installed_repo;
        pakfire_get_installonly;
-       pakfire_get_offline;
        pakfire_get_path;
        pakfire_get_pool;
        pakfire_get_repo;
@@ -42,7 +41,6 @@ global:
        pakfire_ref;
        pakfire_search;
        pakfire_set_installonly;
-       pakfire_set_offline;
        pakfire_unref;
        pakfire_version_compare;
        pakfire_whatprovides;
index 739a38b2d3528dffd7a0b76cff9460dfd50302a2..6c092c7370f4262633482be46236a0cd8e9b58da 100644 (file)
@@ -1129,14 +1129,6 @@ PAKFIRE_EXPORT const char* pakfire_get_arch(Pakfire pakfire) {
        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);
 }