]> git.ipfire.org Git - pakfire.git/commitdiff
Drop old unshare code
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 13 Jan 2021 23:46:23 +0000 (23:46 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 13 Jan 2021 23:46:23 +0000 (23:46 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/_pakfire/_pakfiremodule.c
src/_pakfire/util.c
src/_pakfire/util.h
src/pakfire/builder.py

index 1ea54086bcb81e149bb007be456d3da42b190b81..e3410f8fef570a7a7eb99228eb564d4d8a389bf6 100644 (file)
@@ -22,7 +22,6 @@
 
 #include <libintl.h>
 #include <locale.h>
-#include <sched.h>
 
 #include <solv/solver.h>
 
@@ -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));
index d9095f321fd9f8bde15c449ae9b24117ed1e1b95..f89e76389e7866eec21e6489793d2215cc5af0c3 100644 (file)
@@ -21,7 +21,6 @@
 #include <Python.h>
 
 #include <errno.h>
-#include <sched.h>
 #include <time.h>
 #include <unistd.h>
 
@@ -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;
index 98a736910c600fcae196a885eec2e8de4087dbc5..75839ba621fa9f16013988b6c25fee69fb3ce48a 100644 (file)
@@ -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);
 
index 72f53a07fe4fc74984e1f1f94f3d26ff13d1ae3d..8c310ad0bff9d36b092541b1740200bca58eb60a 100644 (file)
@@ -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)