]> git.ipfire.org Git - pakfire.git/commitdiff
arch: Internalize function to check if the host is compatible
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 18 May 2021 15:36:08 +0000 (15:36 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 18 May 2021 15:36:08 +0000 (15:36 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/_pakfire/_pakfiremodule.c
src/libpakfire/arch.c
src/libpakfire/include/pakfire/arch.h
src/libpakfire/libpakfire.sym

index 557348549d0a6f17aeaa7aa6f08a4e1128275595..ca1dd09f11ba57327c8c2bd48ade7616c9e5bb93 100644 (file)
@@ -45,22 +45,9 @@ static PyObject* _pakfire_native_arch() {
        return PyUnicode_FromString(arch);
 }
 
-static PyObject* _pakfire_arch_supported_by_host(PyObject* self, PyObject* args) {
-       const char* name = NULL;
-
-       if (!PyArg_ParseTuple(args, "s", &name))
-               return NULL;
-
-       if (pakfire_arch_supported_by_host(name))
-               Py_RETURN_TRUE;
-
-       Py_RETURN_FALSE;
-}
-
 static PyMethodDef pakfireModuleMethods[] = {
        {"performance_index", (PyCFunction)performance_index, 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 }
 };
 
index 39a52259088e68d83ba61872b99fa386797997b6..689adc99b1cb8928896bfaaf54aba5ee75acf774 100644 (file)
@@ -227,7 +227,7 @@ int pakfire_arch_is_compatible(const char* name, const char* compatible_arch) {
        return 0;
 }
 
-PAKFIRE_EXPORT int pakfire_arch_supported_by_host(const char* name) {
+static int pakfire_arch_supported_by_host(const char* name) {
        const char* native_arch = pakfire_arch_native();
 
        // Check if those two architectures are compatible
@@ -285,6 +285,11 @@ static char* find_interpreter(const char* path, const char* magic) {
 }
 
 char* pakfire_arch_find_interpreter(const char* name) {
+       // If the host supports this architecture natively,
+       // we do not need to search for the interpreter
+       if (pakfire_arch_supported_by_host(name))
+               return NULL;
+
        const struct pakfire_arch* arch = pakfire_arch_find(name);
        if (!arch)
                return NULL;
index 3f93af298f7ac59c4f7b2c7420a02940e885cc29..a4c0c97864a8eb823a49a36b6f5a65d4e0adfb7c 100644 (file)
@@ -23,7 +23,6 @@
 
 int pakfire_arch_supported(const char* name);
 const char* pakfire_arch_native();
-int pakfire_arch_supported_by_host(const char* name);
 
 #ifdef PAKFIRE_PRIVATE
 
index 821addf9f9ab3651274666f427604424adcc93ee..1f07ba1fac6198e2b0715f8e8fbca0e680aa4b98 100644 (file)
@@ -51,7 +51,6 @@ global:
        # arch
        pakfire_arch_native;
        pakfire_arch_supported;
-       pakfire_arch_supported_by_host;
 
        # archive
        pakfire_archive_count_signatures;