]> git.ipfire.org Git - pakfire.git/commitdiff
repo: Export scan operation to Python
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 23 Apr 2021 14:12:45 +0000 (14:12 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 23 Apr 2021 14:12:45 +0000 (14:12 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/_pakfire/repo.c

index 810d10a8ad903ed52a4117899ada559244cdf2cf..fc22ceb4b8119774f4cd680d4b6b3cb5642ed4ea 100644 (file)
@@ -321,6 +321,21 @@ static PyObject* Repo_clean(RepoObject* self, PyObject* args) {
        Py_RETURN_NONE;
 }
 
+static PyObject* Repo_scan(RepoObject* self, PyObject* args) {
+       int flags = 0;
+
+       if (!PyArg_ParseTuple(args, "|i", &flags))
+               return NULL;
+
+       int r = pakfire_repo_scan(self->repo, flags);
+       if (r) {
+               PyErr_SetFromErrno(PyExc_OSError);
+               return NULL;
+       }
+
+       Py_RETURN_NONE;
+}
+
 static PyObject* Repo_enter(RepoObject* self) {
        Py_INCREF(self);
 
@@ -385,6 +400,12 @@ static struct PyMethodDef Repo_methods[] = {
                METH_VARARGS|METH_KEYWORDS,
                NULL,
        },
+       {
+               "scan",
+               (PyCFunction)Repo_scan,
+               METH_VARARGS,
+               NULL
+       },
        {
                "write_solv",
                (PyCFunction)Repo_write_solv,