From: Michael Tremer Date: Sat, 5 Jun 2021 13:20:46 +0000 (+0000) Subject: snapshots: Make functionality private X-Git-Tag: 0.9.28~1285^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d1989033882b74a4f5a2d66af497ea25b33de6ce;p=people%2Fms%2Fpakfire.git snapshots: Make functionality private Signed-off-by: Michael Tremer --- diff --git a/src/_pakfire/pakfire.c b/src/_pakfire/pakfire.c index f1f2a76bd..1325f9816 100644 --- a/src/_pakfire/pakfire.c +++ b/src/_pakfire/pakfire.c @@ -31,7 +31,6 @@ #include #include #include -#include #include #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, diff --git a/src/libpakfire/include/pakfire/snapshot.h b/src/libpakfire/include/pakfire/snapshot.h index f060d1dcc..66c806db1 100644 --- a/src/libpakfire/include/pakfire/snapshot.h +++ b/src/libpakfire/include/pakfire/snapshot.h @@ -21,6 +21,8 @@ #ifndef PAKFIRE_SNAPSHOT_H #define PAKFIRE_SNAPSHOT_H +#ifdef PAKFIRE_PRIVATE + #include #include @@ -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 */ diff --git a/src/libpakfire/libpakfire.sym b/src/libpakfire/libpakfire.sym index fd490e4c0..ef10abfc1 100644 --- a/src/libpakfire/libpakfire.sym +++ b/src/libpakfire/libpakfire.sym @@ -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; diff --git a/src/libpakfire/snapshot.c b/src/libpakfire/snapshot.c index 1aec0436a..8780a7214 100644 --- a/src/libpakfire/snapshot.c +++ b/src/libpakfire/snapshot.c @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include @@ -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