]> git.ipfire.org Git - pakfire.git/blobdiff - src/_pakfire/repo.c
libpakfire: Store mirrorlist in repository
[pakfire.git] / src / _pakfire / repo.c
index 7f374d4d0ce7942f1866dc4aa0bc7f098a5aaaee..659f7e37d69ab2aae1397b3970a9b643305a735f 100644 (file)
@@ -174,6 +174,21 @@ static int Repo_set_keyfile(RepoObject* self, PyObject* value) {
        return pakfire_repo_set_keyfile(self->repo, keyfile);
 }
 
+static PyObject* Repo_get_mirrorlist(RepoObject* self) {
+       const char* mirrorlist = pakfire_repo_get_mirrorlist(self->repo);
+
+       return PyUnicode_FromString(mirrorlist);
+}
+
+static int Repo_set_mirrorlist(RepoObject* self, PyObject* value) {
+       const char* mirrorlist = NULL;
+
+       if (value != Py_None)
+               mirrorlist = PyUnicode_AsUTF8(value);
+
+       return pakfire_repo_set_mirrorlist(self->repo, mirrorlist);
+}
+
 static PyObject* Repo_read_solv(RepoObject* self, PyObject* args) {
        const char* filename = NULL;
 
@@ -391,6 +406,13 @@ static struct PyGetSetDef Repo_getsetters[] = {
                NULL,
                NULL
        },
+       {
+               "mirrorlist",
+               (getter)Repo_get_mirrorlist,
+               (setter)Repo_set_mirrorlist,
+               NULL,
+               NULL
+       },
        {
                "name",
                (getter)Repo_get_name,