return execute_return_value(r);
}
+static PyObject* Pakfire_clean(PakfireObject* self) {
+ int r = pakfire_clean(self->pakfire);
+ if (r) {
+ PyErr_SetFromErrno(PyExc_OSError);
+ return NULL;
+ }
+
+ Py_RETURN_NONE;
+}
+
static struct PyMethodDef Pakfire_methods[] = {
{
"bind",
METH_VARARGS|METH_KEYWORDS,
NULL
},
+ {
+ "clean",
+ (PyCFunction)Pakfire_clean,
+ METH_NOARGS,
+ NULL,
+ },
{
"copy_in",
(PyCFunction)Pakfire_copy_in,
const char* pakfire_get_path(Pakfire pakfire);
+int pakfire_clean(Pakfire pakfire);
+
int pakfire_bind(Pakfire pakfire, const char* src, const char* dst, int flags);
int pakfire_copy_in(Pakfire pakfire, const char* src, const char* dst);
global:
# pakfire
pakfire_bind;
+ pakfire_clean;
pakfire_copy_in;
pakfire_copy_out;
pakfire_count_packages;
return __mount(pakfire, src, mountpoint, NULL, flags|MS_BIND, NULL);
}
+PAKFIRE_EXPORT int pakfire_clean(Pakfire pakfire) {
+ PakfireRepo repo;
+ Repo* solv_repo;
+ int i;
+ int r;
+
+ Pool* pool = pakfire->pool;
+
+ // Cleanup all repositories
+ FOR_REPOS(i, solv_repo) {
+ repo = pakfire_repo_create_from_repo(pakfire, solv_repo);
+ if (!repo)
+ return 1;
+
+ // Perform cleanup
+ r = pakfire_repo_clean(repo);
+ pakfire_repo_unref(repo);
+
+ // Raise any errors
+ if (r)
+ return r;
+ }
+
+ return 0;
+}
+
static int pakfire_copy(Pakfire pakfire, const char* src, const char* dst) {
char buffer[512 * 1024];
struct archive* reader = NULL;
def __exit__(self, type, value, traceback):
pass
- def clean(self):
- # Clean up repository caches
- for repo in self.repos:
- repo.clean()
-
class PakfireContext(object):
"""