diff options
author | Jan Tojnar <jtojnar@gmail.com> | 2019-08-23 18:54:26 +0200 |
---|---|---|
committer | Jan Tojnar <jtojnar@gmail.com> | 2019-08-23 19:50:53 +0200 |
commit | 5db762126cf0e9b4dc9843e043a79b3b5008efcf (patch) | |
tree | 41952f64e1ebe0b42660cb94e816aaa420bca094 /pkgs/tools/networking/ofono | |
parent | 150285190a2a2c57f4f9a0ecdb62afda0a0090f3 (diff) | |
download | nixpkgs-5db762126cf0e9b4dc9843e043a79b3b5008efcf.tar nixpkgs-5db762126cf0e9b4dc9843e043a79b3b5008efcf.tar.gz nixpkgs-5db762126cf0e9b4dc9843e043a79b3b5008efcf.tar.bz2 nixpkgs-5db762126cf0e9b4dc9843e043a79b3b5008efcf.tar.lz nixpkgs-5db762126cf0e9b4dc9843e043a79b3b5008efcf.tar.xz nixpkgs-5db762126cf0e9b4dc9843e043a79b3b5008efcf.tar.zst nixpkgs-5db762126cf0e9b4dc9843e043a79b3b5008efcf.zip |
nixos/ofono: allow adding 3rd party plug-ins
Diffstat (limited to 'pkgs/tools/networking/ofono')
-rw-r--r-- | pkgs/tools/networking/ofono/0001-Search-connectors-in-OFONO_PLUGIN_PATH.patch | 120 | ||||
-rw-r--r-- | pkgs/tools/networking/ofono/default.nix | 4 |
2 files changed, 124 insertions, 0 deletions
diff --git a/pkgs/tools/networking/ofono/0001-Search-connectors-in-OFONO_PLUGIN_PATH.patch b/pkgs/tools/networking/ofono/0001-Search-connectors-in-OFONO_PLUGIN_PATH.patch new file mode 100644 index 00000000000..eb97209a693 --- /dev/null +++ b/pkgs/tools/networking/ofono/0001-Search-connectors-in-OFONO_PLUGIN_PATH.patch @@ -0,0 +1,120 @@ +From 0e0994c9716700c9484b3dccb25f98a9a59d1744 Mon Sep 17 00:00:00 2001 +From: Jan Tojnar <jtojnar@gmail.com> +Date: Fri, 23 Aug 2019 18:42:51 +0200 +Subject: [PATCH] Search connectors in OFONO_PLUGIN_PATH + +Previously, the connectors would only be looked for in a single +directory, specified during compilation. This patch allows to +traverse a list of directories provided by an environment variable. +--- + src/plugin.c | 77 ++++++++++++++++++++++++++++++++++------------------ + 1 file changed, 50 insertions(+), 27 deletions(-) + +diff --git a/src/plugin.c b/src/plugin.c +index 924a45ec..f05055c3 100644 +--- a/src/plugin.c ++++ b/src/plugin.c +@@ -99,35 +99,12 @@ static gboolean check_plugin(struct ofono_plugin_desc *desc, + return TRUE; + } + +-#include "builtin.h" +- +-int __ofono_plugin_init(const char *pattern, const char *exclude) +-{ +- gchar **patterns = NULL; +- gchar **excludes = NULL; +- GSList *list; +- GDir *dir; ++static handle_dir(const gchar *plugin_path, const gchar **patterns, const gchar **excludes) { + const gchar *file; + gchar *filename; +- unsigned int i; +- +- DBG(""); +- +- if (pattern) +- patterns = g_strsplit_set(pattern, ":, ", -1); +- +- if (exclude) +- excludes = g_strsplit_set(exclude, ":, ", -1); +- +- for (i = 0; __ofono_builtin[i]; i++) { +- if (check_plugin(__ofono_builtin[i], +- patterns, excludes) == FALSE) +- continue; +- +- add_plugin(NULL, __ofono_builtin[i]); +- } ++ GDir *dir; + +- dir = g_dir_open(PLUGINDIR, 0, NULL); ++ dir = g_dir_open(plugin_path, 0, NULL); + if (dir != NULL) { + while ((file = g_dir_read_name(dir)) != NULL) { + void *handle; +@@ -137,7 +114,7 @@ int __ofono_plugin_init(const char *pattern, const char *exclude) + g_str_has_suffix(file, ".so") == FALSE) + continue; + +- filename = g_build_filename(PLUGINDIR, file, NULL); ++ filename = g_build_filename(plugin_path, file, NULL); + + handle = dlopen(filename, RTLD_NOW); + if (handle == NULL) { +@@ -168,6 +145,52 @@ int __ofono_plugin_init(const char *pattern, const char *exclude) + + g_dir_close(dir); + } ++} ++ ++#include "builtin.h" ++ ++int __ofono_plugin_init(const char *pattern, const char *exclude) ++{ ++ gchar **patterns = NULL; ++ gchar **excludes = NULL; ++ GSList *list; ++ unsigned int i; ++ ++ DBG(""); ++ ++ if (pattern) ++ patterns = g_strsplit_set(pattern, ":, ", -1); ++ ++ if (exclude) ++ excludes = g_strsplit_set(exclude, ":, ", -1); ++ ++ for (i = 0; __ofono_builtin[i]; i++) { ++ if (check_plugin(__ofono_builtin[i], ++ patterns, excludes) == FALSE) ++ continue; ++ ++ add_plugin(NULL, __ofono_builtin[i]); ++ } ++ ++ ++ const gchar *plugin_path; ++ ++ plugin_path = g_getenv ("OFONO_PLUGIN_PATH"); ++ ++ if (!plugin_path) { ++ gchar **plugin_path_list; ++ gsize i; ++ ++ plugin_path_list = g_strsplit (plugin_path, G_SEARCHPATH_SEPARATOR_S, 0); ++ ++ for (i = 0; plugin_path_list[i]; i++) { ++ handle_dir(plugin_path_list, patterns, excludes); ++ } ++ ++ g_strfreev(plugin_path_list); ++ } ++ ++ handle_dir(PLUGINDIR, patterns, excludes); + + for (list = plugins; list; list = list->next) { + struct ofono_plugin *plugin = list->data; +-- +2.22.0 + diff --git a/pkgs/tools/networking/ofono/default.nix b/pkgs/tools/networking/ofono/default.nix index 168c9139ddd..21d1f9ee067 100644 --- a/pkgs/tools/networking/ofono/default.nix +++ b/pkgs/tools/networking/ofono/default.nix @@ -22,6 +22,10 @@ stdenv.mkDerivation rec { sha256 = "1qzysmzpgbh6zc3x9xh931wxcazka9wwx727c2k66z9gal2n6n66"; }; + patches = [ + ./0001-Search-connectors-in-OFONO_PLUGIN_PATH.patch + ]; + nativeBuildInputs = [ autoreconfHook pkgconfig |