]> git.ipfire.org Git - pakfire.git/commitdiff
snapshots: Make functionality private
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 5 Jun 2021 13:20:46 +0000 (13:20 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 5 Jun 2021 13:20:46 +0000 (13:20 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/_pakfire/pakfire.c
src/libpakfire/include/pakfire/snapshot.h
src/libpakfire/libpakfire.sym
src/libpakfire/snapshot.c

index f1f2a76bd8a12577b1909868ecf2fa6cadd8cc45..1325f98166eed988100979e57f27ee14449a7255 100644 (file)
@@ -31,7 +31,6 @@
 #include <pakfire/key.h>
 #include <pakfire/repo.h>
 #include <pakfire/repolist.h>
-#include <pakfire/snapshot.h>
 #include <pakfire/util.h>
 
 #include "errors.h"
@@ -731,52 +730,6 @@ static PyObject* Pakfire_copy_out(PakfireObject* self, PyObject* args) {
        Py_RETURN_NONE;
 }
 
-static PyObject* Pakfire_create_snapshot(PakfireObject* self, PyObject* args) {
-       const char* path = NULL;
-
-       if (!PyArg_ParseTuple(args, "s", &path))
-               return NULL;
-
-       FILE* f = fopen(path, "w");
-       if (!f) {
-               PyErr_SetFromErrno(PyExc_OSError);
-               return NULL;
-       }
-
-       int r = pakfire_snapshot_create(self->pakfire, f);
-       fclose(f);
-
-       if (r) {
-               PyErr_SetFromErrno(PyExc_OSError);
-               return NULL;
-       }
-
-       Py_RETURN_NONE;
-}
-
-static PyObject* Pakfire_restore_snapshot(PakfireObject* self, PyObject* args) {
-       const char* path = NULL;
-
-       if (!PyArg_ParseTuple(args, "s", &path))
-               return NULL;
-
-       FILE* f = fopen(path, "r");
-       if (!f) {
-               PyErr_SetFromErrno(PyExc_OSError);
-               return NULL;
-       }
-
-       int r = pakfire_snapshot_restore(self->pakfire, f);
-       fclose(f);
-
-       if (r) {
-               PyErr_SetFromErrno(PyExc_OSError);
-               return NULL;
-       }
-
-       Py_RETURN_NONE;
-}
-
 static PyObject* Pakfire_get_repos(PakfireObject* self) {
        struct pakfire_repolist* repos = pakfire_get_repos(self->pakfire);
        if (!repos) {
@@ -897,12 +850,6 @@ static struct PyMethodDef Pakfire_methods[] = {
                METH_VARARGS|METH_KEYWORDS,
                NULL
        },
-       {
-               "create_snapshot",
-               (PyCFunction)Pakfire_create_snapshot,
-               METH_VARARGS,
-               NULL,
-       },
        {
                "copy_in",
                (PyCFunction)Pakfire_copy_in,
@@ -981,12 +928,6 @@ static struct PyMethodDef Pakfire_methods[] = {
                METH_NOARGS,
                NULL,
        },
-       {
-               "restore_snapshot",
-               (PyCFunction)Pakfire_restore_snapshot,
-               METH_VARARGS,
-               NULL,
-       },
        {
                "version_compare",
                (PyCFunction)Pakfire_version_compare,
index f060d1dcc08328dd9670c564422e3159390f4bc1..66c806db1e1112aa0664273746aa7f8781560f96 100644 (file)
@@ -21,6 +21,8 @@
 #ifndef PAKFIRE_SNAPSHOT_H
 #define PAKFIRE_SNAPSHOT_H
 
+#ifdef PAKFIRE_PRIVATE
+
 #include <stdio.h>
 
 #include <pakfire/types.h>
@@ -28,4 +30,6 @@
 int pakfire_snapshot_create(Pakfire pakfire, FILE* f);
 int pakfire_snapshot_restore(Pakfire pakfire, FILE* f);
 
+#endif
+
 #endif /* PAKFIRE_SNAPSHOT_H */
index fd490e4c0dba5152e26603e3d439fcf385636b0b..ef10abfc140413f50bc6e51c10dee387fe2349ba 100644 (file)
@@ -329,10 +329,6 @@ global:
        pakfire_request_unref;
        pakfire_request_verify;
 
-       # snapshot
-       pakfire_snapshot_create;
-       pakfire_snapshot_restore;
-
        # solution
        pakfire_solution_create;
        pakfire_solution_next;
index 1aec0436a88fadd9bc32be170f0d567bc15db7f0..8780a7214d63902f6c25489f7cac985b92938dc9 100644 (file)
@@ -30,7 +30,6 @@
 #include <pakfire/filelist.h>
 #include <pakfire/i18n.h>
 #include <pakfire/logging.h>
-#include <pakfire/private.h>
 #include <pakfire/progressbar.h>
 #include <pakfire/repo.h>
 #include <pakfire/snapshot.h>
@@ -108,7 +107,7 @@ ERROR:
        return NULL;
 }
 
-PAKFIRE_EXPORT int pakfire_snapshot_create(Pakfire pakfire, FILE* f) {
+int pakfire_snapshot_create(Pakfire pakfire, FILE* f) {
        int r = 1;
 
        const char* root = pakfire_get_path(pakfire);
@@ -314,7 +313,7 @@ ERROR:
        return r;
 }
 
-PAKFIRE_EXPORT int pakfire_snapshot_restore(Pakfire pakfire, FILE* f) {
+int pakfire_snapshot_restore(Pakfire pakfire, FILE* f) {
        struct pakfire_db* db = NULL;
 
        // Extract the archive