From: Michael Tremer Date: Wed, 10 Mar 2021 11:43:28 +0000 (+0000) Subject: _pakfire: Drop capabilities functionality X-Git-Tag: 0.9.28~1285^2~580 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0df05626f1aa9195e1b2c0719cddc199f1ee64cf;p=pakfire.git _pakfire: Drop capabilities functionality Signed-off-by: Michael Tremer --- diff --git a/Makefile.am b/Makefile.am index 949bc2470..af9ae172d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -171,8 +171,6 @@ _pakfire_la_SOURCES = \ src/_pakfire/_pakfiremodule.c \ src/_pakfire/archive.c \ src/_pakfire/archive.h \ - src/_pakfire/capabilities.c \ - src/_pakfire/capabilities.h \ src/_pakfire/constants.h \ src/_pakfire/errors.h \ src/_pakfire/key.c \ @@ -209,7 +207,6 @@ _pakfire_la_CPPFLAGS = \ _pakfire_la_CFLAGS = \ $(AM_CFLAGS) \ $(PYTHON_DEVEL_CFLAGS) \ - $(CAP_CFLAGS) \ -Wno-cast-function-type _pakfire_la_LDFLAGS = \ @@ -220,8 +217,7 @@ _pakfire_la_LDFLAGS = \ _pakfire_la_LIBADD = \ $(PYTHON_DEVEL_LIBS) \ - $(PAKFIRE_LIBS) \ - $(CAP_LIBS) + $(PAKFIRE_LIBS) # ------------------------------------------------------------------------------ diff --git a/configure.ac b/configure.ac index 391a78e01..5e533dbf5 100644 --- a/configure.ac +++ b/configure.ac @@ -159,14 +159,6 @@ AC_SEARCH_LIBS([dlsym], [dl], [], [AC_MSG_ERROR([*** Dynamic linking loader libr DL_LIBS="$LIBS" AC_SUBST(DL_LIBS) -# libcap -AC_CHECK_HEADERS([sys/capability.h], [], [AC_MSG_ERROR([*** POSIX caps headers not found])]) - -LIBS= -AC_SEARCH_LIBS([cap_init], [cap], [], [AC_MSG_ERROR([*** POSIX caps library not found])]) -CAP_LIBS="$LIBS" -AC_SUBST(CAP_LIBS) - # libsolv AC_CHECK_HEADERS([solv/solvversion.h], [], [AC_MSG_ERROR([*** libsolv headers not found])]) diff --git a/src/_pakfire/_pakfiremodule.c b/src/_pakfire/_pakfiremodule.c index 482bea10c..c179d6fc3 100644 --- a/src/_pakfire/_pakfiremodule.c +++ b/src/_pakfire/_pakfiremodule.c @@ -31,7 +31,6 @@ #include #include "archive.h" -#include "capabilities.h" #include "constants.h" #include "errors.h" #include "key.h" @@ -114,7 +113,6 @@ static PyObject* _pakfire_umount(PyObject* self, PyObject* args) { static PyMethodDef pakfireModuleMethods[] = { {"performance_index", (PyCFunction)performance_index, METH_VARARGS, NULL}, - {"get_capabilities", (PyCFunction)get_capabilities, 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 }, {"mount", (PyCFunction)_pakfire_mount, METH_VARARGS|METH_KEYWORDS, NULL }, diff --git a/src/_pakfire/capabilities.c b/src/_pakfire/capabilities.c deleted file mode 100644 index de9b00dff..000000000 --- a/src/_pakfire/capabilities.c +++ /dev/null @@ -1,73 +0,0 @@ -/*############################################################################# -# # -# Pakfire - The IPFire package management system # -# Copyright (C) 2011 Pakfire development team # -# # -# This program is free software: you can redistribute it and/or modify # -# it under the terms of the GNU General Public License as published by # -# the Free Software Foundation, either version 3 of the License, or # -# (at your option) any later version. # -# # -# This program is distributed in the hope that it will be useful, # -# but WITHOUT ANY WARRANTY; without even the implied warranty of # -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # -# GNU General Public License for more details. # -# # -# You should have received a copy of the GNU General Public License # -# along with this program. If not, see . # -# # -#############################################################################*/ - -#include - -#include -#include - -#include "constants.h" - -PyObject * -get_capabilities(PyObject *self, PyObject *args) { - const char *filename; - cap_t cap_d; - char exception[STRING_SIZE]; - - if (!PyArg_ParseTuple(args, "s", &filename)) { - /* XXX raise exception */ - return NULL; - } - - cap_d = cap_get_file(filename); - if (cap_d == NULL) { - if (errno == EOPNOTSUPP) { - /* Return nothing, if the operation is not supported. */ - Py_RETURN_NONE; - } else if (errno != ENODATA) { - snprintf(exception, STRING_SIZE - 1, "Failed to get capabilities of file %s (%s).", - filename, strerror(errno)); - PyErr_SetString(PyExc_RuntimeError, exception); - return NULL; - } - Py_RETURN_NONE; - } - - char *result = cap_to_text(cap_d, NULL); - cap_free(cap_d); - - if (!result) { - snprintf(exception, STRING_SIZE - 1, "Failed to get capabilities of human readable format at %s (%s).", - filename, strerror(errno)); - PyErr_SetString(PyExc_RuntimeError, exception); - return NULL; - } - - // Remove leading two characters '= '. - int i; - for (i = 0; i < 2; i++) { - result++; - } - - PyObject * ret = Py_BuildValue("s", result); - cap_free(result); - - return ret; -} diff --git a/src/_pakfire/capabilities.h b/src/_pakfire/capabilities.h deleted file mode 100644 index ffadaa574..000000000 --- a/src/_pakfire/capabilities.h +++ /dev/null @@ -1,28 +0,0 @@ -/*############################################################################# -# # -# Pakfire - The IPFire package management system # -# Copyright (C) 2011 Pakfire development team # -# # -# This program is free software: you can redistribute it and/or modify # -# it under the terms of the GNU General Public License as published by # -# the Free Software Foundation, either version 3 of the License, or # -# (at your option) any later version. # -# # -# This program is distributed in the hope that it will be useful, # -# but WITHOUT ANY WARRANTY; without even the implied warranty of # -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # -# GNU General Public License for more details. # -# # -# You should have received a copy of the GNU General Public License # -# along with this program. If not, see . # -# # -#############################################################################*/ - -#ifndef PYTHON_PAKFIRE_CAPS_H -#define PYTHON_PAKFIRE_CAPS_H - -#include - -extern PyObject *get_capabilities(PyObject *self, PyObject *args); - -#endif /* PYTHON_PAKFIRE_CAPS_H */ diff --git a/src/pakfire/packages/tar.py b/src/pakfire/packages/tar.py index b2758d7d6..e79dbaafd 100644 --- a/src/pakfire/packages/tar.py +++ b/src/pakfire/packages/tar.py @@ -46,12 +46,6 @@ class InnerTarFile(tarfile.TarFile): if tarinfo.isreg(): attrs = [] - # Save capabilities. - caps = util.get_capabilities(name) - if caps: - log.debug("Saving capabilities for %s: %s" % (name, caps)) - tarinfo.pax_headers["PAKFIRE.capabilities"] = caps - # Append the tar header and data to the archive. f = tarfile.bltn_open(name, "rb") self.addfile(tarinfo, f) diff --git a/src/pakfire/util.py b/src/pakfire/util.py index f6929fd9a..96ce10f34 100644 --- a/src/pakfire/util.py +++ b/src/pakfire/util.py @@ -32,9 +32,6 @@ log = logging.getLogger("pakfire") from .constants import * from .i18n import _ -# Import binary version of capability functions -from ._pakfire import get_capabilities - def cli_is_interactive(): """ Say weather a shell is interactive or not.