#include <pakfire/key.h>
#include <pakfire/repo.h>
#include <pakfire/repolist.h>
-#include <pakfire/snapshot.h>
#include <pakfire/util.h>
#include "errors.h"
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) {
METH_VARARGS|METH_KEYWORDS,
NULL
},
- {
- "create_snapshot",
- (PyCFunction)Pakfire_create_snapshot,
- METH_VARARGS,
- NULL,
- },
{
"copy_in",
(PyCFunction)Pakfire_copy_in,
METH_NOARGS,
NULL,
},
- {
- "restore_snapshot",
- (PyCFunction)Pakfire_restore_snapshot,
- METH_VARARGS,
- NULL,
- },
{
"version_compare",
(PyCFunction)Pakfire_version_compare,
#ifndef PAKFIRE_SNAPSHOT_H
#define PAKFIRE_SNAPSHOT_H
+#ifdef PAKFIRE_PRIVATE
+
#include <stdio.h>
#include <pakfire/types.h>
int pakfire_snapshot_create(Pakfire pakfire, FILE* f);
int pakfire_snapshot_restore(Pakfire pakfire, FILE* f);
+#endif
+
#endif /* PAKFIRE_SNAPSHOT_H */
#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>
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);
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