From: Michael Tremer Date: Wed, 13 Jan 2021 23:46:23 +0000 (+0000) Subject: Drop old unshare code X-Git-Tag: 0.9.28~1285^2~861 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c0456491a2a7bc62693732f4026a7d162654efbb;p=pakfire.git Drop old unshare code Signed-off-by: Michael Tremer --- diff --git a/src/_pakfire/_pakfiremodule.c b/src/_pakfire/_pakfiremodule.c index 1ea54086b..e3410f8fe 100644 --- a/src/_pakfire/_pakfiremodule.c +++ b/src/_pakfire/_pakfiremodule.c @@ -22,7 +22,6 @@ #include #include -#include #include @@ -72,7 +71,6 @@ static PyMethodDef pakfireModuleMethods[] = { {"version_compare", (PyCFunction)version_compare, METH_VARARGS, NULL}, {"get_capabilities", (PyCFunction)get_capabilities, METH_VARARGS, NULL}, {"sync", (PyCFunction)_sync, METH_NOARGS, NULL}, - {"unshare", (PyCFunction)_unshare, METH_VARARGS, NULL}, {"native_arch", (PyCFunction)_pakfire_native_arch, METH_NOARGS, NULL }, {"arch_supported_by_host", (PyCFunction)_pakfire_arch_supported_by_host, METH_VARARGS, NULL }, { NULL, NULL, 0, NULL } @@ -208,13 +206,6 @@ PyMODINIT_FUNC PyInit__pakfire(void) { // Add constants PyObject* d = PyModule_GetDict(module); - // Namespace stuff - PyDict_SetItemString(d, "SCHED_CLONE_NEWIPC", Py_BuildValue("i", CLONE_NEWIPC)); - PyDict_SetItemString(d, "SCHED_CLONE_NEWPID", Py_BuildValue("i", CLONE_NEWPID)); - PyDict_SetItemString(d, "SCHED_CLONE_NEWNET", Py_BuildValue("i", CLONE_NEWNET)); - PyDict_SetItemString(d, "SCHED_CLONE_NEWNS", Py_BuildValue("i", CLONE_NEWNS)); - PyDict_SetItemString(d, "SCHED_CLONE_NEWUTS", Py_BuildValue("i", CLONE_NEWUTS)); - // Add constants for relations PyDict_SetItemString(d, "REL_EQ", Py_BuildValue("i", REL_EQ)); PyDict_SetItemString(d, "REL_LT", Py_BuildValue("i", REL_LT)); diff --git a/src/_pakfire/util.c b/src/_pakfire/util.c index d9095f321..f89e76389 100644 --- a/src/_pakfire/util.c +++ b/src/_pakfire/util.c @@ -21,7 +21,6 @@ #include #include -#include #include #include @@ -40,21 +39,6 @@ PyObject *_sync(PyObject *self, PyObject *args) { Py_RETURN_NONE; } -PyObject *_unshare(PyObject *self, PyObject *args) { - int flags = 0; - - if (!PyArg_ParseTuple(args, "i", &flags)) { - return NULL; - } - - int ret = unshare(flags); - if (ret < 0) { - return PyErr_SetFromErrno(PyExc_RuntimeError); - } - - return Py_BuildValue("i", ret); -} - PyObject *version_compare(PyObject *self, PyObject *args) { Pool *pool; const char *evr1, *evr2; diff --git a/src/_pakfire/util.h b/src/_pakfire/util.h index 98a736910..75839ba62 100644 --- a/src/_pakfire/util.h +++ b/src/_pakfire/util.h @@ -29,7 +29,6 @@ #include "pakfire.h" extern PyObject *_sync(PyObject *self, PyObject *args); -extern PyObject *_unshare(PyObject *self, PyObject *args); extern PyObject *version_compare(PyObject *self, PyObject *args); extern PyObject* performance_index(PyObject* self, PyObject* args); diff --git a/src/pakfire/builder.py b/src/pakfire/builder.py index 72f53a07f..8c310ad0b 100644 --- a/src/pakfire/builder.py +++ b/src/pakfire/builder.py @@ -108,18 +108,6 @@ class Builder(object): # Initialize cgroups self.cgroup = self._make_cgroup() - # Unshare namepsace. - # If this fails because the kernel has no support for CLONE_NEWIPC or CLONE_NEWUTS, - # we try to fall back to just set CLONE_NEWNS. - try: - _pakfire.unshare(_pakfire.SCHED_CLONE_NEWNS|_pakfire.SCHED_CLONE_NEWIPC|_pakfire.SCHED_CLONE_NEWUTS) - except RuntimeError as e: - _pakfire.unshare(_pakfire.SCHED_CLONE_NEWNS) - - # Optionally enable private networking. - if self.settings.get("private_network", None): - _pakfire.unshare(_pakfire.SCHED_CLONE_NEWNET) - def __enter__(self): self.log.debug("Entering %s" % self.path)