Make the in-tree CLI use the in-tree PPP
authorMichael Jeanson <mjeanson@efficios.com>
Wed, 10 Jul 2019 19:39:10 +0000 (15:39 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 18 Jul 2019 15:53:35 +0000 (11:53 -0400)
We build an in-tree version of the CLI binary that refers to in-tree
versions of the plugins and other artefacts which currently doesn't
support the Pyhton plugin provider.

Add the logic to use the in-tree version of the Python plugin provider
using the LIBBABELTRACE2_PLUGIN_PROVIDER_DIR environment variable.

If the variable is already set, do not overwrite it. If the python
plugin is enabled, set it to the appropriate in-tree path, otherwise set
it to an invalid path so we don't load an hypothetical system installed
provider.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Change-Id: I4151c36fef90c791cc8b515233d0d3e8fefcdbd5
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1683
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
src/cli/Makefile.am
src/cli/babeltrace2-cfg-cli-args-default.c

index 6466d39d6a38e4573f22fc225f242cd0cf92d93c..c4087b147c0cccc8688728e2fe3eec00d9f16471 100644 (file)
@@ -13,6 +13,10 @@ endif
 
 AM_CPPFLAGS += '-DCONFIG_IN_TREE_PLUGIN_PATH="$(IN_TREE_PLUGIN_PATH)"'
 
+if ENABLE_PYTHON_PLUGINS
+AM_CPPFLAGS += '-DCONFIG_IN_TREE_PROVIDER_DIR="$(abs_top_builddir)/src/python-plugin-provider/.libs"'
+endif
+
 bin_PROGRAMS = babeltrace2.bin babeltrace2-log.bin
 noinst_PROGRAMS = babeltrace2 babeltrace2-log
 
index aef23a53f607e16c4ff29fd02e0a695cae598b40..b73457a2a869222b06fb1cbcc755680145bf6541 100644 (file)
@@ -52,6 +52,22 @@ struct bt_config *bt_config_cli_args_create_with_default(int argc,
                goto error;
        }
 
+#ifdef CONFIG_IN_TREE_PROVIDER_DIR
+       /*
+        * Set LIBBABELTRACE2_PLUGIN_PROVIDER_DIR to load the in-tree Python
+        * plugin provider, if the env variable is already set, do not overwrite
+        * it.
+        */
+       setenv("LIBBABELTRACE2_PLUGIN_PROVIDER_DIR", CONFIG_IN_TREE_PROVIDER_DIR, 0);
+#else
+       /*
+        * If the Pyhton plugin provider is disabled, use a non-exitent path to avoid
+        * loading the system installed provider if it exit, if the env variable is
+        * already set, do not overwrite it.
+        */
+       setenv("LIBBABELTRACE2_PLUGIN_PROVIDER_DIR", "/nonexistent", 0);
+#endif
+
        cfg = bt_config_cli_args_create(argc, argv, retcode, true, true,
                initial_plugin_paths);
        goto end;
This page took 0.026412 seconds and 4 git commands to generate.